Skip to content

Commit

Permalink
fix: allow root level build command flags
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanWalker committed Nov 8, 2024
1 parent a8408e1 commit b083c99
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 27 deletions.
29 changes: 29 additions & 0 deletions packages/nx/src/executors/build/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@
"type": "string",
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
},
"provision": {
"type": "string",
"description": "(Apple Only) When building, use this provision profile name."
},
"aab": {
"type": "boolean",
"default": false,
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
},
"keyStorePath": {
"type": "string",
"description": "(Android Only) When building, use the keystore file at this location."
},
"keyStorePassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore password."
},
"keyStoreAlias": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias."
},
"keyStoreAliasPassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias password."
},
"copyTo": {
"type": "string",
"description": "When building, copy the package to this location."
},
"android": {
"type": "object",
"aab": {
Expand Down
33 changes: 29 additions & 4 deletions packages/nx/src/executors/build/debug.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@
"type": "string",
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
},
"provision": {
"type": "string",
"description": "(Apple Only) When building, use this provision profile name."
},
"aab": {
"type": "boolean",
"default": false,
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
},
"keyStorePath": {
"type": "string",
"description": "(Android Only) When building, use the keystore file at this location."
},
"keyStorePassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore password."
},
"keyStoreAlias": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias."
},
"keyStoreAliasPassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias password."
},
"copyTo": {
"type": "string",
"description": "When building, copy the package to this location."
},
"android": {
"type": "object",
"aab": {
Expand Down Expand Up @@ -163,10 +192,6 @@
"default": -1,
"description": "Increase the default 90s timeout to connect to a device/simulator"
},
"copyTo": {
"type": "string",
"description": "When building, copy the package to this location."
},
"prepare": {
"type": "boolean",
"description": "Starts a Webpack compilation and prepares the app's App_Resources and the plugins platforms directories. The output is generated in a subdirectory for the selected target platform in the platforms directory. This lets you build the project for the selected platform.",
Expand Down
33 changes: 29 additions & 4 deletions packages/nx/src/executors/build/prepare.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@
"type": "string",
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
},
"provision": {
"type": "string",
"description": "(Apple Only) When building, use this provision profile name."
},
"aab": {
"type": "boolean",
"default": false,
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
},
"keyStorePath": {
"type": "string",
"description": "(Android Only) When building, use the keystore file at this location."
},
"keyStorePassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore password."
},
"keyStoreAlias": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias."
},
"keyStoreAliasPassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias password."
},
"copyTo": {
"type": "string",
"description": "When building, copy the package to this location."
},
"android": {
"type": "object",
"aab": {
Expand Down Expand Up @@ -162,10 +191,6 @@
"default": -1,
"description": "Increase the default 90s timeout to connect to a device/simulator"
},
"copyTo": {
"type": "string",
"description": "When building, copy the package to this location."
},
"prepare": {
"type": "boolean",
"description": "Starts a Webpack compilation and prepares the app's App_Resources and the plugins platforms directories. The output is generated in a subdirectory for the selected target platform in the platforms directory. This lets you build the project for the selected platform.",
Expand Down
33 changes: 29 additions & 4 deletions packages/nx/src/executors/build/run.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@
"type": "string",
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
},
"provision": {
"type": "string",
"description": "(Apple Only) When building, use this provision profile name."
},
"aab": {
"type": "boolean",
"default": false,
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
},
"keyStorePath": {
"type": "string",
"description": "(Android Only) When building, use the keystore file at this location."
},
"keyStorePassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore password."
},
"keyStoreAlias": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias."
},
"keyStoreAliasPassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias password."
},
"copyTo": {
"type": "string",
"description": "When building, copy the package to this location."
},
"android": {
"type": "object",
"aab": {
Expand Down Expand Up @@ -162,10 +191,6 @@
"default": -1,
"description": "Increase the default 90s timeout to connect to a device/simulator"
},
"copyTo": {
"type": "string",
"description": "When building, copy the package to this location."
},
"prepare": {
"type": "boolean",
"description": "Starts a Webpack compilation and prepares the app's App_Resources and the plugins platforms directories. The output is generated in a subdirectory for the selected target platform in the platforms directory. This lets you build the project for the selected platform.",
Expand Down
33 changes: 29 additions & 4 deletions packages/nx/src/executors/build/test.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@
"type": "string",
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
},
"provision": {
"type": "string",
"description": "(Apple Only) When building, use this provision profile name."
},
"aab": {
"type": "boolean",
"default": false,
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
},
"keyStorePath": {
"type": "string",
"description": "(Android Only) When building, use the keystore file at this location."
},
"keyStorePassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore password."
},
"keyStoreAlias": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias."
},
"keyStoreAliasPassword": {
"type": "string",
"description": "(Android Only) When building, use this keystore alias password."
},
"copyTo": {
"type": "string",
"description": "When building, copy the package to this location."
},
"android": {
"type": "object",
"aab": {
Expand Down Expand Up @@ -162,10 +191,6 @@
"default": -1,
"description": "Increase the default 90s timeout to connect to a device/simulator"
},
"copyTo": {
"type": "string",
"description": "When building, copy the package to this location."
},
"prepare": {
"type": "boolean",
"description": "Starts a Webpack compilation and prepares the app's App_Resources and the plugins platforms directories. The output is generated in a subdirectory for the selected target platform in the platforms directory. This lets you build the project for the selected platform.",
Expand Down
41 changes: 39 additions & 2 deletions packages/nx/src/schemas/base.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ export interface BaseSchema {
platform: Platform;
silent: boolean;
verbose: boolean;
provision: string;
aab: boolean;
keyStorePath: string;
keyStorePassword: string;
keyStoreAlias: string;
keyStoreAliasPassword: string;
copyTo: string;
}

export const baseSchema = {
Expand All @@ -30,7 +37,8 @@ export const baseSchema = {
force: {
type: 'boolean',
default: true,
description: 'If true, skips the application compatibility checks and forces npm i to ensure all dependencies are installed. Otherwise, the command will check the application compatibility with the current CLI version and could fail requiring ns migrate.',
description:
'If true, skips the application compatibility checks and forces npm i to ensure all dependencies are installed. Otherwise, the command will check the application compatibility with the current CLI version and could fail requiring ns migrate.',
},
silent: {
type: 'boolean',
Expand All @@ -51,5 +59,34 @@ export const baseSchema = {
type: 'string',
description: 'Used with targets to share build configurations and avoid duplicating configurations across multiple targets.',
},
provision: {
type: 'string',
description: '(Apple Only) When building, use this provision profile name.',
},
aab: {
type: 'boolean',
default: false,
description: '(Android Only) When building, create an Android App Bundle (.aab file).',
},
keyStorePath: {
type: 'string',
description: '(Android Only) When building, use the keystore file at this location.',
},
keyStorePassword: {
type: 'string',
description: '(Android Only) When building, use this keystore password.',
},
keyStoreAlias: {
type: 'string',
description: '(Android Only) When building, use this keystore alias.',
},
keyStoreAliasPassword: {
type: 'string',
description: '(Android Only) When building, use this keystore alias password.',
},
copyTo: {
type: 'string',
description: 'When building, copy the package to this location.',
},
},
};
};
32 changes: 23 additions & 9 deletions packages/nx/src/utils/executors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function commonExecutor(options: ExecutorSchema, context: ExecutorContext
}

if (!isClean) {
options.platform = isAndroid ? 'android' : (isIos ? 'ios' : 'visionos');
options.platform = isAndroid ? 'android' : isIos ? 'ios' : 'visionos';
}

const projectConfig = context.projectsConfigurations.projects[context.projectName];
Expand Down Expand Up @@ -124,16 +124,30 @@ export function commonExecutor(options: ExecutorSchema, context: ExecutorContext
// early exit for `ns clean`
if (options.command === COMMANDS.CLEAN) return nsOptions;

if (options.platform === 'android' && options.android) {
options.android.aab && nsOptions.push('--aab');
options.android.keyStorePath && nsOptions.push(`--key-store-path=${options.android.keyStorePath}`);
options.android.keyStorePassword && nsOptions.push(`--key-store-password=${options.android.keyStorePassword}`);
options.android.keyStoreAlias && nsOptions.push(`--key-store-alias=${options.android.keyStoreAlias}`);
options.android.keyStoreAliasPassword && nsOptions.push(`--key-store-alias-password=${options.android.keyStoreAliasPassword}`);
if (options.platform === 'android') {
if (options.android?.aab || options.aab) {
nsOptions.push('--aab');
}
if (options.android?.keyStorePath || options.keyStorePath) {
nsOptions.push(`--key-store-path=${options.android?.keyStorePath || options.keyStorePath}`);
}
if (options.android?.keyStorePassword || options.keyStorePassword) {
nsOptions.push(`--key-store-password=${options.android?.keyStorePassword || options.keyStorePassword}`);
}
if (options.android?.keyStoreAlias || options.keyStoreAlias) {
nsOptions.push(`--key-store-alias=${options.android?.keyStoreAlias || options.keyStoreAlias}`);
}
if (options.android?.keyStoreAliasPassword || options.keyStoreAliasPassword) {
nsOptions.push(`--key-store-alias-password=${options.android?.keyStoreAliasPassword || options.keyStoreAliasPassword}`);
}
}

if (options.platform === 'ios' && options.ios) {
options.ios.provision && nsOptions.push(`--provision=${options.ios.provision}`);
if (options.platform === 'ios') {
if (options.ios?.provision) {
nsOptions.push(`--provision=${options.ios.provision}`);
} else if (options.provision) {
nsOptions.push(`--provision=${options.provision}`);
}
}

// Append common options
Expand Down

0 comments on commit b083c99

Please sign in to comment.