Repository navigation
Name the Hermes source archive after the Hermes version - #59715
Open
fairysword wants to merge 1 commit into
Open
fairysword wants to merge 1 commit into
fairysword wants to merge 1 commit into
Conversation
The archive is always downloaded to `downloadsDir/hermes.tar.gz`, so every Hermes version shares one destination file while `build/download-task/etags.json` remembers an ETag per URL. After a build has already seen a version's tarball URL, switching back to it answers 304 and the download is skipped, leaving the other version's bytes on disk and building the wrong Hermes source. Name the archive `hermes-<version>.tar.gz`, the way the other third-party sources in that directory are named.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
downloadHermesalways writes todownloadsDir/hermes.tar.gz, so every Hermes version shares a single destination file. The download plugin's ETag store,packages/react-native/ReactAndroid/hermes-engine/build/download-task/etags.json, is keyed by URL only:{"https://github.com":{"/meta/hermes/tarball/250829098.0.0-stable":{"ETag":"..."},"/meta/hermes/tarball/hermes-v250829098.0.17":{"ETag":"..."}}}Once a build has downloaded a given Hermes tag, returning to that tag answers
304 Not Modified, sodownloadHermeskeeps the file that is already on disk. That file now holds a different version's bytes, because the previous tag wrote to the same name.unzipHermesthen extracts the wrong Hermes source and the build silently compiles a Hermes version that does not matchsdks/.hermesv1version.This needs no unusual setup.
downloadsDirdefaults topackages/react-native/sdks/download, which sits outside the Gradle build directory, and CI pointsREACT_NATIVE_DOWNLOADS_DIRat a shared/opt/react-native-downloads. Anyone who moves between Hermes versions — testing a Hermes bump, switching branches, bisecting — can hit it.useETagwas added in daefeb1 ("Ensure local hermes.tar.gz doesn't get stale between subsequent runs.", Dec 2022) to stop the shared file from going stale when a Hermes commit landed. This change removes the remaining case, where ETag caching itself keeps the shared file stale, by giving each version its own file.Every other third-party source downloaded into the same directory is already named after its version:
boost_${BOOST_VERSION}.tar.gzdouble-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gzfolly-${FOLLY_VERSION}.tar.gzfast_float-${FAST_FLOAT_VERSION}.tar.gzfmt-${FMT_VERSION}.tar.gzglog-${GLOG_VERSION}.tar.gzHermes now follows the same convention and becomes
hermes-<version>.tar.gz. Thehermes-vprefix is stripped from the tag so the name stayshermes-<version>.tar.gzfor both a release tag (hermes-v250829098.0.17) and the default value (250829098.0.0-stable);scripts/hermes/bump-hermes-version.jsnormalizes the same prefix.Versions no longer overwrite each other, so switching back to a version that is already on disk needs no download at all.
Changelog:
Test Plan:
Both runs below use a clean
downloadsDirand a clean ETag store, and build Hermes from source:Each step changes only
packages/react-native/sdks/.hermesv1version, then re-runs that command. The two Hermes versions used are:250829098.0.0-stable(default, no version file)d212f870733227513a2907dab0a59166hermes-v250829098.0.17e598a0fd04d093365c7f24a31281dc59Before
downloadsDir250829098.0.0-stablehermes.tar.gzd212f870...hermes-v250829098.0.17hermes.tar.gze598a0fd...250829098.0.0-stablehermes.tar.gze598a0fd...The third step is the bug:
downloadHermesdoes not run, and the build uses thehermes-v250829098.0.17source while.hermesv1versionasks for250829098.0.0-stable. Reproduced on a clean checkout with the defaultdownloadsDirand noREACT_NATIVE_DOWNLOADS_DIRset.After
downloadsDir250829098.0.0-stablehermes-250829098.0.0-stable.tar.gzd212f870...hermes-v250829098.0.17d212f870.../e598a0fd...250829098.0.0-stabled212f870.../e598a0fd...Each version resolves to its own archive, and returning to a version already on disk downloads nothing.
Also verified:
./gradlew :packages:react-native:ReactAndroid:hermes-engine:unzipHermessucceeds with the new archive name and extracts the Hermes source tree (CMakeLists.txt,API,android,cmake, ...) intopackages/react-native/sdks/hermes.ktfmtoutput.yarn format-check-kotlinskips this file because of the**/hermes-engine/**ignore entry inscripts/format-kotlin.js, soktfmtwas run against the file directly.