Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions scripts/android-api/build-android-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ function generateWithGradle(outputFile /*: string */) /*: number */ {
REPO_ROOT,
process.platform === 'win32' ? 'gradlew.bat' : 'gradlew',
);
// cmd.exe runs gradlew.bat and splits unquoted arguments on spaces.
const quote = (arg /*: string */) =>
process.platform === 'win32' ? `"${arg}"` : arg;
const {status, error} = spawnSync(
quote(gradlew),
[
':packages:react-native:ReactAndroid:publicApiDump',
quote(`-PpublicApiDumpFile=${outputFile}`),
],
{cwd: REPO_ROOT, stdio: 'inherit', shell: process.platform === 'win32'},
);
const task = ':packages:react-native:ReactAndroid:publicApiDump';
const property = `-PpublicApiDumpFile=${outputFile}`;
const options = {cwd: REPO_ROOT, stdio: 'inherit'};
// gradlew.bat only runs through cmd.exe, which takes one command line.
const {status, error} =
process.platform === 'win32'
? spawnSync(`"${gradlew}" ${task} "${property}"`, {
...options,
shell: true,
})
: spawnSync(gradlew, [task, property], options);
if (error != null) {
console.error(`Failed to run ${gradlew}: ${error.message}`);
return 1;
Expand Down Expand Up @@ -283,6 +283,8 @@ function reportDifference(
const {error} = spawnSync(
'git',
[
'-c',
'core.autocrlf=false',
'--no-pager',
'diff',
'--no-index',
Expand Down
Loading