forked from github/cordova-android
Clean also wipes out the www directory, which was causing the strange errors that were happening when building
This commit is contained in:
parent
4be413af79
commit
b5246f3f09
25
bin/templates/cordova/Api.js
vendored
25
bin/templates/cordova/Api.js
vendored
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
var nopt = require('nopt');
|
||||||
var Q = require('q');
|
var Q = require('q');
|
||||||
|
|
||||||
var AndroidProject = require('./lib/AndroidProject');
|
var AndroidProject = require('./lib/AndroidProject');
|
||||||
@ -29,6 +30,7 @@ var selfEvents = require('cordova-common').events;
|
|||||||
|
|
||||||
var PLATFORM = 'android';
|
var PLATFORM = 'android';
|
||||||
|
|
||||||
|
|
||||||
function setupEvents(externalEventEmitter) {
|
function setupEvents(externalEventEmitter) {
|
||||||
if (externalEventEmitter) {
|
if (externalEventEmitter) {
|
||||||
// This will make the platform internal events visible outside
|
// This will make the platform internal events visible outside
|
||||||
@ -215,23 +217,33 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Q()
|
return Q()
|
||||||
.then(function () {
|
.then(function () {
|
||||||
//CB-11964: Do a clean when installing the plugin code to get around
|
//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
|
//the Gradle bug introduced by the Android Gradle Plugin Version 2.2
|
||||||
//TODO: Delete when the next version of Android Gradle plugin comes out
|
//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)
|
return PluginManager.get(self.platform, self.locations, project)
|
||||||
.addPlugin(plugin, installOptions);
|
.addPlugin(plugin, installOptions);
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
if (plugin.getFrameworks(this.platform).length === 0) return;
|
if (plugin.getFrameworks(this.platform).length === 0) return;
|
||||||
|
|
||||||
selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');
|
selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');
|
||||||
require('./lib/builders/builders').getBuilder('gradle').prepBuildFiles();
|
require('./lib/builders/builders').getBuilder('gradle').prepBuildFiles();
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
// CB-11022 Return truthy value to prevent running prepare after
|
// CB-11022 Return truthy value to prevent running prepare after
|
||||||
.thenResolve(true);
|
.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
|
* @return {Promise} Return a promise either fulfilled, or rejected with
|
||||||
* CordovaError.
|
* CordovaError.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user