mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
CB-10443 Fix this.root
null reference
parseOpts function referenced this.root but the this object is not the new Api as expected. This leads to an exception upon calling path.relative(this.root, ...).
This commit is contained in:
parent
233c2bd882
commit
1494082a2a
8
bin/templates/cordova/lib/build.js
vendored
8
bin/templates/cordova/lib/build.js
vendored
@ -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) {
|
||||
function parseOpts(options, resolvedTarget, projectRoot) {
|
||||
options = options || {};
|
||||
options.argv = nopt({
|
||||
gradle: Boolean,
|
||||
@ -72,7 +72,7 @@ function parseOpts(options, resolvedTarget) {
|
||||
var packageArgs = {};
|
||||
|
||||
if (options.argv.keystore)
|
||||
packageArgs.keystore = path.relative(this.root, path.resolve(options.argv.keystore));
|
||||
packageArgs.keystore = path.relative(projectRoot, path.resolve(options.argv.keystore));
|
||||
|
||||
['alias','storePassword','password','keystoreType'].forEach(function (flagName) {
|
||||
if (options.argv[flagName])
|
||||
@ -126,7 +126,7 @@ function parseOpts(options, resolvedTarget) {
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.runClean = function(options) {
|
||||
var opts = parseOpts(options);
|
||||
var opts = parseOpts(options, null, this.root);
|
||||
var builder = builders.getBuilder(opts.buildMethod);
|
||||
return builder.prepEnv(opts)
|
||||
.then(function() {
|
||||
@ -147,7 +147,7 @@ module.exports.runClean = function(options) {
|
||||
* information.
|
||||
*/
|
||||
module.exports.run = function(options, optResolvedTarget) {
|
||||
var opts = parseOpts(options, optResolvedTarget);
|
||||
var opts = parseOpts(options, optResolvedTarget, this.root);
|
||||
var builder = builders.getBuilder(opts.buildMethod);
|
||||
var self = this;
|
||||
return builder.prepEnv(opts)
|
||||
|
Loading…
Reference in New Issue
Block a user