-
Notifications
You must be signed in to change notification settings - Fork 25k
[scripts] Update generate-artifacts-executor script to account for optional output path
#54609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ function generateReactCodegenPodspec( | |
| appPath /*: string */, | ||
| appPkgJson /*: $FlowFixMe */, | ||
| outputPath /*: string */, | ||
| baseOutputPath /*: string */, | ||
| baseOutputPath /*: ?string */, | ||
| ) { | ||
| const inputFiles = getInputFiles(appPath, appPkgJson); | ||
| const codegenScript = codegenScripts(appPath, baseOutputPath); | ||
|
|
@@ -76,14 +76,24 @@ function getInputFiles(appPath /*: string */, appPkgJson /*: $FlowFixMe */) { | |
| return `[${list}]`; | ||
| } | ||
|
|
||
| function codegenScripts(appPath /*: string */, outputPath /*: string */) { | ||
| const relativeAppPath = path.relative(outputPath, appPath); | ||
| function codegenScripts( | ||
| appPath /*: string */, | ||
| outputPath /*: ?string */, | ||
| ) { | ||
| const relativeAppPath = | ||
| outputPath != null && outputPath.length > 0 | ||
| ? path.relative(outputPath, appPath) | ||
| : ''; | ||
| const relativeReactNativeRootFolder = | ||
| outputPath != null && outputPath.length > 0 | ||
| ? path.relative(outputPath, REACT_NATIVE_PACKAGE_ROOT_FOLDER) | ||
| : ''; | ||
|
Comment on lines
+87
to
+90
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if |
||
| return `<<-SCRIPT | ||
| pushd "$PODS_ROOT/../" > /dev/null | ||
| RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd) | ||
| popd >/dev/null | ||
|
|
||
| export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/${path.relative(outputPath, REACT_NATIVE_PACKAGE_ROOT_FOLDER)}" | ||
| export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/${relativeReactNativeRootFolder}" | ||
| export RCT_SCRIPT_APP_PATH="$RCT_SCRIPT_POD_INSTALLATION_ROOT/${relativeAppPath.length === 0 ? '.' : relativeAppPath}" | ||
| export RCT_SCRIPT_OUTPUT_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT" | ||
| export RCT_SCRIPT_TYPE="withCodegenDiscovery" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ const path = require('path'); | |
| function execute( | ||
| projectRoot /*: string */, | ||
| targetPlatform /*: string */, | ||
| baseOutputPath /*: string */, | ||
| baseOutputPath /*: ?string */, | ||
| source /*: string */, | ||
| runReactNativeCodegen /*: boolean */ = true, | ||
| ) { | ||
|
|
@@ -210,29 +210,38 @@ function readOutputDirFromPkgJson( | |
|
|
||
| function computeOutputPath( | ||
| projectRoot /*: string */, | ||
| baseOutputPath /*: string */, | ||
| optionalBaseOutputPath /*: ?string */, | ||
| pkgJson /*: $FlowFixMe */, | ||
| platform /*: string */, | ||
| ) { | ||
| if (baseOutputPath == null) { | ||
| ) /*: string */ { | ||
| let baseOutputPath /*: string */; | ||
| if (optionalBaseOutputPath == null) { | ||
| const outputDirFromPkgJson = readOutputDirFromPkgJson(pkgJson, platform); | ||
| if (outputDirFromPkgJson != null) { | ||
| // $FlowFixMe[reassign-const] | ||
| baseOutputPath = path.join(projectRoot, outputDirFromPkgJson); | ||
| } else { | ||
| // $FlowFixMe[reassign-const] | ||
| baseOutputPath = projectRoot; | ||
| } | ||
| } else { | ||
| baseOutputPath = optionalBaseOutputPath; | ||
| } | ||
| if (pkgJsonIncludesGeneratedCode(pkgJson)) { | ||
| // Don't create nested directories for libraries to make importing generated headers easier. | ||
| return baseOutputPath; | ||
| } | ||
| if (platform === 'android') { | ||
| return defaultOutputPathForAndroid(baseOutputPath); | ||
| return defaultOutputPathForAndroid( | ||
| baseOutputPath != null && baseOutputPath.length > 0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ? baseOutputPath | ||
| : projectRoot, | ||
| ); | ||
| } | ||
| if (platform === 'ios') { | ||
| return defaultOutputPathForIOS(baseOutputPath); | ||
| return defaultOutputPathForIOS( | ||
| baseOutputPath != null && baseOutputPath.length > 0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ? baseOutputPath | ||
| : projectRoot, | ||
| ); | ||
| } | ||
| return baseOutputPath; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if
outputPathis not passed, the relativeAppPath is'.'?Are we sure it is correct?