mirror of
https://github.com/apache/cordova-android.git
synced 2026-05-11 00:00:05 +08:00
feat: Build app bundles (.aab files) (#764)
* (android) Added android bundle support with some corrected tests added bundle specific output * with --packageType flag to have consistency with cordova-ios * warn about missing required signing params only if at least one signing param is present * produce error on run if packageType = bundle * added comments relating to shelljs as suggested * unit test case added by @brodybits - Chris Brody * Filled in error message and unit test spec Primary author: @breautek - Norman Breau <norman@normanbreau.com> Co-authored-by: Norman Breau <norman@normanbreau.com> Co-authored-by: Chris Brody <chris@brody.consulting>
This commit is contained in:
committed by
Chris Brody
parent
b3b8690bbd
commit
bd1697dbd2
@@ -66,6 +66,34 @@ describe('ProjectBuilder', () => {
|
||||
expect(args[0]).toBe('cdvBuildDebug');
|
||||
});
|
||||
|
||||
it('should set apk release', () => {
|
||||
const args = builder.getArgs('release', {
|
||||
packageType: 'apk'
|
||||
});
|
||||
expect(args[0]).withContext(args).toBe('cdvBuildRelease');
|
||||
});
|
||||
|
||||
it('should set apk debug', () => {
|
||||
const args = builder.getArgs('debug', {
|
||||
packageType: 'apk'
|
||||
});
|
||||
expect(args[0]).withContext(args).toBe('cdvBuildDebug');
|
||||
});
|
||||
|
||||
it('should set bundle release', () => {
|
||||
const args = builder.getArgs('release', {
|
||||
packageType: 'bundle'
|
||||
});
|
||||
expect(args[0]).withContext(args).toBe(':app:bundleRelease');
|
||||
});
|
||||
|
||||
it('should set bundle debug', () => {
|
||||
const args = builder.getArgs('debug', {
|
||||
packageType: 'bundle'
|
||||
});
|
||||
expect(args[0]).withContext(args).toBe(':app:bundleDebug');
|
||||
});
|
||||
|
||||
it('should add architecture if it is passed', () => {
|
||||
const arch = 'unittest';
|
||||
const args = builder.getArgs('debug', { arch });
|
||||
|
||||
@@ -196,6 +196,18 @@ describe('run', () => {
|
||||
expect(emulatorSpyObj.install).toHaveBeenCalledWith(emulatorTarget, { apkPaths: [], buildType: 'debug' });
|
||||
});
|
||||
});
|
||||
|
||||
it('should fail with the error message if --packageType=bundle setting is used', () => {
|
||||
const deviceList = ['testDevice1', 'testDevice2'];
|
||||
getInstallTargetSpy.and.returnValue(null);
|
||||
|
||||
deviceSpyObj.list.and.returnValue(Promise.resolve(deviceList));
|
||||
|
||||
return run.run({ argv: ['--packageType=bundle'] }).then(
|
||||
() => fail('Expected error to be thrown'),
|
||||
err => expect(err).toContain('Package type "bundle" is not supported during cordova run.')
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('help', () => {
|
||||
|
||||
Reference in New Issue
Block a user