feat(react-native): debug option for build-android (#8702)
* feat(react-native): debug option for build-android * docs(react-native): debug option
This commit is contained in:
parent
0182df4b9f
commit
e942a85b1c
@ -16,3 +16,9 @@ Options can be configured in `workspace.json` when defining the executor, or whe
|
|||||||
Type: `boolean`
|
Type: `boolean`
|
||||||
|
|
||||||
Generate apk file(s) rather than a bundle (.aab).
|
Generate apk file(s) rather than a bundle (.aab).
|
||||||
|
|
||||||
|
### debug
|
||||||
|
|
||||||
|
Type: `boolean`
|
||||||
|
|
||||||
|
Generate a debug build instead of a release build
|
||||||
|
|||||||
@ -35,9 +35,11 @@ function runCliBuild(
|
|||||||
options: ReactNativeBuildOptions
|
options: ReactNativeBuildOptions
|
||||||
) {
|
) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
const gradleCommand = getGradleCommand(options);
|
||||||
|
|
||||||
childProcess = spawn(
|
childProcess = spawn(
|
||||||
process.platform === 'win32' ? 'gradlew.bat' : './gradlew',
|
process.platform === 'win32' ? 'gradlew.bat' : './gradlew',
|
||||||
[options.apk ? 'assembleRelease' : 'bundleRelease'],
|
[gradleCommand],
|
||||||
{
|
{
|
||||||
cwd: join(workspaceRoot, projectRoot, 'android'),
|
cwd: join(workspaceRoot, projectRoot, 'android'),
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
@ -60,3 +62,19 @@ function runCliBuild(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getGradleCommand(options: ReactNativeBuildOptions) {
|
||||||
|
if (options.apk && options.debug) {
|
||||||
|
return 'assembleDebug';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.apk) {
|
||||||
|
return 'assembleRelease';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.debug) {
|
||||||
|
return 'bundleDebug';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'bundleRelease';
|
||||||
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
export interface ReactNativeBuildOptions {
|
export interface ReactNativeBuildOptions {
|
||||||
apk?: boolean;
|
apk?: boolean;
|
||||||
|
debug?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,10 @@
|
|||||||
"apk": {
|
"apk": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Generate apk file(s) rather than a bundle (.aab)."
|
"description": "Generate apk file(s) rather than a bundle (.aab)."
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Generate a debug build instead of a release build"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": []
|
"required": []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user