mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 17:10:15 +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 spawn = require('cordova-common').superspawn.spawn;
|
||||||
var CordovaError = require('cordova-common').CordovaError;
|
var CordovaError = require('cordova-common').CordovaError;
|
||||||
|
|
||||||
function parseOpts(options, resolvedTarget) {
|
function parseOpts(options, resolvedTarget, projectRoot) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
options.argv = nopt({
|
options.argv = nopt({
|
||||||
gradle: Boolean,
|
gradle: Boolean,
|
||||||
@ -72,7 +72,7 @@ function parseOpts(options, resolvedTarget) {
|
|||||||
var packageArgs = {};
|
var packageArgs = {};
|
||||||
|
|
||||||
if (options.argv.keystore)
|
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) {
|
['alias','storePassword','password','keystoreType'].forEach(function (flagName) {
|
||||||
if (options.argv[flagName])
|
if (options.argv[flagName])
|
||||||
@ -126,7 +126,7 @@ function parseOpts(options, resolvedTarget) {
|
|||||||
* Returns a promise.
|
* Returns a promise.
|
||||||
*/
|
*/
|
||||||
module.exports.runClean = function(options) {
|
module.exports.runClean = function(options) {
|
||||||
var opts = parseOpts(options);
|
var opts = parseOpts(options, null, this.root);
|
||||||
var builder = builders.getBuilder(opts.buildMethod);
|
var builder = builders.getBuilder(opts.buildMethod);
|
||||||
return builder.prepEnv(opts)
|
return builder.prepEnv(opts)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
@ -147,7 +147,7 @@ module.exports.runClean = function(options) {
|
|||||||
* information.
|
* information.
|
||||||
*/
|
*/
|
||||||
module.exports.run = function(options, optResolvedTarget) {
|
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 builder = builders.getBuilder(opts.buildMethod);
|
||||||
var self = this;
|
var self = this;
|
||||||
return builder.prepEnv(opts)
|
return builder.prepEnv(opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user