Skip to content

Commit b083c99

Browse files
committed
fix: allow root level build command flags
1 parent a8408e1 commit b083c99

File tree

7 files changed

+207
-27
lines changed

7 files changed

+207
-27
lines changed

packages/nx/src/executors/build/build.schema.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,35 @@
3737
"type": "string",
3838
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
3939
},
40+
"provision": {
41+
"type": "string",
42+
"description": "(Apple Only) When building, use this provision profile name."
43+
},
44+
"aab": {
45+
"type": "boolean",
46+
"default": false,
47+
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
48+
},
49+
"keyStorePath": {
50+
"type": "string",
51+
"description": "(Android Only) When building, use the keystore file at this location."
52+
},
53+
"keyStorePassword": {
54+
"type": "string",
55+
"description": "(Android Only) When building, use this keystore password."
56+
},
57+
"keyStoreAlias": {
58+
"type": "string",
59+
"description": "(Android Only) When building, use this keystore alias."
60+
},
61+
"keyStoreAliasPassword": {
62+
"type": "string",
63+
"description": "(Android Only) When building, use this keystore alias password."
64+
},
65+
"copyTo": {
66+
"type": "string",
67+
"description": "When building, copy the package to this location."
68+
},
4069
"android": {
4170
"type": "object",
4271
"aab": {

packages/nx/src/executors/build/debug.schema.json

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,35 @@
3737
"type": "string",
3838
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
3939
},
40+
"provision": {
41+
"type": "string",
42+
"description": "(Apple Only) When building, use this provision profile name."
43+
},
44+
"aab": {
45+
"type": "boolean",
46+
"default": false,
47+
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
48+
},
49+
"keyStorePath": {
50+
"type": "string",
51+
"description": "(Android Only) When building, use the keystore file at this location."
52+
},
53+
"keyStorePassword": {
54+
"type": "string",
55+
"description": "(Android Only) When building, use this keystore password."
56+
},
57+
"keyStoreAlias": {
58+
"type": "string",
59+
"description": "(Android Only) When building, use this keystore alias."
60+
},
61+
"keyStoreAliasPassword": {
62+
"type": "string",
63+
"description": "(Android Only) When building, use this keystore alias password."
64+
},
65+
"copyTo": {
66+
"type": "string",
67+
"description": "When building, copy the package to this location."
68+
},
4069
"android": {
4170
"type": "object",
4271
"aab": {
@@ -163,10 +192,6 @@
163192
"default": -1,
164193
"description": "Increase the default 90s timeout to connect to a device/simulator"
165194
},
166-
"copyTo": {
167-
"type": "string",
168-
"description": "When building, copy the package to this location."
169-
},
170195
"prepare": {
171196
"type": "boolean",
172197
"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.",

packages/nx/src/executors/build/prepare.schema.json

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,35 @@
3737
"type": "string",
3838
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
3939
},
40+
"provision": {
41+
"type": "string",
42+
"description": "(Apple Only) When building, use this provision profile name."
43+
},
44+
"aab": {
45+
"type": "boolean",
46+
"default": false,
47+
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
48+
},
49+
"keyStorePath": {
50+
"type": "string",
51+
"description": "(Android Only) When building, use the keystore file at this location."
52+
},
53+
"keyStorePassword": {
54+
"type": "string",
55+
"description": "(Android Only) When building, use this keystore password."
56+
},
57+
"keyStoreAlias": {
58+
"type": "string",
59+
"description": "(Android Only) When building, use this keystore alias."
60+
},
61+
"keyStoreAliasPassword": {
62+
"type": "string",
63+
"description": "(Android Only) When building, use this keystore alias password."
64+
},
65+
"copyTo": {
66+
"type": "string",
67+
"description": "When building, copy the package to this location."
68+
},
4069
"android": {
4170
"type": "object",
4271
"aab": {
@@ -162,10 +191,6 @@
162191
"default": -1,
163192
"description": "Increase the default 90s timeout to connect to a device/simulator"
164193
},
165-
"copyTo": {
166-
"type": "string",
167-
"description": "When building, copy the package to this location."
168-
},
169194
"prepare": {
170195
"type": "boolean",
171196
"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.",

packages/nx/src/executors/build/run.schema.json

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,35 @@
3737
"type": "string",
3838
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
3939
},
40+
"provision": {
41+
"type": "string",
42+
"description": "(Apple Only) When building, use this provision profile name."
43+
},
44+
"aab": {
45+
"type": "boolean",
46+
"default": false,
47+
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
48+
},
49+
"keyStorePath": {
50+
"type": "string",
51+
"description": "(Android Only) When building, use the keystore file at this location."
52+
},
53+
"keyStorePassword": {
54+
"type": "string",
55+
"description": "(Android Only) When building, use this keystore password."
56+
},
57+
"keyStoreAlias": {
58+
"type": "string",
59+
"description": "(Android Only) When building, use this keystore alias."
60+
},
61+
"keyStoreAliasPassword": {
62+
"type": "string",
63+
"description": "(Android Only) When building, use this keystore alias password."
64+
},
65+
"copyTo": {
66+
"type": "string",
67+
"description": "When building, copy the package to this location."
68+
},
4069
"android": {
4170
"type": "object",
4271
"aab": {
@@ -162,10 +191,6 @@
162191
"default": -1,
163192
"description": "Increase the default 90s timeout to connect to a device/simulator"
164193
},
165-
"copyTo": {
166-
"type": "string",
167-
"description": "When building, copy the package to this location."
168-
},
169194
"prepare": {
170195
"type": "boolean",
171196
"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.",

packages/nx/src/executors/build/test.schema.json

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,35 @@
3737
"type": "string",
3838
"description": "Used with targets to share build configurations and avoid duplicating configurations across multiple targets."
3939
},
40+
"provision": {
41+
"type": "string",
42+
"description": "(Apple Only) When building, use this provision profile name."
43+
},
44+
"aab": {
45+
"type": "boolean",
46+
"default": false,
47+
"description": "(Android Only) When building, create an Android App Bundle (.aab file)."
48+
},
49+
"keyStorePath": {
50+
"type": "string",
51+
"description": "(Android Only) When building, use the keystore file at this location."
52+
},
53+
"keyStorePassword": {
54+
"type": "string",
55+
"description": "(Android Only) When building, use this keystore password."
56+
},
57+
"keyStoreAlias": {
58+
"type": "string",
59+
"description": "(Android Only) When building, use this keystore alias."
60+
},
61+
"keyStoreAliasPassword": {
62+
"type": "string",
63+
"description": "(Android Only) When building, use this keystore alias password."
64+
},
65+
"copyTo": {
66+
"type": "string",
67+
"description": "When building, copy the package to this location."
68+
},
4069
"android": {
4170
"type": "object",
4271
"aab": {
@@ -162,10 +191,6 @@
162191
"default": -1,
163192
"description": "Increase the default 90s timeout to connect to a device/simulator"
164193
},
165-
"copyTo": {
166-
"type": "string",
167-
"description": "When building, copy the package to this location."
168-
},
169194
"prepare": {
170195
"type": "boolean",
171196
"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.",

packages/nx/src/schemas/base.schema.ts

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ export interface BaseSchema {
1010
platform: Platform;
1111
silent: boolean;
1212
verbose: boolean;
13+
provision: string;
14+
aab: boolean;
15+
keyStorePath: string;
16+
keyStorePassword: string;
17+
keyStoreAlias: string;
18+
keyStoreAliasPassword: string;
19+
copyTo: string;
1320
}
1421

1522
export const baseSchema = {
@@ -30,7 +37,8 @@ export const baseSchema = {
3037
force: {
3138
type: 'boolean',
3239
default: true,
33-
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.',
40+
description:
41+
'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.',
3442
},
3543
silent: {
3644
type: 'boolean',
@@ -51,5 +59,34 @@ export const baseSchema = {
5159
type: 'string',
5260
description: 'Used with targets to share build configurations and avoid duplicating configurations across multiple targets.',
5361
},
62+
provision: {
63+
type: 'string',
64+
description: '(Apple Only) When building, use this provision profile name.',
65+
},
66+
aab: {
67+
type: 'boolean',
68+
default: false,
69+
description: '(Android Only) When building, create an Android App Bundle (.aab file).',
70+
},
71+
keyStorePath: {
72+
type: 'string',
73+
description: '(Android Only) When building, use the keystore file at this location.',
74+
},
75+
keyStorePassword: {
76+
type: 'string',
77+
description: '(Android Only) When building, use this keystore password.',
78+
},
79+
keyStoreAlias: {
80+
type: 'string',
81+
description: '(Android Only) When building, use this keystore alias.',
82+
},
83+
keyStoreAliasPassword: {
84+
type: 'string',
85+
description: '(Android Only) When building, use this keystore alias password.',
86+
},
87+
copyTo: {
88+
type: 'string',
89+
description: 'When building, copy the package to this location.',
90+
},
5491
},
55-
};
92+
};

packages/nx/src/utils/executors.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function commonExecutor(options: ExecutorSchema, context: ExecutorContext
4040
}
4141

4242
if (!isClean) {
43-
options.platform = isAndroid ? 'android' : (isIos ? 'ios' : 'visionos');
43+
options.platform = isAndroid ? 'android' : isIos ? 'ios' : 'visionos';
4444
}
4545

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

127-
if (options.platform === 'android' && options.android) {
128-
options.android.aab && nsOptions.push('--aab');
129-
options.android.keyStorePath && nsOptions.push(`--key-store-path=${options.android.keyStorePath}`);
130-
options.android.keyStorePassword && nsOptions.push(`--key-store-password=${options.android.keyStorePassword}`);
131-
options.android.keyStoreAlias && nsOptions.push(`--key-store-alias=${options.android.keyStoreAlias}`);
132-
options.android.keyStoreAliasPassword && nsOptions.push(`--key-store-alias-password=${options.android.keyStoreAliasPassword}`);
127+
if (options.platform === 'android') {
128+
if (options.android?.aab || options.aab) {
129+
nsOptions.push('--aab');
130+
}
131+
if (options.android?.keyStorePath || options.keyStorePath) {
132+
nsOptions.push(`--key-store-path=${options.android?.keyStorePath || options.keyStorePath}`);
133+
}
134+
if (options.android?.keyStorePassword || options.keyStorePassword) {
135+
nsOptions.push(`--key-store-password=${options.android?.keyStorePassword || options.keyStorePassword}`);
136+
}
137+
if (options.android?.keyStoreAlias || options.keyStoreAlias) {
138+
nsOptions.push(`--key-store-alias=${options.android?.keyStoreAlias || options.keyStoreAlias}`);
139+
}
140+
if (options.android?.keyStoreAliasPassword || options.keyStoreAliasPassword) {
141+
nsOptions.push(`--key-store-alias-password=${options.android?.keyStoreAliasPassword || options.keyStoreAliasPassword}`);
142+
}
133143
}
134144

135-
if (options.platform === 'ios' && options.ios) {
136-
options.ios.provision && nsOptions.push(`--provision=${options.ios.provision}`);
145+
if (options.platform === 'ios') {
146+
if (options.ios?.provision) {
147+
nsOptions.push(`--provision=${options.ios.provision}`);
148+
} else if (options.provision) {
149+
nsOptions.push(`--provision=${options.provision}`);
150+
}
137151
}
138152

139153
// Append common options

0 commit comments

Comments
 (0)