Skip to content

Commit

Permalink
Fix release build error due to a casing issue in hermes tarball path …
Browse files Browse the repository at this point in the history
…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:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[iOS][Fixed] - Fix release build error due to a casing issue in hermes tarball path after download prebuilt tarball

Pull Request resolved: #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
  • Loading branch information
wfern authored and facebook-github-bot committed Jan 8, 2024
1 parent c684f9f commit 2e2f8a6
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -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');
Expand Down

0 comments on commit 2e2f8a6

Please sign in to comment.