You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2016/10/08 01:14:46 UTC

[5/6] android commit: Clean also wipes out the www directory, which was causing the strange errors that were happening when building

Clean also wipes out the www directory, which was causing the strange errors that were happening when building


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

Branch: refs/heads/master
Commit: b5246f3f09bde9e8cebcbb494950edfad4c8bb35
Parents: 4be413a
Author: Joe Bowser <bo...@apache.org>
Authored: Fri Oct 7 14:49:02 2016 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Fri Oct 7 18:14:36 2016 -0700

----------------------------------------------------------------------
 bin/templates/cordova/Api.js | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b5246f3f/bin/templates/cordova/Api.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/Api.js b/bin/templates/cordova/Api.js
index af21b22..64d933c 100644
--- a/bin/templates/cordova/Api.js
+++ b/bin/templates/cordova/Api.js
@@ -18,6 +18,7 @@
 */
 
 var path = require('path');
+var nopt = require('nopt');
 var Q = require('q');
 
 var AndroidProject = require('./lib/AndroidProject');
@@ -29,6 +30,7 @@ var selfEvents = require('cordova-common').events;
 
 var PLATFORM = 'android';
 
+
 function setupEvents(externalEventEmitter) {
     if (externalEventEmitter) {
         // This will make the platform internal events visible outside
@@ -215,23 +217,33 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
     }
 
     return Q()
-        .then(function () {
+       .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
-            return self.clean();
+
+           // 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;
+
+            return self.clean(opts);
         })
-        .then(function () {
+       .then(function () {
             return PluginManager.get(self.platform, self.locations, project)
                 .addPlugin(plugin, installOptions);
         })
-        .then(function () {
+      .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
+       // CB-11022 Return truthy value to prevent running prepare after
         .thenResolve(true);
 };
 
@@ -353,7 +365,8 @@ Api.prototype.run = function(runOptions) {
 };
 
 /**
- * Cleans out the build artifacts from platform's directory.
+ * Cleans out the build artifacts from platform's directory, and also
+ * cleans out the platform www directory if called without options specified.
  *
  * @return  {Promise}  Return a promise either fulfilled, or rejected with
  *   CordovaError.


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