Skip to content

Commit 50ae4c8

Browse files
fabriziocuccimeta-codesync[bot]
authored andcommitted
Do not use hermesNightly on the release branch (#55890)
Summary: Pull Request resolved: #55890 Changelog: [Internal] This was done manually on `0.84-stable` and `0.85-stable`. Discovered due to the failure when pushing the new `0.85-stable` branch: https://github.com/facebook/react-native/actions/runs/22592250332/job/65471130298. Reviewed By: cortinico Differential Revision: D95051387 fbshipit-source-id: 2a9f0cfeef37ec1903d42259bec3518af721410c
1 parent 1d47693 commit 50ae4c8

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

scripts/releases/create-release-commit.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
*/
1010

1111
const {setVersion} = require('../releases/set-version');
12+
const {
13+
setStableHermesForReleaseBranch,
14+
} = require('../releases/utils/hermes-utils');
1215
const {getBranchName} = require('../releases/utils/scm-utils');
1316
const {
1417
writeReleaseAssetUrlsToDotSlashFiles,
@@ -52,6 +55,9 @@ async function main() {
5255
console.info('Setting version for monorepo packages and react-native');
5356
await setVersion(version, false); // version, skip-react-native
5457

58+
console.info('Set stable Hermes for release branch');
59+
await setStableHermesForReleaseBranch();
60+
5561
console.info('Writing release asset URLs to DotSlash files');
5662
await writeReleaseAssetUrlsToDotSlashFiles(version);
5763

scripts/releases/utils/hermes-utils.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ const MAVEN_VERSIONS_FILE_PATH = path.join(
2525
'version.properties',
2626
);
2727

28+
const GRADLE_PROPERTIES_PATH = path.join(
29+
REACT_NATIVE_PACKAGE_DIR,
30+
'..',
31+
'..',
32+
'gradle.properties',
33+
);
34+
2835
async function getLatestHermesNightlyVersion() /*: Promise<{
2936
compilerVersion: string,
3037
compilerV1Version: string,
@@ -51,6 +58,27 @@ async function getLatestHermesNightlyVersion() /*: Promise<{
5158
};
5259
}
5360

61+
/**
62+
* Updates gradle.properties to use stable Hermes instead of nightly.
63+
* This is needed because main uses nightly Hermes, but release branches
64+
* should use stable Hermes from Maven Central.
65+
*/
66+
async function setStableHermesForReleaseBranch() {
67+
let content = await fs.readFile(GRADLE_PROPERTIES_PATH, 'utf8');
68+
69+
content = content.replace(
70+
'react.internal.useHermesStable=false',
71+
'react.internal.useHermesStable=true',
72+
);
73+
content = content.replace(
74+
'react.internal.useHermesNightly=true',
75+
'react.internal.useHermesNightly=false',
76+
);
77+
78+
await fs.writeFile(GRADLE_PROPERTIES_PATH, content, 'utf8');
79+
console.info('Switched gradle.properties to use stable Hermes');
80+
}
81+
5482
async function updateHermesCompilerVersionInDependencies(
5583
hermesVersion /*: string */,
5684
) /*: Promise<void> */ {
@@ -95,6 +123,7 @@ async function updateHermesVersionsToNightly() {
95123
}
96124

97125
module.exports = {
126+
setStableHermesForReleaseBranch,
98127
updateHermesVersionsToNightly,
99128
updateHermesCompilerVersionInDependencies,
100129
updateHermesRuntimeDependenciesVersions,

0 commit comments

Comments
 (0)