mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
Fixed AndroidStudio tests to actually run, removed app/src/main/assets/ as a requirement and added app/src/main/res instead, added placeholder for build/ folder, Removed dupe gitignore
This commit is contained in:
parent
7e54af75d8
commit
011b57da54
1
.gitignore
vendored
1
.gitignore
vendored
@ -40,7 +40,6 @@ Desktop.ini
|
|||||||
*.iml
|
*.iml
|
||||||
.idea
|
.idea
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
/framework/build
|
|
||||||
node_modules/jshint
|
node_modules/jshint
|
||||||
node_modules/promise-matchers
|
node_modules/promise-matchers
|
||||||
node_modules/jasmine-node
|
node_modules/jasmine-node
|
||||||
|
7
bin/templates/cordova/lib/AndroidStudio.js
vendored
7
bin/templates/cordova/lib/AndroidStudio.js
vendored
@ -8,15 +8,20 @@
|
|||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var CordovaError = require('cordova-common').CordovaError;
|
||||||
|
|
||||||
module.exports.isAndroidStudioProject = function isAndroidStudioProject(root) {
|
module.exports.isAndroidStudioProject = function isAndroidStudioProject(root) {
|
||||||
var eclipseFiles = ['AndroidManifest.xml', 'libs', 'res', 'project.properties', 'platform_www'];
|
var eclipseFiles = ['AndroidManifest.xml', 'libs', 'res', 'project.properties', 'platform_www'];
|
||||||
var androidStudioFiles = ['app', 'gradle', 'build', 'app/src/main/assets'];
|
var androidStudioFiles = ['app', 'gradle', 'build', 'app/src/main/res'];
|
||||||
|
|
||||||
// assume it is an AS project and not an Eclipse project
|
// assume it is an AS project and not an Eclipse project
|
||||||
var isEclipse = false;
|
var isEclipse = false;
|
||||||
var isAS = true;
|
var isAS = true;
|
||||||
|
|
||||||
|
if(!fs.existsSync(root)) {
|
||||||
|
throw new CordovaError('AndroidStudio.js:inAndroidStudioProject root does not exist: ' + root);
|
||||||
|
}
|
||||||
|
|
||||||
// if any of the following exists, then we are not an ASProj
|
// if any of the following exists, then we are not an ASProj
|
||||||
eclipseFiles.forEach(function(file) {
|
eclipseFiles.forEach(function(file) {
|
||||||
if(fs.existsSync(path.join(root, file))) {
|
if(fs.existsSync(path.join(root, file))) {
|
||||||
|
1
spec/fixtures/android_studio_project/app/build/placeholder
vendored
Normal file
1
spec/fixtures/android_studio_project/app/build/placeholder
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Tests require that this folder exists.
|
@ -1,14 +0,0 @@
|
|||||||
var AndroidStudio = require('../../bin/templates/cordova/lib/AndroidStudio');
|
|
||||||
|
|
||||||
describe('AndroidStudio module', function () {
|
|
||||||
it('should detect Android Studio project', function() {
|
|
||||||
var root = './fixtures/android_studio_project';
|
|
||||||
spyOn(AndroidStudio, 'isAndroidStudioProject').andReturn(true);
|
|
||||||
AndroidStudio.isAndroidStudioProject(root);
|
|
||||||
});
|
|
||||||
it('should detect non Android Studio project', function() {
|
|
||||||
var root = './fixtures/android_project';
|
|
||||||
spyOn(AndroidStudio, 'isAndroidStudioProject').andReturn(false);
|
|
||||||
AndroidStudio.isAndroidStudioProject(root);
|
|
||||||
});
|
|
||||||
});
|
|
17
spec/unit/AndroidStudio.spec.js
Normal file
17
spec/unit/AndroidStudio.spec.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
var path = require('path');
|
||||||
|
var AndroidStudio = require('../../bin/templates/cordova/lib/AndroidStudio');
|
||||||
|
|
||||||
|
|
||||||
|
describe('AndroidStudio module', function () {
|
||||||
|
it('should return true for Android Studio project', function() {
|
||||||
|
var root = path.join(__dirname,'../fixtures/android_studio_project/');
|
||||||
|
var isAndStud = AndroidStudio.isAndroidStudioProject(root);
|
||||||
|
expect(isAndStud).toBe(true);
|
||||||
|
});
|
||||||
|
it('should return false non Android Studio project', function() {
|
||||||
|
var root = path.join(__dirname,'../fixtures/android_project/');
|
||||||
|
var isAndStud = AndroidStudio.isAndroidStudioProject(root);
|
||||||
|
expect(isAndStud).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user