From 2e2f8a668907552070a2a53a47137b1449b66bbd Mon Sep 17 00:00:00 2001 From: William Fernandes Date: Mon, 8 Jan 2024 10:01:05 -0800 Subject: [PATCH] Fix release build error due to a casing issue in hermes tarball path after download prebuilt tarball (#42160) Summary: In my mac, I use a case-sensitive volume and when I build a react-native 0.73 project it failed with an error that can't find the hermes release tarball to extract: ``` Node found at: /usr/local/bin/node Preparing the final location Extracting the tarball tar: Error opening archive: Failed to open '/Volumes/Workspace/meet-art-link/ios/Pods/hermes-engine-artifacts/hermes-ios-0.73.1-Release.tar.gz' ``` Note the `...-Release.tar.gz` in the error. In the disk it's `...-release.tar.gz`. The build fails in after download the release tarball in release mode because the hermes tarball name in the `replace_hermes_version.js` build script is capitalized, while the file is lowercase on disk. The fix is to ensure the hermes tarball name's "build type" is lowercase just like the function that creates the tarballs in react-native release located in `hermes_utils.js` in `getHermesPrebuiltArtifactsTarballName()`. Perhaps it's better to retrieve the tarball name from the same method it's generated? E.g.: ```js const { getHermesPrebuiltArtifactsTarballName } = require('react-native/scripts/hermes/hermes-utils'); const tarballName = getHermesPrebuiltArtifactsTarballName(`${version}-${configuration}`); const tarballURLPath = `${podsRoot}/hermes-engine-artifacts/${tarballName}`; ``` If yes, let me know to update the PR. ## Changelog: [iOS][Fixed] - Fix release build error due to a casing issue in hermes tarball path after download prebuilt tarball Pull Request resolved: https://github.com/facebook/react-native/pull/42160 Test Plan: Use a case sensitive volume or system and build react-native 0.73 in release mode, it will fail. Apply the patch in this PR and it will work fine. Reviewed By: cortinico Differential Revision: D52603439 Pulled By: cipolleschi fbshipit-source-id: 41ed8d8202874f338e4aa3af88d9d28ec1b8b3d5 --- .../sdks/hermes-engine/utils/replace_hermes_version.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/sdks/hermes-engine/utils/replace_hermes_version.js b/packages/react-native/sdks/hermes-engine/utils/replace_hermes_version.js index b92a3b9596c31a..f727aebb9cb8cd 100644 --- a/packages/react-native/sdks/hermes-engine/utils/replace_hermes_version.js +++ b/packages/react-native/sdks/hermes-engine/utils/replace_hermes_version.js @@ -53,7 +53,7 @@ function shouldReplaceHermesConfiguration(configuration) { } function replaceHermesConfiguration(configuration, version, podsRoot) { - const tarballURLPath = `${podsRoot}/hermes-engine-artifacts/hermes-ios-${version}-${configuration}.tar.gz`; + const tarballURLPath = `${podsRoot}/hermes-engine-artifacts/hermes-ios-${version.toLowerCase()}-${configuration.toLowerCase()}.tar.gz`; const finalLocation = 'hermes-engine'; console.log('Preparing the final location');