From c93f93f63730e7b838aae274fcbe757bfe69f1cd Mon Sep 17 00:00:00 2001 From: Norman Breau Date: Wed, 1 Apr 2020 01:59:39 -0300 Subject: [PATCH] fix: GH-873 App bundle builds to obey command-line arguments (#941) --- .../cordova/lib/builders/ProjectBuilder.js | 4 ++-- spec/unit/builders/ProjectBuilder.spec.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/bin/templates/cordova/lib/builders/ProjectBuilder.js b/bin/templates/cordova/lib/builders/ProjectBuilder.js index 9bf95ca0..1fcbd63f 100644 --- a/bin/templates/cordova/lib/builders/ProjectBuilder.js +++ b/bin/templates/cordova/lib/builders/ProjectBuilder.js @@ -141,10 +141,10 @@ class ProjectBuilder { if (opts.arch) { args.push('-PcdvBuildArch=' + opts.arch); } - - args.push.apply(args, opts.extraArgs); } + args.push.apply(args, opts.extraArgs); + return args; } diff --git a/spec/unit/builders/ProjectBuilder.spec.js b/spec/unit/builders/ProjectBuilder.spec.js index 5050c9a3..2b9a0b18 100644 --- a/spec/unit/builders/ProjectBuilder.spec.js +++ b/spec/unit/builders/ProjectBuilder.spec.js @@ -113,6 +113,23 @@ describe('ProjectBuilder', () => { }); expect(args[0]).toBe('clean'); }); + + describe('should accept extra arguments', () => { + it('apk', () => { + const args = builder.getArgs('debug', { + extraArgs: ['-PcdvVersionCode=12344'] + }); + expect(args).toContain('-PcdvVersionCode=12344'); + }); + + it('bundle', () => { + const args = builder.getArgs('debug', { + packageType: 'bundle', + extraArgs: ['-PcdvVersionCode=12344'] + }); + expect(args).toContain('-PcdvVersionCode=12344'); + }); + }); }); describe('runGradleWrapper', () => {