From 28f4ebab8ab4b0f337699e6a135e2aa983866f42 Mon Sep 17 00:00:00 2001 From: fergusean Date: Thu, 6 Jul 2023 02:50:51 -0700 Subject: [PATCH] fix: repairs $EXTRA_COMPILER_ARGS error with multiple args (#38147) Summary: Fixes a regression added [on merge of https://github.com/facebook/react-native/issues/37531](https://github.com/facebook/react-native/commit/260bcf7f1bf78022872eb2f40f33fb552a414809#diff-16a358d6a9dea8469bfdb899d0990df1c32b8c3b1149c86685bec81f50bd24beR179) (though oddly I don't see it in [https://github.com/facebook/react-native/issues/37531's diff](https://github.com/facebook/react-native/pull/37531/files#diff-16a358d6a9dea8469bfdb899d0990df1c32b8c3b1149c86685bec81f50bd24beR179), so perhaps added during conflict resolution?) where multiple arguments in `$EXTRA_COMPILER_ARGS` are now incorrectly wrapped in quotes, including RN's own sourcemap support: ``` runner@SeansMacBookGo sampleapp % /Users/runner/builds/y_x6gsp4/0/sampleapp/ios/Pods/hermes-engine/destroot/bin/hermesc -emit-binary -max-diagnostic-width=80 '-O -output-source-map' -out /Users/runner/builds/y_x6gsp4/0/sampleapp/ios/build/derived-data/Build/Intermediates.noindex/ArchiveIntermediates/sampleapp/BuildProductsPath/Release-iphoneos/sampleapp.app/main.jsbundle /Users/runner/builds/y_x6gsp4/0/sampleapp/ios/build/derived-data/Build/Intermediates.noindex/ArchiveIntermediates/sampleapp/BuildProductsPath/Release-iphoneos/main.jsbundle hermesc: Unknown command line argument '-O -output-source-map'. Try: '/Users/runner/builds/y_x6gsp4/0/sampleapp/ios/Pods/hermes-engine/destroot/bin/hermesc -help' hermesc: Did you mean '-output-source-map'? ``` ## Changelog: [IOS] [FIXED] - Fix build error when there are multiple EXTRA_COMPILER_ARGS Pull Request resolved: https://github.com/facebook/react-native/pull/38147 Test Plan: Removing the quotes and running the command results a successful run of `hermesc` (exit code 0 and the expected files produced). Reviewed By: rshest Differential Revision: D47254412 Pulled By: cipolleschi fbshipit-source-id: 96b71bb05c7a6939088816e76a9a2d02e89ed768 --- packages/react-native/scripts/react-native-xcode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/scripts/react-native-xcode.sh b/packages/react-native/scripts/react-native-xcode.sh index 080ed233ec25be..7e2f1190771cb5 100755 --- a/packages/react-native/scripts/react-native-xcode.sh +++ b/packages/react-native/scripts/react-native-xcode.sh @@ -176,7 +176,7 @@ else if [[ $EMIT_SOURCEMAP == true ]]; then EXTRA_COMPILER_ARGS="$EXTRA_COMPILER_ARGS -output-source-map" fi - "$HERMES_CLI_PATH" -emit-binary -max-diagnostic-width=80 "$EXTRA_COMPILER_ARGS" -out "$DEST/main.jsbundle" "$BUNDLE_FILE" + "$HERMES_CLI_PATH" -emit-binary -max-diagnostic-width=80 $EXTRA_COMPILER_ARGS -out "$DEST/main.jsbundle" "$BUNDLE_FILE" if [[ $EMIT_SOURCEMAP == true ]]; then HBC_SOURCEMAP_FILE="$DEST/main.jsbundle.map" "$NODE_BINARY" "$COMPOSE_SOURCEMAP_PATH" "$PACKAGER_SOURCEMAP_FILE" "$HBC_SOURCEMAP_FILE" -o "$SOURCEMAP_FILE"