Skip to content

Commit e942a85

Browse files
authored
feat(react-native): debug option for build-android (#8702)
* feat(react-native): debug option for build-android * docs(react-native): debug option
1 parent 0182df4 commit e942a85

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

docs/generated/api-react-native/executors/build-android.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ Options can be configured in `workspace.json` when defining the executor, or whe
1616
Type: `boolean`
1717

1818
Generate apk file(s) rather than a bundle (.aab).
19+
20+
### debug
21+
22+
Type: `boolean`
23+
24+
Generate a debug build instead of a release build

packages/react-native/src/executors/build-android/build-android.impl.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ function runCliBuild(
3535
options: ReactNativeBuildOptions
3636
) {
3737
return new Promise((resolve, reject) => {
38+
const gradleCommand = getGradleCommand(options);
39+
3840
childProcess = spawn(
3941
process.platform === 'win32' ? 'gradlew.bat' : './gradlew',
40-
[options.apk ? 'assembleRelease' : 'bundleRelease'],
42+
[gradleCommand],
4143
{
4244
cwd: join(workspaceRoot, projectRoot, 'android'),
4345
stdio: [0, 1, 2],
@@ -60,3 +62,19 @@ function runCliBuild(
6062
});
6163
});
6264
}
65+
66+
function getGradleCommand(options: ReactNativeBuildOptions) {
67+
if (options.apk && options.debug) {
68+
return 'assembleDebug';
69+
}
70+
71+
if (options.apk) {
72+
return 'assembleRelease';
73+
}
74+
75+
if (options.debug) {
76+
return 'bundleDebug';
77+
}
78+
79+
return 'bundleRelease';
80+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export interface ReactNativeBuildOptions {
22
apk?: boolean;
3+
debug?: boolean;
34
}

packages/react-native/src/executors/build-android/schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
"apk": {
1010
"type": "boolean",
1111
"description": "Generate apk file(s) rather than a bundle (.aab)."
12+
},
13+
"debug": {
14+
"type": "boolean",
15+
"description": "Generate a debug build instead of a release build"
1216
}
1317
},
1418
"required": []

0 commit comments

Comments
 (0)