cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From audre...@apache.org
Subject [6/8] android commit: CB-12895 : fixed eslint errors
Date Fri, 23 Jun 2017 17:18:21 GMT
CB-12895 : fixed eslint errors


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/d83d49d8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/d83d49d8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/d83d49d8

Branch: refs/heads/master
Commit: d83d49d83b04fcc1371a3c29f092f03c2e600d12
Parents: e36158a
Author: Audrey So <audreyso@apache.org>
Authored: Tue Jun 13 11:42:20 2017 -0700
Committer: Audrey So <audreyso@apache.org>
Committed: Fri Jun 23 08:07:08 2017 -0700

----------------------------------------------------------------------
 .travis.yml                                     |    2 +-
 bin/lib/create.js                               |  212 +-
 bin/templates/cordova/Api.js                    |  137 +-
 bin/templates/cordova/lib/Adb.js                |   16 +-
 bin/templates/cordova/lib/AndroidManifest.js    |   39 +-
 bin/templates/cordova/lib/AndroidProject.js     |   41 +-
 bin/templates/cordova/lib/AndroidStudio.js      |   16 +-
 bin/templates/cordova/lib/android_sdk.js        |   37 +-
 bin/templates/cordova/lib/build.js              |   91 +-
 .../cordova/lib/builders/AntBuilder.js          |   45 +-
 .../cordova/lib/builders/GenericBuilder.js      |   44 +-
 .../cordova/lib/builders/GradleBuilder.js       |  112 +-
 bin/templates/cordova/lib/builders/builders.js  |    3 +-
 bin/templates/cordova/lib/check_reqs.js         |  132 +-
 bin/templates/cordova/lib/device.js             |   48 +-
 bin/templates/cordova/lib/emulator.js           |  159 +-
 bin/templates/cordova/lib/log.js                |   20 +-
 bin/templates/cordova/lib/pluginHandlers.js     |   82 +-
 bin/templates/cordova/lib/prepare.js            |   70 +-
 bin/templates/cordova/lib/retry.js              |    4 +-
 bin/templates/cordova/lib/run.js                |   57 +-
 bin/templates/project/assets/www/cordova.js     | 3865 +++++++++---------
 bin/templates/project/assets/www/js/index.js    |   10 +-
 package.json                                    |    2 +-
 spec/e2e/create.spec.js                         |   18 +-
 spec/e2e/helpers/projectActions.js              |   22 +-
 spec/e2e/plugin.spec.js                         |    9 +-
 spec/e2e/update.spec.js                         |   29 +-
 .../www/dummyplugin.js                          |    1 -
 spec/unit/AndroidProject.spec.js                |    7 +-
 spec/unit/AndroidStudio.spec.js                 |   18 +-
 spec/unit/Api.spec.js                           |   15 +-
 spec/unit/android_sdk.spec.js                   |  120 +-
 spec/unit/builders/GradleBuilder.spec.js        |   15 +-
 spec/unit/check_reqs.spec.js                    |  228 +-
 spec/unit/create.spec.js                        |  156 +-
 spec/unit/emulator.spec.js                      |  103 +-
 spec/unit/pluginHandlers/common.spec.js         |   55 +-
 spec/unit/pluginHandlers/handlers.spec.js       |  128 +-
 spec/unit/run.spec.js                           |   31 +-
 40 files changed, 3025 insertions(+), 3174 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index a52db17..7ad8eea 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,7 +15,7 @@ android:
       - tools
       - tools
 script:
-    - npm run jshint
+    - npm run eslint
     - npm run cover
     - npm run test-build
 after_script:

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 2fa0c8c..0b90269 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -19,30 +19,30 @@
        under the License.
 */
 
-var shell = require('shelljs'),
-    Q     = require('q'),
-    path  = require('path'),
-    fs    = require('fs'),
-    check_reqs = require('./../templates/cordova/lib/check_reqs'),
-    ROOT    = path.join(__dirname, '..', '..');
+var shell = require('shelljs');
+var Q = require('q');
+var path = require('path');
+var fs = require('fs');
+var check_reqs = require('./../templates/cordova/lib/check_reqs');
+var ROOT = path.join(__dirname, '..', '..');
 
 var MIN_SDK_VERSION = 16;
 
 var CordovaError = require('cordova-common').CordovaError;
 var AndroidManifest = require('../templates/cordova/lib/AndroidManifest');
 
-function setShellFatal(value, func) {
+function setShellFatal (value, func) {
     var oldVal = shell.config.fatal;
     shell.config.fatal = value;
     func();
     shell.config.fatal = oldVal;
 }
 
-function getFrameworkDir(projectPath, shared) {
+function getFrameworkDir (projectPath, shared) {
     return shared ? path.join(ROOT, 'framework') : path.join(projectPath, 'CordovaLib');
 }
 
-function copyJsAndLibrary(projectPath, shared, projectName) {
+function copyJsAndLibrary (projectPath, shared, projectName) {
     var nestedCordovaLibPath = getFrameworkDir(projectPath, false);
     var srcCordovaJsPath = path.join(ROOT, 'bin', 'templates', 'project', 'assets', 'www', 'cordova.js');
     shell.cp('-f', srcCordovaJsPath, path.join(projectPath, 'assets', 'www', 'cordova.js'));
@@ -57,8 +57,8 @@ function copyJsAndLibrary(projectPath, shared, projectName) {
     shell.cp('-rf', path.join(ROOT, 'cordova-js-src'), path.join(projectPath, 'platform_www'));
 
     // Don't fail if there are no old jars.
-    setShellFatal(false, function() {
-        shell.ls(path.join(projectPath, 'libs', 'cordova-*.jar')).forEach(function(oldJar) {
+    setShellFatal(false, function () {
+        shell.ls(path.join(projectPath, 'libs', 'cordova-*.jar')).forEach(function (oldJar) {
             console.log('Deleting ' + oldJar);
             shell.rm('-f', oldJar);
         });
@@ -90,7 +90,7 @@ function copyJsAndLibrary(projectPath, shared, projectName) {
     }
 }
 
-function extractSubProjectPaths(data) {
+function extractSubProjectPaths (data) {
     var ret = {};
     var r = /^\s*android\.library\.reference\.\d+=(.*)(?:\s|$)/mg;
     var m;
@@ -100,7 +100,7 @@ function extractSubProjectPaths(data) {
     return Object.keys(ret);
 }
 
-function writeProjectProperties(projectPath, target_api) {
+function writeProjectProperties (projectPath, target_api) {
     var dstPath = path.join(projectPath, 'project.properties');
     var templatePath = path.join(ROOT, 'bin', 'templates', 'project', 'project.properties');
     var srcPath = fs.existsSync(dstPath) ? dstPath : templatePath;
@@ -108,11 +108,10 @@ function writeProjectProperties(projectPath, target_api) {
     var data = fs.readFileSync(srcPath, 'utf8');
     data = data.replace(/^target=.*/m, 'target=' + target_api);
     var subProjects = extractSubProjectPaths(data);
-    subProjects = subProjects.filter(function(p) {
+    subProjects = subProjects.filter(function (p) {
         return !(/^CordovaLib$/m.exec(p) ||
-                 /[\\\/]cordova-android[\\\/]framework$/m.exec(p) ||
-                 /^(\.\.[\\\/])+framework$/m.exec(p)
-                 );
+                 /[\\/]cordova-android[\\/]framework$/m.exec(p) ||
+                 /^(\.\.[\\/])+framework$/m.exec(p));
     });
     subProjects.unshift('CordovaLib');
     data = data.replace(/^\s*android\.library\.reference\.\d+=.*\n/mg, '');
@@ -120,24 +119,24 @@ function writeProjectProperties(projectPath, target_api) {
         data += '\n';
     }
     for (var i = 0; i < subProjects.length; ++i) {
-        data += 'android.library.reference.' + (i+1) + '=' + subProjects[i] + '\n';
+        data += 'android.library.reference.' + (i + 1) + '=' + subProjects[i] + '\n';
     }
     fs.writeFileSync(dstPath, data);
 }
 
-function prepBuildFiles(projectPath) {
+function prepBuildFiles (projectPath) {
     var buildModule = require(path.resolve(projectPath, 'cordova/lib/builders/builders'));
     buildModule.getBuilder('gradle').prepBuildFiles();
 }
 
-function copyBuildRules(projectPath) {
+function copyBuildRules (projectPath) {
     var srcDir = path.join(ROOT, 'bin', 'templates', 'project');
 
     shell.cp('-f', path.join(srcDir, 'build.gradle'), projectPath);
     shell.cp('-f', path.join(srcDir, 'wrapper.gradle'), projectPath);
 }
 
-function copyScripts(projectPath) {
+function copyScripts (projectPath) {
     var bin = path.join(ROOT, 'bin');
     var srcScriptsDir = path.join(bin, 'templates', 'cordova');
     var destScriptsDir = path.join(projectPath, 'cordova');
@@ -164,17 +163,17 @@ function copyScripts(projectPath) {
  * Returns a promise, fulfilled if the package name is acceptable; rejected
  * otherwise.
  */
-function validatePackageName(package_name) {
-    //Make the package conform to Java package types
-    //http://developer.android.com/guide/topics/manifest/manifest-element.html#package
-    //Enforce underscore limitation
+function validatePackageName (package_name) {
+    // Make the package conform to Java package types
+    // http://developer.android.com/guide/topics/manifest/manifest-element.html#package
+    // Enforce underscore limitation
     var msg = 'Error validating package name. ';
     if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) {
         return Q.reject(new CordovaError(msg + 'Package name must look like: com.company.Name'));
     }
 
-    //Class is a reserved word
-    if(/\b[Cc]lass\b/.test(package_name)) {
+    // Class is a reserved word
+    if (/\b[Cc]lass\b/.test(package_name)) {
         return Q.reject(new CordovaError(msg + '"class" is a reserved word'));
     }
 
@@ -186,19 +185,19 @@ function validatePackageName(package_name) {
  * Returns a promise, fulfilled if the project name is acceptable; rejected
  * otherwise.
  */
-function validateProjectName(project_name) {
+function validateProjectName (project_name) {
     var msg = 'Error validating project name. ';
-    //Make sure there's something there
+    // Make sure there's something there
     if (project_name === '') {
         return Q.reject(new CordovaError(msg + 'Project name cannot be empty'));
     }
 
-    //Enforce stupid name error
+    // Enforce stupid name error
     if (project_name === 'CordovaActivity') {
         return Q.reject(new CordovaError(msg + 'Project name cannot be CordovaActivity'));
     }
 
-    //Classes in Java don't begin with numbers
+    // Classes in Java don't begin with numbers
     if (/^[0-9]/.test(project_name)) {
         return Q.reject(new CordovaError(msg + 'Project name must not begin with a number'));
     }
@@ -224,83 +223,83 @@ function validateProjectName(project_name) {
  *
  * @return  {Promise<String>}  Directory where application has been created
  */
-exports.create = function(project_path, config, options, events) {
+exports.create = function (project_path, config, options, events) {
 
     options = options || {};
 
     // Set default values for path, package and name
     project_path = path.relative(process.cwd(), (project_path || 'CordovaExample'));
     // Check if project already exists
-    if(fs.existsSync(project_path)) {
+    if (fs.existsSync(project_path)) {
         return Q.reject(new CordovaError('Project already exists! Delete and recreate'));
     }
 
     var package_name = config.packageName() || 'my.cordova.project';
     var project_name = config.name() ?
-        config.name().replace(/[^\w.]/g,'_') : 'CordovaExample';
+        config.name().replace(/[^\w.]/g, '_') : 'CordovaExample';
 
     var safe_activity_name = config.android_activityName() || options.activityName || 'MainActivity';
-    var target_api      = check_reqs.get_target();
+    var target_api = check_reqs.get_target();
 
-    //Make the package conform to Java package types
+    // Make the package conform to Java package types
     return validatePackageName(package_name)
-    .then(function() {
-        validateProjectName(project_name);
-    }).then(function() {
+        .then(function () {
+            validateProjectName(project_name);
+        }).then(function () {
         // Log the given values for the project
-        events.emit('log', 'Creating Cordova project for the Android platform:');
-        events.emit('log', '\tPath: ' + project_path);
-        events.emit('log', '\tPackage: ' + package_name);
-        events.emit('log', '\tName: ' + project_name);
-        events.emit('log', '\tActivity: ' + safe_activity_name);
-        events.emit('log', '\tAndroid target: ' + target_api);
-
-        events.emit('verbose', 'Copying android template project to ' + project_path);
-
-        setShellFatal(true, function() {
-            var project_template_dir = options.customTemplate || path.join(ROOT, 'bin', 'templates', 'project');
-            // copy project template
-            shell.cp('-r', path.join(project_template_dir, 'assets'), project_path);
-            shell.cp('-r', path.join(project_template_dir, 'res'), project_path);
-            shell.cp(path.join(project_template_dir, 'gitignore'), path.join(project_path, '.gitignore'));
-
-            // Manually create directories that would be empty within the template (since git doesn't track directories).
-            shell.mkdir(path.join(project_path, 'libs'));
-
-            // copy cordova.js, cordova.jar
-            copyJsAndLibrary(project_path, options.link, safe_activity_name);
-
-            // interpolate the activity name and package
-            var packagePath = package_name.replace(/\./g, path.sep);
-            var activity_dir = path.join(project_path, 'src', packagePath);
-            var activity_path = path.join(activity_dir, safe_activity_name + '.java');
-            shell.mkdir('-p', activity_dir);
-            shell.cp('-f', path.join(project_template_dir, 'Activity.java'), activity_path);
-            shell.sed('-i', /__ACTIVITY__/, safe_activity_name, activity_path);
-            shell.sed('-i', /__NAME__/, project_name, path.join(project_path, 'res', 'values', 'strings.xml'));
-            shell.sed('-i', /__ID__/, package_name, activity_path);
-
-            var manifest = new AndroidManifest(path.join(project_template_dir, 'AndroidManifest.xml'));
-            manifest.setPackageId(package_name)
-                .setTargetSdkVersion(target_api.split('-')[1])
-                .getActivity().setName(safe_activity_name);
-
-            var manifest_path = path.join(project_path, 'AndroidManifest.xml');
-            manifest.write(manifest_path);
-
-            copyScripts(project_path);
-            copyBuildRules(project_path);
-        });
-        // Link it to local android install.
-        writeProjectProperties(project_path, target_api);
-        prepBuildFiles(project_path);
-        events.emit('log', generateDoneMessage('create', options.link));
-    }).thenResolve(project_path);
+            events.emit('log', 'Creating Cordova project for the Android platform:');
+            events.emit('log', '\tPath: ' + project_path);
+            events.emit('log', '\tPackage: ' + package_name);
+            events.emit('log', '\tName: ' + project_name);
+            events.emit('log', '\tActivity: ' + safe_activity_name);
+            events.emit('log', '\tAndroid target: ' + target_api);
+
+            events.emit('verbose', 'Copying android template project to ' + project_path);
+
+            setShellFatal(true, function () {
+                var project_template_dir = options.customTemplate || path.join(ROOT, 'bin', 'templates', 'project');
+                // copy project template
+                shell.cp('-r', path.join(project_template_dir, 'assets'), project_path);
+                shell.cp('-r', path.join(project_template_dir, 'res'), project_path);
+                shell.cp(path.join(project_template_dir, 'gitignore'), path.join(project_path, '.gitignore'));
+
+                // Manually create directories that would be empty within the template (since git doesn't track directories).
+                shell.mkdir(path.join(project_path, 'libs'));
+
+                // copy cordova.js, cordova.jar
+                copyJsAndLibrary(project_path, options.link, safe_activity_name);
+
+                // interpolate the activity name and package
+                var packagePath = package_name.replace(/\./g, path.sep);
+                var activity_dir = path.join(project_path, 'src', packagePath);
+                var activity_path = path.join(activity_dir, safe_activity_name + '.java');
+                shell.mkdir('-p', activity_dir);
+                shell.cp('-f', path.join(project_template_dir, 'Activity.java'), activity_path);
+                shell.sed('-i', /__ACTIVITY__/, safe_activity_name, activity_path);
+                shell.sed('-i', /__NAME__/, project_name, path.join(project_path, 'res', 'values', 'strings.xml'));
+                shell.sed('-i', /__ID__/, package_name, activity_path);
+
+                var manifest = new AndroidManifest(path.join(project_template_dir, 'AndroidManifest.xml'));
+                manifest.setPackageId(package_name)
+                    .setTargetSdkVersion(target_api.split('-')[1])
+                    .getActivity().setName(safe_activity_name);
+
+                var manifest_path = path.join(project_path, 'AndroidManifest.xml');
+                manifest.write(manifest_path);
+
+                copyScripts(project_path);
+                copyBuildRules(project_path);
+            });
+            // Link it to local android install.
+            writeProjectProperties(project_path, target_api);
+            prepBuildFiles(project_path);
+            events.emit('log', generateDoneMessage('create', options.link));
+        }).thenResolve(project_path);
 };
 
-function generateDoneMessage(type, link) {
+function generateDoneMessage (type, link) {
     var pkg = require('../../package');
-    var msg = 'Android project ' + (type == 'update' ? 'updated ' : 'created ') + 'with ' + pkg.name + '@' + pkg.version;
+    var msg = 'Android project ' + (type === 'update' ? 'updated ' : 'created ') + 'with ' + pkg.name + '@' + pkg.version;
     if (link) {
         msg += ' and has a linked CordovaLib';
     }
@@ -308,34 +307,33 @@ function generateDoneMessage(type, link) {
 }
 
 // Returns a promise.
-exports.update = function(projectPath, options, events) {
+exports.update = function (projectPath, options, events) {
     options = options || {};
 
     return Q()
-    .then(function() {
+        .then(function () {
 
-        var manifest = new AndroidManifest(path.join(projectPath, 'AndroidManifest.xml'));
+            var manifest = new AndroidManifest(path.join(projectPath, 'AndroidManifest.xml'));
 
-        if (Number(manifest.getMinSdkVersion()) < MIN_SDK_VERSION) {
-            events.emit('verbose', 'Updating minSdkVersion to ' + MIN_SDK_VERSION + ' in AndroidManifest.xml');
-            manifest.setMinSdkVersion(MIN_SDK_VERSION);
-        }
+            if (Number(manifest.getMinSdkVersion()) < MIN_SDK_VERSION) {
+                events.emit('verbose', 'Updating minSdkVersion to ' + MIN_SDK_VERSION + ' in AndroidManifest.xml');
+                manifest.setMinSdkVersion(MIN_SDK_VERSION);
+            }
 
-        manifest.setDebuggable(false).write();
+            manifest.setDebuggable(false).write();
 
-        var projectName = manifest.getActivity().getName();
-        var target_api = check_reqs.get_target();
+            var projectName = manifest.getActivity().getName();
+            var target_api = check_reqs.get_target();
 
-        copyJsAndLibrary(projectPath, options.link, projectName);
-        copyScripts(projectPath);
-        copyBuildRules(projectPath);
-        writeProjectProperties(projectPath, target_api);
-        prepBuildFiles(projectPath);
-        events.emit('log', generateDoneMessage('update', options.link));
-    }).thenResolve(projectPath);
+            copyJsAndLibrary(projectPath, options.link, projectName);
+            copyScripts(projectPath);
+            copyBuildRules(projectPath);
+            writeProjectProperties(projectPath, target_api);
+            prepBuildFiles(projectPath);
+            events.emit('log', generateDoneMessage('update', options.link));
+        }).thenResolve(projectPath);
 };
 
-
 // For testing
 exports.validatePackageName = validatePackageName;
 exports.validateProjectName = validateProjectName;

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/Api.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/Api.js b/bin/templates/cordova/Api.js
index 8e4711c..107108e 100644
--- a/bin/templates/cordova/Api.js
+++ b/bin/templates/cordova/Api.js
@@ -29,8 +29,7 @@ var selfEvents = require('cordova-common').events;
 
 var PLATFORM = 'android';
 
-
-function setupEvents(externalEventEmitter) {
+function setupEvents (externalEventEmitter) {
     if (externalEventEmitter) {
         // This will make the platform internal events visible outside
         selfEvents.forwardEventsTo(externalEventEmitter);
@@ -43,7 +42,6 @@ function setupEvents(externalEventEmitter) {
     return selfEvents;
 }
 
-
 /**
  * Class, that acts as abstraction over particular platform. Encapsulates the
  *   platform's properties and methods.
@@ -55,7 +53,7 @@ function setupEvents(externalEventEmitter) {
  *
  * * platform: String that defines a platform name.
  */
-function Api(platform, platformRootDir, events) {
+function Api (platform, platformRootDir, events) {
     this.platform = PLATFORM;
     this.root = path.resolve(__dirname, '..');
 
@@ -79,14 +77,14 @@ function Api(platform, platformRootDir, events) {
     };
 
     // XXX Override some locations for Android Studio projects
-    if(AndroidStudio.isAndroidStudioProject(self.root) === true) {
-      selfEvents.emit('log', 'Android Studio project detected');
-      this.android_studio = true;
-      this.locations.configXml = path.join(self.root, 'app/src/main/res/xml/config.xml');
-      this.locations.strings = path.join(self.root, 'app/src/main/res/xml/strings.xml');
-      this.locations.manifest = path.join(self.root, 'app/src/main/AndroidManifest.xml');
-      this.locations.www = path.join(self.root, 'app/src/main/assets/www');
-      this.locations.res = path.join(self.root, 'app/src/main/res');
+    if (AndroidStudio.isAndroidStudioProject(self.root) === true) {
+        selfEvents.emit('log', 'Android Studio project detected');
+        this.android_studio = true;
+        this.locations.configXml = path.join(self.root, 'app/src/main/res/xml/config.xml');
+        this.locations.strings = path.join(self.root, 'app/src/main/res/xml/strings.xml');
+        this.locations.manifest = path.join(self.root, 'app/src/main/AndroidManifest.xml');
+        this.locations.www = path.join(self.root, 'app/src/main/assets/www');
+        this.locations.res = path.join(self.root, 'app/src/main/res');
     }
 }
 
@@ -112,16 +110,13 @@ Api.createPlatform = function (destination, config, options, events) {
     events = setupEvents(events);
     var result;
     try {
-        result = require('../../lib/create')
-        .create(destination, config, options, events)
-        .then(function (destination) {
+        result = require('../../lib/create').create(destination, config, options, events).then(function (destination) {
             var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
             return new PlatformApi(PLATFORM, destination, events);
         });
-    }
-    catch (e) {
-        events.emit('error','createPlatform is not callable from the android project API.');
-        throw(e);
+    } catch (e) {
+        events.emit('error', 'createPlatform is not callable from the android project API.');
+        throw (e);
     }
     return result;
 };
@@ -146,16 +141,13 @@ Api.updatePlatform = function (destination, options, events) {
     events = setupEvents(events);
     var result;
     try {
-        result = require('../../lib/create')
-        .update(destination, options, events)
-        .then(function (destination) {
+        result = require('../../lib/create').update(destination, options, events).then(function (destination) {
             var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
             return new PlatformApi('android', destination, events);
         });
-    }
-    catch (e) {
-        events.emit('error','updatePlatform is not callable from the android project API, you will need to do this manually.');
-        throw(e);
+    } catch (e) {
+        events.emit('error', 'updatePlatform is not callable from the android project API, you will need to do this manually.');
+        throw (e);
     }
     return result;
 };
@@ -226,40 +218,36 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
         installOptions.variables.PACKAGE_NAME = project.getPackageName();
     }
 
-    if(this.android_studio === true) {
-      installOptions.android_studio = true;
+    if (this.android_studio === true) {
+        installOptions.android_studio = true;
     }
 
-    return Q()
-       .then(function () {
-            //CB-11964: Do a clean when installing the plugin code to get around
-            //the Gradle bug introduced by the Android Gradle Plugin Version 2.2
-            //TODO: Delete when the next version of Android Gradle plugin comes out
-
-           // Since clean doesn't just clean the build, it also wipes out www, we need
-           // to pass additional options.
-
-           // Do some basic argument parsing
-            var opts = {};
-
-             // Skip cleaning prepared files when not invoking via cordova CLI.
-            opts.noPrepare = true;
-
-            if(!AndroidStudio.isAndroidStudioProject(self.root) && !project.isClean()) {
-              return self.clean(opts);
-            }
-        })
-       .then(function () {
-            return PluginManager.get(self.platform, self.locations, project)
-                .addPlugin(plugin, installOptions);
-        })
-      .then(function () {
-            if (plugin.getFrameworks(this.platform).length === 0) return;
+    return Q().then(function () {
+        // CB-11964: Do a clean when installing the plugin code to get around
+        // the Gradle bug introduced by the Android Gradle Plugin Version 2.2
+        // TODO: Delete when the next version of Android Gradle plugin comes out
 
-            selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');
-            require('./lib/builders/builders').getBuilder('gradle').prepBuildFiles();
-        }.bind(this))
-       // CB-11022 Return truthy value to prevent running prepare after
+        // Since clean doesn't just clean the build, it also wipes out www, we need
+        // to pass additional options.
+
+        // Do some basic argument parsing
+        var opts = {};
+
+        // Skip cleaning prepared files when not invoking via cordova CLI.
+        opts.noPrepare = true;
+
+        if (!AndroidStudio.isAndroidStudioProject(self.root) && !project.isClean()) {
+            return self.clean(opts);
+        }
+    }).then(function () {
+        return PluginManager.get(self.platform, self.locations, project).addPlugin(plugin, installOptions);
+    }).then(function () {
+        if (plugin.getFrameworks(this.platform).length === 0) return;
+
+        selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');
+        require('./lib/builders/builders').getBuilder('gradle').prepBuildFiles();
+    }.bind(this))
+        // CB-11022 Return truthy value to prevent running prepare after
         .thenResolve(true);
 };
 
@@ -279,9 +267,9 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
 Api.prototype.removePlugin = function (plugin, uninstallOptions) {
     var project = AndroidProject.getProjectFile(this.root);
 
-    if(uninstallOptions && uninstallOptions.usePlatformWww === true && this.android_studio === true) {
-      uninstallOptions.usePlatformWww = false;
-      uninstallOptions.android_studio = true;
+    if (uninstallOptions && uninstallOptions.usePlatformWww === true && this.android_studio === true) {
+        uninstallOptions.usePlatformWww = false;
+        uninstallOptions.android_studio = true;
     }
 
     return PluginManager.get(this.platform, this.locations, project)
@@ -343,11 +331,9 @@ Api.prototype.removePlugin = function (plugin, uninstallOptions) {
  */
 Api.prototype.build = function (buildOptions) {
     var self = this;
-    return require('./lib/check_reqs').run()
-    .then(function () {
+    return require('./lib/check_reqs').run().then(function () {
         return require('./lib/build').run.call(self, buildOptions);
-    })
-    .then(function (buildResults) {
+    }).then(function (buildResults) {
         // Cast build result to array of build artifacts
         return buildResults.apkPaths.map(function (apkPath) {
             return {
@@ -372,10 +358,9 @@ Api.prototype.build = function (buildOptions) {
  * @return {Promise} A promise either fulfilled if package was built and ran
  *   successfully, or rejected with CordovaError.
  */
-Api.prototype.run = function(runOptions) {
+Api.prototype.run = function (runOptions) {
     var self = this;
-    return require('./lib/check_reqs').run()
-    .then(function () {
+    return require('./lib/check_reqs').run().then(function () {
         return require('./lib/run').run.call(self, runOptions);
     });
 };
@@ -387,19 +372,15 @@ Api.prototype.run = function(runOptions) {
  * @return  {Promise}  Return a promise either fulfilled, or rejected with
  *   CordovaError.
  */
-Api.prototype.clean = function(cleanOptions) {
+Api.prototype.clean = function (cleanOptions) {
     var self = this;
-    return require('./lib/check_reqs').run()
-      .then(function () {
-          return require('./lib/build').runClean.call(self, cleanOptions);
-      })
-      .then(function () {
-          return require('./lib/prepare').clean.call(self, cleanOptions);
-      });
+    return require('./lib/check_reqs').run().then(function () {
+        return require('./lib/build').runClean.call(self, cleanOptions);
+    }).then(function () {
+        return require('./lib/prepare').clean.call(self, cleanOptions);
+    });
 };
 
-
-
 /**
  * Performs a requirements check for current platform. Each platform defines its
  *   own set of requirements, which should be resolved before platform can be
@@ -408,7 +389,7 @@ Api.prototype.clean = function(cleanOptions) {
  * @return  {Promise<Requirement[]>}  Promise, resolved with set of Requirement
  *   objects for current platform.
  */
-Api.prototype.requirements = function() {
+Api.prototype.requirements = function () {
     return require('./lib/check_reqs').check_all();
 };
 

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/Adb.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/Adb.js b/bin/templates/cordova/lib/Adb.js
index 84ae707..038c67c 100644
--- a/bin/templates/cordova/lib/Adb.js
+++ b/bin/templates/cordova/lib/Adb.js
@@ -25,11 +25,11 @@ var CordovaError = require('cordova-common').CordovaError;
 
 var Adb = {};
 
-function isDevice(line) {
+function isDevice (line) {
     return line.match(/\w+\tdevice/) && !line.match(/emulator/);
 }
 
-function isEmulator(line) {
+function isEmulator (line) {
     return line.match(/device/) && line.match(/emulator/);
 }
 
@@ -44,8 +44,7 @@ function isEmulator(line) {
  *   devices/emulators
  */
 Adb.devices = function (opts) {
-    return spawn('adb', ['devices'], {cwd: os.tmpdir()})
-    .then(function(output) {
+    return spawn('adb', ['devices'], {cwd: os.tmpdir()}).then(function (output) {
         return output.split('\n').filter(function (line) {
             // Filter out either real devices or emulators, depending on options
             return (line && opts && opts.emulators) ? isEmulator(line) : isDevice(line);
@@ -59,8 +58,7 @@ Adb.install = function (target, packagePath, opts) {
     events.emit('verbose', 'Installing apk ' + packagePath + ' on target ' + target + '...');
     var args = ['-s', target, 'install'];
     if (opts && opts.replace) args.push('-r');
-    return spawn('adb', args.concat(packagePath), {cwd: os.tmpdir()})
-    .then(function(output) {
+    return spawn('adb', args.concat(packagePath), {cwd: os.tmpdir()}).then(function (output) {
         // 'adb install' seems to always returns no error, even if installation fails
         // so we catching output to detect installation failure
         if (output.match(/Failure/)) {
@@ -86,8 +84,7 @@ Adb.shell = function (target, shellCommand) {
     events.emit('verbose', 'Running adb shell command "' + shellCommand + '" on target ' + target + '...');
     var args = ['-s', target, 'shell'];
     shellCommand = shellCommand.split(/\s+/);
-    return spawn('adb', args.concat(shellCommand), {cwd: os.tmpdir()})
-    .catch(function (output) {
+    return spawn('adb', args.concat(shellCommand), {cwd: os.tmpdir()}).catch(function (output) {
         return Q.reject(new CordovaError('Failed to execute shell command "' +
             shellCommand + '"" on device: ' + output));
     });
@@ -95,8 +92,7 @@ Adb.shell = function (target, shellCommand) {
 
 Adb.start = function (target, activityName) {
     events.emit('verbose', 'Starting application "' + activityName + '" on target ' + target + '...');
-    return Adb.shell(target, 'am start -W -a android.intent.action.MAIN -n' + activityName)
-    .catch(function (output) {
+    return Adb.shell(target, 'am start -W -a android.intent.action.MAIN -n' + activityName).catch(function (output) {
         return Q.reject(new CordovaError('Failed to start application "' +
             activityName + '"" on device: ' + output));
     });

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/AndroidManifest.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/AndroidManifest.js b/bin/templates/cordova/lib/AndroidManifest.js
index 8248f59..5b7077a 100644
--- a/bin/templates/cordova/lib/AndroidManifest.js
+++ b/bin/templates/cordova/lib/AndroidManifest.js
@@ -19,12 +19,12 @@
 
 var fs = require('fs');
 var et = require('elementtree');
-var xml= require('cordova-common').xmlHelpers;
+var xml = require('cordova-common').xmlHelpers;
 
 var DEFAULT_ORIENTATION = 'default';
 
 /** Wraps an AndroidManifest file */
-function AndroidManifest(path) {
+function AndroidManifest (path) {
     this.path = path;
     this.doc = xml.parseElementtreeSync(path);
     if (this.doc.getroot().tag !== 'manifest') {
@@ -32,38 +32,38 @@ function AndroidManifest(path) {
     }
 }
 
-AndroidManifest.prototype.getVersionName = function() {
+AndroidManifest.prototype.getVersionName = function () {
     return this.doc.getroot().attrib['android:versionName'];
 };
 
-AndroidManifest.prototype.setVersionName = function(versionName) {
+AndroidManifest.prototype.setVersionName = function (versionName) {
     this.doc.getroot().attrib['android:versionName'] = versionName;
     return this;
 };
 
-AndroidManifest.prototype.getVersionCode = function() {
+AndroidManifest.prototype.getVersionCode = function () {
     return this.doc.getroot().attrib['android:versionCode'];
 };
 
-AndroidManifest.prototype.setVersionCode = function(versionCode) {
+AndroidManifest.prototype.setVersionCode = function (versionCode) {
     this.doc.getroot().attrib['android:versionCode'] = versionCode;
     return this;
 };
 
-AndroidManifest.prototype.getPackageId = function() {
-    /*jshint -W069 */
+AndroidManifest.prototype.getPackageId = function () {
+    /* jshint -W069 */
     return this.doc.getroot().attrib['package'];
-    /*jshint +W069 */
+    /* jshint +W069 */
 };
 
-AndroidManifest.prototype.setPackageId = function(pkgId) {
-    /*jshint -W069 */
+AndroidManifest.prototype.setPackageId = function (pkgId) {
+    /* jshint -W069 */
     this.doc.getroot().attrib['package'] = pkgId;
-    /*jshint +W069 */
+    /* jshint +W069 */
     return this;
 };
 
-AndroidManifest.prototype.getActivity = function() {
+AndroidManifest.prototype.getActivity = function () {
     var activity = this.doc.getroot().find('./application/activity');
     return {
         getName: function () {
@@ -102,17 +102,16 @@ AndroidManifest.prototype.getActivity = function() {
     };
 };
 
-['minSdkVersion', 'maxSdkVersion', 'targetSdkVersion']
-.forEach(function(sdkPrefName) {
+['minSdkVersion', 'maxSdkVersion', 'targetSdkVersion'].forEach(function (sdkPrefName) {
     // Copy variable reference to avoid closure issues
     var prefName = sdkPrefName;
 
-    AndroidManifest.prototype['get' + capitalize(prefName)] = function() {
+    AndroidManifest.prototype['get' + capitalize(prefName)] = function () {
         var usesSdk = this.doc.getroot().find('./uses-sdk');
         return usesSdk && usesSdk.attrib['android:' + prefName];
     };
 
-    AndroidManifest.prototype['set' + capitalize(prefName)] = function(prefValue) {
+    AndroidManifest.prototype['set' + capitalize(prefName)] = function (prefValue) {
         var usesSdk = this.doc.getroot().find('./uses-sdk');
 
         if (!usesSdk && prefValue) { // if there is no required uses-sdk element, we should create it first
@@ -128,11 +127,11 @@ AndroidManifest.prototype.getActivity = function() {
     };
 });
 
-AndroidManifest.prototype.getDebuggable = function() {
+AndroidManifest.prototype.getDebuggable = function () {
     return this.doc.getroot().find('./application').attrib['android:debuggable'] === 'true';
 };
 
-AndroidManifest.prototype.setDebuggable = function(value) {
+AndroidManifest.prototype.setDebuggable = function (value) {
     var application = this.doc.getroot().find('./application');
     if (value) {
         application.attrib['android:debuggable'] = 'true';
@@ -150,7 +149,7 @@ AndroidManifest.prototype.setDebuggable = function(value) {
  * @param   {String}  [destPath]  File to write manifest to. If omitted,
  *   manifest will be written to file it has been read from.
  */
-AndroidManifest.prototype.write = function(destPath) {
+AndroidManifest.prototype.write = function (destPath) {
     fs.writeFileSync(destPath || this.path, this.doc.write({indent: 4}), 'utf-8');
 };
 

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/AndroidProject.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/AndroidProject.js b/bin/templates/cordova/lib/AndroidProject.js
index fa1c612..bf55cad 100644
--- a/bin/templates/cordova/lib/AndroidProject.js
+++ b/bin/templates/cordova/lib/AndroidProject.js
@@ -26,16 +26,15 @@ var pluginHandlers = require('./pluginHandlers');
 
 var projectFileCache = {};
 
-function addToPropertyList(projectProperties, key, value) {
+function addToPropertyList (projectProperties, key, value) {
     var i = 1;
-    while (projectProperties.get(key + '.' + i))
-        i++;
+    while (projectProperties.get(key + '.' + i)) { i++; }
 
     projectProperties.set(key + '.' + i, value);
     projectProperties.dirty = true;
 }
 
-function removeFromPropertyList(projectProperties, key, value) {
+function removeFromPropertyList (projectProperties, key, value) {
     var i = 1;
     var currentValue;
     while ((currentValue = projectProperties.get(key + '.' + i))) {
@@ -54,18 +53,18 @@ function removeFromPropertyList(projectProperties, key, value) {
 
 function getRelativeLibraryPath (parentDir, subDir) {
     var libraryPath = path.relative(parentDir, subDir);
-    return (path.sep == '\\') ? libraryPath.replace(/\\/g, '/') : libraryPath;
+    return (path.sep === '\\') ? libraryPath.replace(/\\/g, '/') : libraryPath;
 }
 
-function AndroidProject(projectDir) {
+function AndroidProject (projectDir) {
     this._propertiesEditors = {};
     this._subProjectDirs = {};
     this._dirty = false;
     this.projectDir = projectDir;
     this.platformWww = path.join(this.projectDir, 'platform_www');
     this.www = path.join(this.projectDir, 'assets/www');
-    if(AndroidStudio.isAndroidStudioProject(projectDir) === true) {
-      this.www = path.join(this.projectDir, 'app/src/main/assets/www');
+    if (AndroidStudio.isAndroidStudioProject(projectDir) === true) {
+        this.www = path.join(this.projectDir, 'app/src/main/assets/www');
     }
 }
 
@@ -92,15 +91,15 @@ AndroidProject.purgeCache = function (projectDir) {
  *
  * @return  {String}              The name of the package
  */
-AndroidProject.prototype.getPackageName = function() {
+AndroidProject.prototype.getPackageName = function () {
     var manifestPath = path.join(this.projectDir, 'AndroidManifest.xml');
-    if(AndroidStudio.isAndroidStudioProject(this.projectDir) === true) {
-      manifestPath = path.join(this.projectDir, 'app/src/main/AndroidManifest.xml');
+    if (AndroidStudio.isAndroidStudioProject(this.projectDir) === true) {
+        manifestPath = path.join(this.projectDir, 'app/src/main/AndroidManifest.xml');
     }
     return new AndroidManifest(manifestPath).getPackageId();
 };
 
-AndroidProject.prototype.getCustomSubprojectRelativeDir = function(plugin_id, src) {
+AndroidProject.prototype.getCustomSubprojectRelativeDir = function (plugin_id, src) {
     // All custom subprojects are prefixed with the last portion of the package id.
     // This is to avoid collisions when opening multiple projects in Eclipse that have subprojects with the same name.
     var packageName = this.getPackageName();
@@ -110,7 +109,7 @@ AndroidProject.prototype.getCustomSubprojectRelativeDir = function(plugin_id, sr
     return subRelativeDir;
 };
 
-AndroidProject.prototype.addSubProject = function(parentDir, subDir) {
+AndroidProject.prototype.addSubProject = function (parentDir, subDir) {
     var parentProjectFile = path.resolve(parentDir, 'project.properties');
     var subProjectFile = path.resolve(subDir, 'project.properties');
     var parentProperties = this._getPropertiesFile(parentProjectFile);
@@ -126,7 +125,7 @@ AndroidProject.prototype.addSubProject = function(parentDir, subDir) {
     this._dirty = true;
 };
 
-AndroidProject.prototype.removeSubProject = function(parentDir, subDir) {
+AndroidProject.prototype.removeSubProject = function (parentDir, subDir) {
     var parentProjectFile = path.resolve(parentDir, 'project.properties');
     var parentProperties = this._getPropertiesFile(parentProjectFile);
     removeFromPropertyList(parentProperties, 'android.library.reference', getRelativeLibraryPath(parentDir, subDir));
@@ -134,35 +133,35 @@ AndroidProject.prototype.removeSubProject = function(parentDir, subDir) {
     this._dirty = true;
 };
 
-AndroidProject.prototype.addGradleReference = function(parentDir, subDir) {
+AndroidProject.prototype.addGradleReference = function (parentDir, subDir) {
     var parentProjectFile = path.resolve(parentDir, 'project.properties');
     var parentProperties = this._getPropertiesFile(parentProjectFile);
     addToPropertyList(parentProperties, 'cordova.gradle.include', getRelativeLibraryPath(parentDir, subDir));
     this._dirty = true;
 };
 
-AndroidProject.prototype.removeGradleReference = function(parentDir, subDir) {
+AndroidProject.prototype.removeGradleReference = function (parentDir, subDir) {
     var parentProjectFile = path.resolve(parentDir, 'project.properties');
     var parentProperties = this._getPropertiesFile(parentProjectFile);
     removeFromPropertyList(parentProperties, 'cordova.gradle.include', getRelativeLibraryPath(parentDir, subDir));
     this._dirty = true;
 };
 
-AndroidProject.prototype.addSystemLibrary = function(parentDir, value) {
+AndroidProject.prototype.addSystemLibrary = function (parentDir, value) {
     var parentProjectFile = path.resolve(parentDir, 'project.properties');
     var parentProperties = this._getPropertiesFile(parentProjectFile);
     addToPropertyList(parentProperties, 'cordova.system.library', value);
     this._dirty = true;
 };
 
-AndroidProject.prototype.removeSystemLibrary = function(parentDir, value) {
+AndroidProject.prototype.removeSystemLibrary = function (parentDir, value) {
     var parentProjectFile = path.resolve(parentDir, 'project.properties');
     var parentProperties = this._getPropertiesFile(parentProjectFile);
     removeFromPropertyList(parentProperties, 'cordova.system.library', value);
     this._dirty = true;
 };
 
-AndroidProject.prototype.write = function() {
+AndroidProject.prototype.write = function () {
     if (!this._dirty) {
         return;
     }
@@ -201,9 +200,9 @@ AndroidProject.prototype.getUninstaller = function (type) {
  * This checks if an Android project is clean or has old build artifacts
  */
 
-AndroidProject.prototype.isClean = function() {
+AndroidProject.prototype.isClean = function () {
     var build_path = path.join(this.projectDir, 'build');
-    //If the build directory doesn't exist, it's clean
+    // If the build directory doesn't exist, it's clean
     return !(fs.existsSync(build_path));
 };
 

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/AndroidStudio.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/AndroidStudio.js b/bin/templates/cordova/lib/AndroidStudio.js
index 335b334..860301a 100644
--- a/bin/templates/cordova/lib/AndroidStudio.js
+++ b/bin/templates/cordova/lib/AndroidStudio.js
@@ -4,13 +4,13 @@
  *  @param {String} root Root folder of the project
  */
 
-/*jshint esnext: false */
+/* jshint esnext: false */
 
 var path = require('path');
 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 androidStudioFiles = ['app', 'gradle', 'app/src/main/res'];
 
@@ -18,21 +18,21 @@ module.exports.isAndroidStudioProject = function isAndroidStudioProject(root) {
     var isEclipse = false;
     var isAS = true;
 
-    if(!fs.existsSync(root)) {
+    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
-    eclipseFiles.forEach(function(file) {
-        if(fs.existsSync(path.join(root, file))) {
+    eclipseFiles.forEach(function (file) {
+        if (fs.existsSync(path.join(root, file))) {
             isEclipse = true;
         }
     });
 
     // if it is NOT an eclipse project, check that all required files exist
-    if(!isEclipse) {
-        androidStudioFiles.forEach(function(file){
-            if(!fs.existsSync(path.join(root, file))) {
+    if (!isEclipse) {
+        androidStudioFiles.forEach(function (file) {
+            if (!fs.existsSync(path.join(root, file))) {
                 console.log('missing file :: ' + file);
                 isAS = false;
             }

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/android_sdk.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/android_sdk.js b/bin/templates/cordova/lib/android_sdk.js
index a1a806a..ca8f9e3 100755
--- a/bin/templates/cordova/lib/android_sdk.js
+++ b/bin/templates/cordova/lib/android_sdk.js
@@ -17,8 +17,8 @@
        under the License.
 */
 
-var Q = require('q'),
-    superspawn = require('cordova-common').superspawn;
+var Q = require('q');
+var superspawn = require('cordova-common').superspawn;
 
 var suffix_number_regex = /(\d+)$/;
 // Used for sorting Android targets, example strings to sort:
@@ -29,7 +29,7 @@ var suffix_number_regex = /(\d+)$/;
 // The idea is to sort based on largest "suffix" number - meaning the bigger
 // the number at the end, the more recent the target, the closer to the
 // start of the array.
-function sort_by_largest_numerical_suffix(a, b) {
+function sort_by_largest_numerical_suffix (a, b) {
     var suffix_a = a.match(suffix_number_regex);
     var suffix_b = b.match(suffix_number_regex);
     if (suffix_a && suffix_b) {
@@ -43,9 +43,8 @@ function sort_by_largest_numerical_suffix(a, b) {
     }
 }
 
-module.exports.print_newest_available_sdk_target = function() {
-    return module.exports.list_targets()
-    .then(function(targets) {
+module.exports.print_newest_available_sdk_target = function () {
+    return module.exports.list_targets().then(function (targets) {
         targets.sort(sort_by_largest_numerical_suffix);
         console.log(targets[0]);
     });
@@ -66,38 +65,34 @@ module.exports.version_string_to_api_level = {
     '7.1.1': 25
 };
 
-function parse_targets(output) {
+function parse_targets (output) {
     var target_out = output.split('\n');
     var targets = [];
     for (var i = target_out.length - 1; i >= 0; i--) {
-        if(target_out[i].match(/id:/)) { // if "id:" is in the line...
-            targets.push(target_out[i].match(/"(.+)"/)[1]); //.. match whatever is in quotes.
+        if (target_out[i].match(/id:/)) { // if "id:" is in the line...
+            targets.push(target_out[i].match(/"(.+)"/)[1]); // .. match whatever is in quotes.
         }
     }
     return targets;
 }
 
-module.exports.list_targets_with_android = function() {
-    return superspawn.spawn('android', ['list', 'target'])
-    .then(parse_targets);
+module.exports.list_targets_with_android = function () {
+    return superspawn.spawn('android', ['list', 'target']).then(parse_targets);
 };
 
-module.exports.list_targets_with_avdmanager = function() {
-    return superspawn.spawn('avdmanager', ['list', 'target'])
-    .then(parse_targets);
+module.exports.list_targets_with_avdmanager = function () {
+    return superspawn.spawn('avdmanager', ['list', 'target']).then(parse_targets);
 };
 
-module.exports.list_targets = function() {
-    return module.exports.list_targets_with_avdmanager()
-    .catch(function(err) {
+module.exports.list_targets = function () {
+    return module.exports.list_targets_with_avdmanager().catch(function (err) {
         // If there's an error, like avdmanager could not be found, we can try
         // as a last resort, to run `android`, in case this is a super old
         // SDK installation.
-        if (err && (err.code == 'ENOENT' || (err.stderr && err.stderr.match(/not recognized/)))) {
+        if (err && (err.code === 'ENOENT' || (err.stderr && err.stderr.match(/not recognized/)))) {
             return module.exports.list_targets_with_android();
         } else throw err;
-    })
-    .then(function(targets) {
+    }).then(function (targets) {
         if (targets.length === 0) {
             return Q.reject(new Error('No android targets (SDKs) installed!'));
         }

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index bd613da..7c2238a 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -19,10 +19,10 @@
        under the License.
 */
 
-var Q       = require('q'),
-    path    = require('path'),
-    fs      = require('fs'),
-    nopt = require('nopt');
+var Q = require('q');
+var path = require('path');
+var fs = require('fs');
+var nopt = require('nopt');
 
 var Adb = require('./Adb');
 
@@ -31,7 +31,7 @@ var events = require('cordova-common').events;
 var spawn = require('cordova-common').superspawn.spawn;
 var CordovaError = require('cordova-common').CordovaError;
 
-function parseOpts(options, resolvedTarget, projectRoot) {
+function parseOpts (options, resolvedTarget, projectRoot) {
     options = options || {};
     options.argv = nopt({
         gradle: Boolean,
@@ -55,16 +55,13 @@ function parseOpts(options, resolvedTarget, projectRoot) {
         extraArgs: []
     };
 
-    if (options.argv.ant || options.argv.gradle)
-        ret.buildMethod = options.argv.ant ? 'ant' : 'gradle';
+    if (options.argv.ant || options.argv.gradle) { ret.buildMethod = options.argv.ant ? 'ant' : 'gradle'; }
 
     if (options.nobuild) ret.buildMethod = 'none';
 
-    if (options.argv.versionCode)
-        ret.extraArgs.push('-PcdvVersionCode=' + options.argv.versionCode);
+    if (options.argv.versionCode) { ret.extraArgs.push('-PcdvVersionCode=' + options.argv.versionCode); }
 
-    if (options.argv.minSdkVersion)
-        ret.extraArgs.push('-PcdvMinSdkVersion=' + options.argv.minSdkVersion);
+    if (options.argv.minSdkVersion) { ret.extraArgs.push('-PcdvMinSdkVersion=' + options.argv.minSdkVersion); }
 
     if (options.argv.gradleArg) {
         ret.extraArgs = ret.extraArgs.concat(options.argv.gradleArg);
@@ -72,12 +69,10 @@ function parseOpts(options, resolvedTarget, projectRoot) {
 
     var packageArgs = {};
 
-    if (options.argv.keystore)
-        packageArgs.keystore = path.relative(projectRoot, path.resolve(options.argv.keystore));
+    if (options.argv.keystore) { packageArgs.keystore = path.relative(projectRoot, path.resolve(options.argv.keystore)); }
 
-    ['alias','storePassword','password','keystoreType'].forEach(function (flagName) {
-        if (options.argv[flagName])
-            packageArgs[flagName] = options.argv[flagName];
+    ['alias', 'storePassword', 'password', 'keystoreType'].forEach(function (flagName) {
+        if (options.argv[flagName]) { packageArgs[flagName] = options.argv[flagName]; }
     });
 
     var buildConfig = options.buildConfig;
@@ -88,20 +83,20 @@ function parseOpts(options, resolvedTarget, projectRoot) {
         if (!fs.existsSync(buildConfig)) {
             throw new Error('Specified build config file does not exist: ' + buildConfig);
         }
-        events.emit('log', 'Reading build config file: '+ path.resolve(buildConfig));
+        events.emit('log', 'Reading build config file: ' + path.resolve(buildConfig));
         var buildjson = fs.readFileSync(buildConfig, 'utf8');
         var config = JSON.parse(buildjson.replace(/^\ufeff/, '')); // Remove BOM
         if (config.android && config.android[ret.buildType]) {
             var androidInfo = config.android[ret.buildType];
-            if(androidInfo.keystore && !packageArgs.keystore) {
-                if(androidInfo.keystore.substr(0,1) === '~') {
+            if (androidInfo.keystore && !packageArgs.keystore) {
+                if (androidInfo.keystore.substr(0, 1) === '~') {
                     androidInfo.keystore = process.env.HOME + androidInfo.keystore.substr(1);
                 }
                 packageArgs.keystore = path.resolve(path.dirname(buildConfig), androidInfo.keystore);
                 events.emit('log', 'Reading the keystore from: ' + packageArgs.keystore);
             }
 
-            ['alias', 'storePassword', 'password','keystoreType'].forEach(function (key){
+            ['alias', 'storePassword', 'password', 'keystoreType'].forEach(function (key) {
                 packageArgs[key] = packageArgs[key] || androidInfo[key];
             });
         }
@@ -112,8 +107,8 @@ function parseOpts(options, resolvedTarget, projectRoot) {
             packageArgs.password, packageArgs.keystoreType);
     }
 
-    if(!ret.packageInfo) {
-        if(Object.keys(packageArgs).length > 0) {
+    if (!ret.packageInfo) {
+        if (Object.keys(packageArgs).length > 0) {
             events.emit('warn', '\'keystore\' and \'alias\' need to be specified to generate a signed archive.');
         }
     }
@@ -125,11 +120,10 @@ function parseOpts(options, resolvedTarget, projectRoot) {
  * Builds the project with the specifed options
  * Returns a promise.
  */
-module.exports.runClean = function(options) {
+module.exports.runClean = function (options) {
     var opts = parseOpts(options, null, this.root);
     var builder = builders.getBuilder(opts.buildMethod);
-    return builder.prepEnv(opts)
-    .then(function() {
+    return builder.prepEnv(opts).then(function () {
         return builder.clean(opts);
     });
 };
@@ -146,17 +140,15 @@ module.exports.runClean = function(options) {
  * @return  {Promise<Object>}            Promise, resolved with built packages
  *   information.
  */
-module.exports.run = function(options, optResolvedTarget) {
+module.exports.run = function (options, optResolvedTarget) {
     var opts = parseOpts(options, optResolvedTarget, this.root);
     var builder = builders.getBuilder(opts.buildMethod);
-    return builder.prepEnv(opts)
-    .then(function() {
+    return builder.prepEnv(opts).then(function () {
         if (opts.prepEnv) {
             events.emit('verbose', 'Build file successfully prepared.');
             return;
         }
-        return builder.build(opts)
-        .then(function() {
+        return builder.build(opts).then(function () {
             var apkPaths = builder.findOutputApks(opts.buildType, opts.arch);
             events.emit('log', 'Built the following apk(s): \n\t' + apkPaths.join('\n\t'));
             return {
@@ -172,38 +164,31 @@ module.exports.run = function(options, optResolvedTarget) {
  * Detects the architecture of a device/emulator
  * Returns "arm" or "x86".
  */
-module.exports.detectArchitecture = function(target) {
-    function helper() {
-        return Adb.shell(target, 'cat /proc/cpuinfo')
-        .then(function(output) {
+module.exports.detectArchitecture = function (target) {
+    function helper () {
+        return Adb.shell(target, 'cat /proc/cpuinfo').then(function (output) {
             return /intel/i.exec(output) ? 'x86' : 'arm';
         });
     }
     // It sometimes happens (at least on OS X), that this command will hang forever.
     // To fix it, either unplug & replug device, or restart adb server.
-    return helper()
-    .timeout(1000, new CordovaError('Device communication timed out. Try unplugging & replugging the device.'))
-    .then(null, function(err) {
+    return helper().timeout(1000, new CordovaError('Device communication timed out. Try unplugging & replugging the device.')).then(null, function (err) {
         if (/timed out/.exec('' + err)) {
             // adb kill-server doesn't seem to do the trick.
             // Could probably find a x-platform version of killall, but I'm not actually
             // sure that this scenario even happens on non-OSX machines.
             events.emit('verbose', 'adb timed out while detecting device/emulator architecture. Killing adb and trying again.');
-            return spawn('killall', ['adb'])
-            .then(function() {
-                return helper()
-                .then(null, function() {
+            return spawn('killall', ['adb']).then(function () {
+                return helper().then(null, function () {
                     // The double kill is sadly often necessary, at least on mac.
                     events.emit('warn', 'adb timed out a second time while detecting device/emulator architecture. Killing adb and trying again.');
-                    return spawn('killall', ['adb'])
-                    .then(function() {
-                        return helper()
-                        .then(null, function() {
+                    return spawn('killall', ['adb']).then(function () {
+                        return helper().then(null, function () {
                             return Q.reject(new CordovaError('adb timed out a third time while detecting device/emulator architecture. Try unplugging & replugging the device.'));
                         });
                     });
                 });
-            }, function() {
+            }, function () {
                 // For non-killall OS's.
                 return Q.reject(err);
             });
@@ -212,10 +197,10 @@ module.exports.detectArchitecture = function(target) {
     });
 };
 
-module.exports.findBestApkForArchitecture = function(buildResults, arch) {
-    var paths = buildResults.apkPaths.filter(function(p) {
+module.exports.findBestApkForArchitecture = function (buildResults, arch) {
+    var paths = buildResults.apkPaths.filter(function (p) {
         var apkName = path.basename(p);
-        if (buildResults.buildType == 'debug') {
+        if (buildResults.buildType === 'debug') {
             return /-debug/.exec(apkName);
         }
         return !/-debug/.exec(apkName);
@@ -235,7 +220,7 @@ module.exports.findBestApkForArchitecture = function(buildResults, arch) {
     throw new Error('Could not find apk architecture: ' + arch + ' build-type: ' + buildResults.buildType);
 };
 
-function PackageInfo(keystore, alias, storePassword, password, keystoreType) {
+function PackageInfo (keystore, alias, storePassword, password, keystoreType) {
     this.keystore = {
         'name': 'key.store',
         'value': keystore
@@ -265,10 +250,10 @@ function PackageInfo(keystore, alias, storePassword, password, keystoreType) {
 }
 
 PackageInfo.prototype = {
-    toProperties: function() {
+    toProperties: function () {
         var self = this;
         var result = '';
-        Object.keys(self).forEach(function(key) {
+        Object.keys(self).forEach(function (key) {
             result += self[key].name;
             result += '=';
             result += self[key].value.replace(/\\/g, '\\\\');
@@ -278,7 +263,7 @@ PackageInfo.prototype = {
     }
 };
 
-module.exports.help = function() {
+module.exports.help = function () {
     console.log('Usage: ' + path.relative(process.cwd(), path.join('../build')) + ' [flags] [Signed APK flags]');
     console.log('Flags:');
     console.log('    \'--debug\': will build project in debug mode (default)');

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/builders/AntBuilder.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/builders/AntBuilder.js b/bin/templates/cordova/lib/builders/AntBuilder.js
index 4e0f71a..cc08c23 100644
--- a/bin/templates/cordova/lib/builders/AntBuilder.js
+++ b/bin/templates/cordova/lib/builders/AntBuilder.js
@@ -16,6 +16,7 @@
        specific language governing permissions and limitations
        under the License.
 */
+/* eslint no-unused-vars: 0 */
 
 var Q = require('q');
 var fs = require('fs');
@@ -42,30 +43,29 @@ function AntBuilder (projectRoot) {
 
 util.inherits(AntBuilder, GenericBuilder);
 
-AntBuilder.prototype.getArgs = function(cmd, opts) {
+AntBuilder.prototype.getArgs = function (cmd, opts) {
     var args = [cmd, '-f', path.join(this.root, 'build.xml')];
     // custom_rules.xml is required for incremental builds.
     if (hasCustomRules(this.root)) {
         args.push('-Dout.dir=ant-build', '-Dgen.absolute.dir=ant-gen');
     }
-    if(opts.packageInfo) {
+    if (opts.packageInfo) {
         args.push('-propertyfile=' + path.join(this.root, opts.buildType + SIGNING_PROPERTIES));
     }
     return args;
 };
 
-AntBuilder.prototype.prepEnv = function(opts) {
+AntBuilder.prototype.prepEnv = function (opts) {
     var self = this;
-    return check_reqs.check_ant()
-    .then(function() {
+    return check_reqs.check_ant().then(function () {
         // Copy in build.xml on each build so that:
         // A) we don't require the Android SDK at project creation time, and
         // B) we always use the SDK's latest version of it.
-        /*jshint -W069 */
+        /* jshint -W069 */
         var sdkDir = process.env['ANDROID_HOME'];
-        /*jshint +W069 */
+        /* jshint +W069 */
         var buildTemplate = fs.readFileSync(path.join(sdkDir, 'tools', 'lib', 'build.template'), 'utf8');
-        function writeBuildXml(projectPath) {
+        function writeBuildXml (projectPath) {
             var newData = buildTemplate.replace('PROJECT_NAME', self.extractRealProjectNameFromManifest());
             fs.writeFileSync(path.join(projectPath, 'build.xml'), newData);
             if (!fs.existsSync(path.join(projectPath, 'local.properties'))) {
@@ -86,7 +86,7 @@ AntBuilder.prototype.prepEnv = function(opts) {
         var propertiesFilePath = path.join(self.root, propertiesFile);
         if (opts.packageInfo) {
             fs.writeFileSync(propertiesFilePath, TEMPLATE + opts.packageInfo.toProperties());
-        } else if(isAutoGenerated(propertiesFilePath)) {
+        } else if (isAutoGenerated(propertiesFilePath)) {
             shell.rm('-f', propertiesFilePath);
         }
     });
@@ -96,7 +96,7 @@ AntBuilder.prototype.prepEnv = function(opts) {
  * Builds the project with ant.
  * Returns a promise.
  */
-AntBuilder.prototype.build = function(opts) {
+AntBuilder.prototype.build = function (opts) {
     // Without our custom_rules.xml, we need to clean before building.
     var ret = Q();
     if (!hasCustomRules(this.root)) {
@@ -104,11 +104,10 @@ AntBuilder.prototype.build = function(opts) {
         ret = this.clean(opts);
     }
 
-    var args = this.getArgs(opts.buildType == 'debug' ? 'debug' : 'release', opts);
-    return check_reqs.check_ant()
-    .then(function() {
+    var args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts);
+    return check_reqs.check_ant().then(function () {
         return spawn('ant', args, {stdio: 'pipe'});
-    }).progress(function (stdio){
+    }).progress(function (stdio) {
         if (stdio.stderr) {
             process.stderr.write(stdio.stderr);
         } else {
@@ -116,7 +115,7 @@ AntBuilder.prototype.build = function(opts) {
         }
     }).catch(function (error) {
         if (error.toString().indexOf('Unable to resolve project target') >= 0) {
-            return check_reqs.check_android_target(error).then(function() {
+            return check_reqs.check_android_target(error).then(function () {
                 // If due to some odd reason - check_android_target succeeds
                 // we should still fail here.
                 return Q.reject(error);
@@ -126,19 +125,17 @@ AntBuilder.prototype.build = function(opts) {
     });
 };
 
-AntBuilder.prototype.clean = function(opts) {
+AntBuilder.prototype.clean = function (opts) {
     var args = this.getArgs('clean', opts);
     var self = this;
-    return check_reqs.check_ant()
-    .then(function() {
+    return check_reqs.check_ant().then(function () {
         return spawn('ant', args, {stdio: 'inherit'});
-    })
-    .then(function () {
+    }).then(function () {
         shell.rm('-rf', path.join(self.root, 'out'));
 
-        ['debug', 'release'].forEach(function(config) {
+        ['debug', 'release'].forEach(function (config) {
             var propertiesFilePath = path.join(self.root, config + SIGNING_PROPERTIES);
-            if(isAutoGenerated(propertiesFilePath)){
+            if (isAutoGenerated(propertiesFilePath)) {
                 shell.rm('-f', propertiesFilePath);
             }
         });
@@ -147,10 +144,10 @@ AntBuilder.prototype.clean = function(opts) {
 
 module.exports = AntBuilder;
 
-function hasCustomRules(projectRoot) {
+function hasCustomRules (projectRoot) {
     return fs.existsSync(path.join(projectRoot, 'custom_rules.xml'));
 }
 
-function isAutoGenerated(file) {
+function isAutoGenerated (file) {
     return fs.existsSync(file) && fs.readFileSync(file, 'utf8').indexOf(MARKER) > 0;
 }

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/builders/GenericBuilder.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/builders/GenericBuilder.js b/bin/templates/cordova/lib/builders/GenericBuilder.js
index 362da43..5c4215d 100644
--- a/bin/templates/cordova/lib/builders/GenericBuilder.js
+++ b/bin/templates/cordova/lib/builders/GenericBuilder.js
@@ -16,6 +16,8 @@
        specific language governing permissions and limitations
        under the License.
 */
+/* eslint no-self-assign: 0 */
+/* eslint no-unused-vars: 0 */
 
 var Q = require('q');
 var fs = require('fs');
@@ -32,35 +34,33 @@ function GenericBuilder (projectDir) {
     };
 }
 
-function hasCustomRules(projectRoot) {
+function hasCustomRules (projectRoot) {
     return fs.existsSync(path.join(projectRoot, 'custom_rules.xml'));
 }
 
-GenericBuilder.prototype.prepEnv = function() {
+GenericBuilder.prototype.prepEnv = function () {
     return Q();
 };
 
-GenericBuilder.prototype.build = function() {
+GenericBuilder.prototype.build = function () {
     events.emit('log', 'Skipping build...');
     return Q(null);
 };
 
-GenericBuilder.prototype.clean = function() {
+GenericBuilder.prototype.clean = function () {
     return Q();
 };
 
-GenericBuilder.prototype.findOutputApks = function(build_type, arch) {
+GenericBuilder.prototype.findOutputApks = function (build_type, arch) {
     var self = this;
-    return Object.keys(this.binDirs)
-    .reduce(function (result, builderName) {
+    return Object.keys(this.binDirs).reduce(function (result, builderName) {
         var binDir = self.binDirs[builderName];
         return result.concat(findOutputApksHelper(binDir, build_type, builderName === 'ant' ? null : arch));
-    }, [])
-    .sort(apkSorter);
+    }, []).sort(apkSorter);
 };
 
 GenericBuilder.prototype.readProjectProperties = function () {
-    function findAllUniq(data, r) {
+    function findAllUniq (data, r) {
         var s = {};
         var m;
         while ((m = r.exec(data))) {
@@ -85,14 +85,14 @@ GenericBuilder.prototype.extractRealProjectNameFromManifest = function () {
         throw new CordovaError('Could not find package name in ' + manifestPath);
     }
 
-    var packageName=m[1];
+    var packageName = m[1];
     var lastDotIndex = packageName.lastIndexOf('.');
     return packageName.substring(lastDotIndex + 1);
 };
 
 module.exports = GenericBuilder;
 
-function apkSorter(fileA, fileB) {
+function apkSorter (fileA, fileB) {
     // De-prioritize unsigned builds
     var unsignedRE = /-unsigned/;
     if (unsignedRE.exec(fileA)) {
@@ -105,12 +105,11 @@ function apkSorter(fileA, fileB) {
     return timeDiff === 0 ? fileA.length - fileB.length : timeDiff;
 }
 
-function findOutputApksHelper(dir, build_type, arch) {
+function findOutputApksHelper (dir, build_type, arch) {
     var shellSilent = shell.config.silent;
     shell.config.silent = true;
 
-    var ret = shell.ls(path.join(dir, '*.apk'))
-    .filter(function(candidate) {
+    var ret = shell.ls(path.join(dir, '*.apk')).filter(function (candidate) {
         var apkName = path.basename(candidate);
         // Need to choose between release and debug .apk.
         if (build_type === 'debug') {
@@ -120,8 +119,7 @@ function findOutputApksHelper(dir, build_type, arch) {
             return /-release/.exec(apkName) && !/-unaligned/.exec(apkName);
         }
         return true;
-    })
-    .sort(apkSorter);
+    }).sort(apkSorter);
 
     shellSilent = shellSilent;
 
@@ -131,15 +129,15 @@ function findOutputApksHelper(dir, build_type, arch) {
     // Assume arch-specific build if newest apk has -x86 or -arm.
     var archSpecific = !!/-x86|-arm/.exec(path.basename(ret[0]));
     // And show only arch-specific ones (or non-arch-specific)
-    ret = ret.filter(function(p) {
-        /*jshint -W018 */
-        return !!/-x86|-arm/.exec(path.basename(p)) == archSpecific;
-        /*jshint +W018 */
+    ret = ret.filter(function (p) {
+        /* jshint -W018 */
+        return !!/-x86|-arm/.exec(path.basename(p)) === archSpecific;
+        /* jshint +W018 */
     });
 
     if (archSpecific && ret.length > 1 && arch) {
-        ret = ret.filter(function(p) {
-            return path.basename(p).indexOf('-' + arch) != -1;
+        ret = ret.filter(function (p) {
+            return path.basename(p).indexOf('-' + arch) !== -1;
         });
     }
 

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/builders/GradleBuilder.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/builders/GradleBuilder.js b/bin/templates/cordova/lib/builders/GradleBuilder.js
index 0d32d56..c006c65 100644
--- a/bin/templates/cordova/lib/builders/GradleBuilder.js
+++ b/bin/templates/cordova/lib/builders/GradleBuilder.js
@@ -42,10 +42,10 @@ function GradleBuilder (projectRoot) {
 
 util.inherits(GradleBuilder, GenericBuilder);
 
-GradleBuilder.prototype.getArgs = function(cmd, opts) {
-    if (cmd == 'release') {
+GradleBuilder.prototype.getArgs = function (cmd, opts) {
+    if (cmd === 'release') {
         cmd = 'cdvBuildRelease';
-    } else if (cmd == 'debug') {
+    } else if (cmd === 'debug') {
         cmd = 'cdvBuildDebug';
     }
     var args = [cmd, '-b', path.join(this.root, 'build.gradle')];
@@ -69,46 +69,44 @@ GradleBuilder.prototype.getArgs = function(cmd, opts) {
  * This returns a promise
  */
 
-GradleBuilder.prototype.runGradleWrapper = function(gradle_cmd) {
+GradleBuilder.prototype.runGradleWrapper = function (gradle_cmd) {
     var gradlePath = path.join(this.root, 'gradlew');
     var wrapperGradle = path.join(this.root, 'wrapper.gradle');
-    if(fs.existsSync(gradlePath)) {
-      //Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows
+    if (fs.existsSync(gradlePath)) {
+    // Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows
     } else {
-      return superspawn.spawn(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], {stdio: 'inherit'});
+        return superspawn.spawn(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], {stdio: 'inherit'});
     }
 };
 
-
 // Makes the project buildable, minus the gradle wrapper.
-GradleBuilder.prototype.prepBuildFiles = function() {
+GradleBuilder.prototype.prepBuildFiles = function () {
     // Update the version of build.gradle in each dependent library.
     var pluginBuildGradle = path.join(this.root, 'cordova', 'lib', 'plugin-build.gradle');
     var propertiesObj = this.readProjectProperties();
     var subProjects = propertiesObj.libs;
-    var checkAndCopy = function(subProject, root) {
-      var subProjectGradle = path.join(root, subProject, 'build.gradle');
-      // This is the future-proof way of checking if a file exists
-      // This must be synchronous to satisfy a Travis test
-      try {
-          fs.accessSync(subProjectGradle, fs.F_OK);
-      } catch (e) {
-          shell.cp('-f', pluginBuildGradle, subProjectGradle);
-      }
+    var checkAndCopy = function (subProject, root) {
+        var subProjectGradle = path.join(root, subProject, 'build.gradle');
+        // This is the future-proof way of checking if a file exists
+        // This must be synchronous to satisfy a Travis test
+        try {
+            fs.accessSync(subProjectGradle, fs.F_OK);
+        } catch (e) {
+            shell.cp('-f', pluginBuildGradle, subProjectGradle);
+        }
     };
     for (var i = 0; i < subProjects.length; ++i) {
         if (subProjects[i] !== 'CordovaLib') {
-          checkAndCopy(subProjects[i], this.root);
+            checkAndCopy(subProjects[i], this.root);
         }
     }
     var name = this.extractRealProjectNameFromManifest();
-    //Remove the proj.id/name- prefix from projects: https://issues.apache.org/jira/browse/CB-9149
-    var settingsGradlePaths =  subProjects.map(function(p){
-        var realDir=p.replace(/[/\\]/g, ':');
-        var libName=realDir.replace(name+'-','');
-        var str='include ":'+libName+'"\n';
-        if(realDir.indexOf(name+'-')!==-1)
-            str+='project(":'+libName+'").projectDir = new File("'+p+'")\n';
+    // Remove the proj.id/name- prefix from projects: https://issues.apache.org/jira/browse/CB-9149
+    var settingsGradlePaths = subProjects.map(function (p) {
+        var realDir = p.replace(/[/\\]/g, ':');
+        var libName = realDir.replace(name + '-', '');
+        var str = 'include ":' + libName + '"\n';
+        if (realDir.indexOf(name + '-') !== -1) { str += 'project(":' + libName + '").projectDir = new File("' + p + '")\n'; }
         return str;
     });
 
@@ -120,19 +118,18 @@ GradleBuilder.prototype.prepBuildFiles = function() {
     var buildGradle = fs.readFileSync(path.join(this.root, 'build.gradle'), 'utf8');
     var depsList = '';
     var root = this.root;
-    var insertExclude = function(p) {
-          var gradlePath = path.join(root, p, 'build.gradle');
-          var projectGradleFile = fs.readFileSync(gradlePath, 'utf-8');
-          if(projectGradleFile.indexOf('CordovaLib') != -1) {
+    var insertExclude = function (p) {
+        var gradlePath = path.join(root, p, 'build.gradle');
+        var projectGradleFile = fs.readFileSync(gradlePath, 'utf-8');
+        if (projectGradleFile.indexOf('CordovaLib') !== -1) {
             depsList += '{\n        exclude module:("CordovaLib")\n    }\n';
-          }
-          else {
-            depsList +='\n';
-          }
+        } else {
+            depsList += '\n';
+        }
     };
-    subProjects.forEach(function(p) {
+    subProjects.forEach(function (p) {
         console.log('Subproject Path: ' + p);
-        var libName=p.replace(/[/\\]/g, ':').replace(name+'-','');
+        var libName = p.replace(/[/\\]/g, ':').replace(name + '-', '');
         depsList += '    debugCompile(project(path: "' + libName + '", configuration: "debug"))';
         insertExclude(p);
         depsList += '    releaseCompile(project(path: "' + libName + '", configuration: "release"))';
@@ -143,7 +140,7 @@ GradleBuilder.prototype.prepBuildFiles = function() {
         [/^\/?extras\/android\/support\/(.*)$/, 'com.android.support:support-$1:+'],
         [/^\/?google\/google_play_services\/libproject\/google-play-services_lib\/?$/, 'com.google.android.gms:play-services:+']
     ];
-    propertiesObj.systemLibs.forEach(function(p) {
+    propertiesObj.systemLibs.forEach(function (p) {
         var mavenRef;
         // It's already in gradle form if it has two ':'s
         if (/:.*:/.exec(p)) {
@@ -164,21 +161,20 @@ GradleBuilder.prototype.prepBuildFiles = function() {
     });
     buildGradle = buildGradle.replace(/(SUB-PROJECT DEPENDENCIES START)[\s\S]*(\/\/ SUB-PROJECT DEPENDENCIES END)/, '$1\n' + depsList + '    $2');
     var includeList = '';
-    propertiesObj.gradleIncludes.forEach(function(includePath) {
+    propertiesObj.gradleIncludes.forEach(function (includePath) {
         includeList += 'apply from: "' + includePath + '"\n';
     });
     buildGradle = buildGradle.replace(/(PLUGIN GRADLE EXTENSIONS START)[\s\S]*(\/\/ PLUGIN GRADLE EXTENSIONS END)/, '$1\n' + includeList + '$2');
     fs.writeFileSync(path.join(this.root, 'build.gradle'), buildGradle);
 };
 
-GradleBuilder.prototype.prepEnv = function(opts) {
+GradleBuilder.prototype.prepEnv = function (opts) {
     var self = this;
-    return check_reqs.check_gradle()
-      .then(function(gradlePath) {
+    return check_reqs.check_gradle().then(function (gradlePath) {
         return self.runGradleWrapper(gradlePath);
-      }).then(function() {
-          return self.prepBuildFiles();
-      }).then(function() {
+    }).then(function () {
+        return self.prepBuildFiles();
+    }).then(function () {
         // We now copy the gradle out of the framework
         // This is a dirty patch to get the build working
         /*
@@ -198,12 +194,12 @@ GradleBuilder.prototype.prepEnv = function(opts) {
         // If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
         // For some reason, using ^ and $ don't work.  This does the job, though.
         var distributionUrlRegex = /distributionUrl.*zip/;
-        /*jshint -W069 */
+        /* jshint -W069 */
         var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-3.3-all.zip';
-        /*jshint +W069 */
+        /* jshint +W069 */
         var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
         shell.chmod('u+w', gradleWrapperPropertiesPath);
-        shell.sed('-i', distributionUrlRegex, 'distributionUrl='+distributionUrl, gradleWrapperPropertiesPath);
+        shell.sed('-i', distributionUrlRegex, 'distributionUrl=' + distributionUrl, gradleWrapperPropertiesPath);
 
         var propertiesFile = opts.buildType + SIGNING_PROPERTIES;
         var propertiesFilePath = path.join(self.root, propertiesFile);
@@ -219,12 +215,11 @@ GradleBuilder.prototype.prepEnv = function(opts) {
  * Builds the project with gradle.
  * Returns a promise.
  */
-GradleBuilder.prototype.build = function(opts) {
+GradleBuilder.prototype.build = function (opts) {
     var wrapper = path.join(this.root, 'gradlew');
-    var args = this.getArgs(opts.buildType == 'debug' ? 'debug' : 'release', opts);
+    var args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts);
 
-    return superspawn.spawn(wrapper, args, {stdio: 'pipe'})
-    .progress(function (stdio){
+    return superspawn.spawn(wrapper, args, {stdio: 'pipe'}).progress(function (stdio) {
         if (stdio.stderr) {
             /*
              * Workaround for the issue with Java printing some unwanted information to
@@ -243,7 +238,7 @@ GradleBuilder.prototype.build = function(opts) {
         }
     }).catch(function (error) {
         if (error.toString().indexOf('failed to find target with hash string') >= 0) {
-            return check_reqs.check_android_target(error).then(function() {
+            return check_reqs.check_android_target(error).then(function () {
                 // If due to some odd reason - check_android_target succeeds
                 // we should still fail here.
                 return Q.reject(error);
@@ -253,19 +248,18 @@ GradleBuilder.prototype.build = function(opts) {
     });
 };
 
-GradleBuilder.prototype.clean = function(opts) {
+GradleBuilder.prototype.clean = function (opts) {
     var builder = this;
     var wrapper = path.join(this.root, 'gradlew');
     var args = builder.getArgs('clean', opts);
-    return Q().then(function() {
+    return Q().then(function () {
         return superspawn.spawn(wrapper, args, {stdio: 'inherit'});
-    })
-    .then(function () {
+    }).then(function () {
         shell.rm('-rf', path.join(builder.root, 'out'));
 
-        ['debug', 'release'].forEach(function(config) {
+        ['debug', 'release'].forEach(function (config) {
             var propertiesFilePath = path.join(builder.root, config + SIGNING_PROPERTIES);
-            if(isAutoGenerated(propertiesFilePath)){
+            if (isAutoGenerated(propertiesFilePath)) {
                 shell.rm('-f', propertiesFilePath);
             }
         });
@@ -274,6 +268,6 @@ GradleBuilder.prototype.clean = function(opts) {
 
 module.exports = GradleBuilder;
 
-function isAutoGenerated(file) {
+function isAutoGenerated (file) {
     return fs.existsSync(file) && fs.readFileSync(file, 'utf8').indexOf(MARKER) > 0;
 }

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d83d49d8/bin/templates/cordova/lib/builders/builders.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/builders/builders.js b/bin/templates/cordova/lib/builders/builders.js
index 4921c49..a08a588 100644
--- a/bin/templates/cordova/lib/builders/builders.js
+++ b/bin/templates/cordova/lib/builders/builders.js
@@ -35,8 +35,7 @@ var knownBuilders = {
  * @return  {Builder}               A builder instance for specified build type.
  */
 module.exports.getBuilder = function (builderType, projectRoot) {
-    if (!knownBuilders[builderType])
-        throw new CordovaError('Builder ' + builderType + ' is not supported.');
+    if (!knownBuilders[builderType]) { throw new CordovaError('Builder ' + builderType + ' is not supported.'); }
 
     try {
         var Builder = require('./' + knownBuilders[builderType]);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message