Skip to content

Commit

Permalink
Add --skipSigning option to build command
Browse files Browse the repository at this point in the history
  • Loading branch information
jdecked committed Feb 25, 2021
1 parent 739669d commit 2322e50
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ Set `BUBBLEWRAP_KEYSTORE_PASSWORD` for the key store password and `BUBBLEWRAP_KE
Usage:

```
bubblewrap build [--skipPwaValidation]
bubblewrap build [--skipPwaValidation] [--skipSigning]
```

Options:
- `--skipPwaValidation`: skips validating the wrapped PWA against the Quality Criteria.
- `--skipSigning`: skips signing the built APK and App Bundle.


## `update`
Expand Down
25 changes: 19 additions & 6 deletions packages/cli/src/lib/cmds/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,32 @@ class Build {
}

const twaManifest = await TwaManifest.fromFile(TWA_MANIFEST_FILE_NAME);
const passwords = await this.getPasswords(twaManifest.signingKey);

let passwords = null;
if (!this.args.skipSigning) {
passwords = await this.getPasswords(twaManifest.signingKey);
}

// Builds the Android Studio Project
this.prompt.printMessage(messages.messageBuildingApp);

await this.buildApk();
await this.signApk(twaManifest.signingKey, passwords);
this.prompt.printMessage(messages.messageApkSucess(APK_SIGNED_FILE_NAME));
if (passwords) {
await this.signApk(twaManifest.signingKey, passwords);
}
const apkFileName = this.args.skipSigning ? APK_ALIGNED_FILE_NAME : APK_SIGNED_FILE_NAME;
this.prompt.printMessage(messages.messageApkSuccess(apkFileName));

await this.buildAppBundle();
await this.signAppBundle(twaManifest.signingKey, passwords);
this.prompt.printMessage(messages.messageAppBundleSuccess(APP_BUNDLE_SIGNED_FILE_NAME));
if (passwords) {
await this.signAppBundle(twaManifest.signingKey, passwords);
}
const appBundleFileName = this.args.skipSigning ? APP_BUNDLE_BUILD_OUTPUT_FILE_NAME : APP_BUNDLE_SIGNED_FILE_NAME;
this.prompt.printMessage(messages.messageAppBundleSuccess(appBundleFileName));

await this.generateAssetLinks(twaManifest, passwords);
if (passwords) {
await this.generateAssetLinks(twaManifest, passwords);
}

if (validationPromise !== null) {
const result = await validationPromise;
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/lib/cmds/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const HELP_MESSAGES = new Map<string, string>(
'',
'Options:',
'--skipPwaValidation ....... skips validating the wrapped PWA against the Quality Criteria',
'--skipSigning ............. skips signing the built APK and App Bundle',
].join('\n')],
['update', [
'Usage:',
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/lib/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Messages = {
messageInitializingWebManifest: (manifestUrl: string) => string;
messageAndroidAppDetails: string;
messageAndroidAppDetailsDesc: string;
messageApkSucess: (filename: string) => string;
messageApkSuccess: (filename: string) => string;
messageAppBundleSuccess: (filename: string) => string;
messageBuildingApp: string;
messageDigitalAssetLinksSuccess: (filename: string) => string;
Expand Down Expand Up @@ -165,7 +165,7 @@ into a device:
\t- ${bold('Status bar color:')} sets the status bar color used when the
\t application is in foreground. Example: ${cyan('#7CC0FF')}\n`,
messageApkSucess: (filename: string): string => {
messageApkSuccess: (filename: string): string => {
return `\t- Generated Android APK at ${cyan(filename)}`;
},
messageAppBundleSuccess: (filename: string): string => {
Expand Down

0 comments on commit 2322e50

Please sign in to comment.