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', () => {