diff --git a/.github/actions/prepare-hermes-v1-app/action.yml b/.github/actions/prepare-hermes-v1-app/action.yml deleted file mode 100644 index 24f40d0fbacd..000000000000 --- a/.github/actions/prepare-hermes-v1-app/action.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: prepare-hermes-v1-app -description: Prepares a React Native app with Hermes V1 enabled -inputs: - retry-count: - description: 'Number of times to retry the yarn install on failure' -runs: - using: composite - steps: - - name: Create new app - shell: bash - run: | - cd /tmp - npx @react-native-community/cli init RNApp --skip-install --version nightly - - - name: Select latest Hermes V1 version - shell: bash - run: | - node "$GITHUB_WORKSPACE/.github/workflow-scripts/selectLatestHermesV1Version.js" - - - name: Apply patch to enable Hermes V1 - shell: bash - run: | - cd /tmp/RNApp - git apply --binary --3way --whitespace=nowarn "$GITHUB_WORKSPACE/.github/workflow-scripts/hermes-v1.patch" - echo "āœ… Patch applied successfully" - - - name: Install app dependencies with retry - uses: nick-fields/retry@v3 - with: - timeout_minutes: 10 - max_attempts: ${{ inputs.retry-count }} - retry_wait_seconds: 15 - shell: bash - command: | - cd /tmp/RNApp - yarn install - on_retry_command: | - echo "Cleaning up for yarn retry..." - cd /tmp/RNApp - rm -rf node_modules yarn.lock || true - yarn cache clean || true diff --git a/.github/workflow-scripts/__tests__/createDraftRelease-test.js b/.github/workflow-scripts/__tests__/createDraftRelease-test.js index b1b330acd87f..003b1f016b29 100644 --- a/.github/workflow-scripts/__tests__/createDraftRelease-test.js +++ b/.github/workflow-scripts/__tests__/createDraftRelease-test.js @@ -144,10 +144,6 @@ Hermes dSYMS: - [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-debug.tar.gz) - [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-release.tar.gz) -Hermes V1 dSYMS: -- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-debug.tar.gz) -- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-release.tar.gz) - ReactNativeDependencies dSYMs: - [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-debug.tar.gz) - [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-release.tar.gz) @@ -172,7 +168,6 @@ View the whole changelog in the [CHANGELOG.md file](https://github.com/facebook/ it('computes body for release when hermes versions are passed', async () => { const version = '0.77.1'; const hermesVersion = '0.15.0'; - const hermesV1Version = '250829098.0.2'; const changelog = `## v${version} ### Breaking Changes - [PR #9012](https://github.com/facebook/react-native/pull/9012) - Some other change @@ -188,7 +183,6 @@ View the whole changelog in the [CHANGELOG.md file](https://github.com/facebook/ changelog, version, hermesVersion, - hermesV1Version, ); expect(body).toEqual(`${changelog} @@ -199,10 +193,6 @@ Hermes dSYMS: - [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-debug.tar.gz) - [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-release.tar.gz) -Hermes V1 dSYMS: -- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-debug.tar.gz) -- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-release.tar.gz) - ReactNativeDependencies dSYMs: - [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-debug.tar.gz) - [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-release.tar.gz) diff --git a/.github/workflow-scripts/createDraftRelease.js b/.github/workflow-scripts/createDraftRelease.js index ca9771b713c9..f0db179264ca 100644 --- a/.github/workflow-scripts/createDraftRelease.js +++ b/.github/workflow-scripts/createDraftRelease.js @@ -40,9 +40,8 @@ function _extractChangelog(version) { return changelog.slice(changelogStarts, changelogEnds).join('\n').trim(); } -function _computeBody(changelog, version, hermesVersion, hermesV1Version) { +function _computeBody(changelog, version, hermesVersion) { hermesVersion = hermesVersion ?? version; - hermesV1Version = hermesV1Version ?? version; return `${changelog} --- @@ -51,10 +50,6 @@ Hermes dSYMS: - [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-debug.tar.gz) - [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-release.tar.gz) -Hermes V1 dSYMS: -- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-debug.tar.gz) -- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-release.tar.gz) - ReactNativeDependencies dSYMs: - [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-debug.tar.gz) - [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-release.tar.gz) @@ -128,7 +123,6 @@ async function createDraftRelease( latest, token, hermesVersion, - hermesV1Version, ) { if (version.startsWith('v')) { version = version.substring(1); @@ -137,7 +131,7 @@ async function createDraftRelease( _verifyTagExists(version); moveToChangelogBranch(version); const changelog = _extractChangelog(version); - const body = _computeBody(changelog, version, hermesVersion, hermesV1Version); + const body = _computeBody(changelog, version, hermesVersion); const release = await _createDraftReleaseOnGitHub( version, body, diff --git a/.github/workflow-scripts/hermes-v1.patch b/.github/workflow-scripts/hermes-v1.patch deleted file mode 100644 index 213020381fc4..000000000000 --- a/.github/workflow-scripts/hermes-v1.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/android/settings.gradle b/android/settings.gradle -index 63b5d4e..6359ec3 100644 ---- a/android/settings.gradle -+++ b/android/settings.gradle -@@ -4,3 +4,11 @@ extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autoli - rootProject.name = 'RNApp' - include ':app' - includeBuild('../node_modules/@react-native/gradle-plugin') -+ -+includeBuild('../node_modules/react-native') { -+ dependencySubstitution { -+ substitute(module("com.facebook.react:react-android")).using(project(":packages:react-native:ReactAndroid")) -+ substitute(module("com.facebook.react:react-native")).using(project(":packages:react-native:ReactAndroid")) -+ substitute(project(":packages:react-native:ReactAndroid:hermes-engine")).using(module("com.facebook.hermes:hermes-android:$HERMES_V1_VERSION")) -+ } -+} -diff --git a/package.json b/package.json -index f05d51b..69938af 100644 ---- a/package.json -+++ b/package.json -@@ -35,6 +35,9 @@ - "react-test-renderer": "19.2.0", - "typescript": "^5.8.3" - }, -+ "resolutions": { -+ "hermes-compiler": "$HERMES_V1_VERSION" -+ }, - "engines": { - "node": ">=20" - } diff --git a/.github/workflow-scripts/selectLatestHermesV1Version.js b/.github/workflow-scripts/selectLatestHermesV1Version.js deleted file mode 100644 index db11b9278c1b..000000000000 --- a/.github/workflow-scripts/selectLatestHermesV1Version.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const { execSync } = require('child_process'); -const fs = require('fs'); -const path = require('path'); - -const PATCH_FILE_PATH = path.join(__dirname, 'hermes-v1.patch'); - -function getLatestHermesV1Version() { - const npmString = "npm view hermes-compiler@latest-v1 version"; - - try { - const result = execSync(npmString, { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim(); - return result; - } catch (error) { - throw new Error(`Failed to get package version for hermes-compiler@latest-v1`); - } -} - -function setHermesV1VersionInPatch(version) { - if (!fs.existsSync(PATCH_FILE_PATH)) { - throw new Error(`Patch file not found at path: ${PATCH_FILE_PATH}`); - } - - let patchContent = fs.readFileSync(PATCH_FILE_PATH, 'utf8'); - const updatedContent = patchContent.replaceAll( - "$HERMES_V1_VERSION", - version - ); - fs.writeFileSync(PATCH_FILE_PATH, updatedContent, 'utf8'); -} - -setHermesV1VersionInPatch(getLatestHermesV1Version()); diff --git a/.github/workflows/create-draft-release.yml b/.github/workflows/create-draft-release.yml index ca947dc267c1..99bf330017f3 100644 --- a/.github/workflows/create-draft-release.yml +++ b/.github/workflows/create-draft-release.yml @@ -6,11 +6,7 @@ on: hermesVersion: required: false type: string - description: The version of Hermes to use for this release (eg. 0.15.0). If not specified, it will use React Native Version - hermesV1Version: - required: false - type: string - description: The version of Hermes V1 to use for this release (eg. 250829098.0.2). If not specified, it will use React Native Version + description: The version of Hermes to use for this release (eg. 250829098.0.2). If not specified, it will use React Native Version jobs: create-draft-release: @@ -37,7 +33,7 @@ jobs: const {createDraftRelease} = require('./.github/workflow-scripts/createDraftRelease.js'); const version = '${{ github.ref_name }}'; const {isLatest} = require('./.github/workflow-scripts/publishTemplate.js'); - return (await createDraftRelease(version, isLatest(), '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}', '${{ inputs.hermesVersion }}', '${{ inputs.hermesV1Version }}')).id; + return (await createDraftRelease(version, isLatest(), '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}', '${{ inputs.hermesVersion }}')).id; result-encoding: string - name: Upload release assets for DotSlash uses: actions/github-script@v8 diff --git a/.github/workflows/prebuild-ios-core.yml b/.github/workflows/prebuild-ios-core.yml index ce2f6b88c30b..fabddff55095 100644 --- a/.github/workflows/prebuild-ios-core.yml +++ b/.github/workflows/prebuild-ios-core.yml @@ -48,11 +48,9 @@ jobs: shell: bash run: | if [ "${{ inputs.use-hermes-nightly }}" == "true" ]; then - # We are not publishing nightly versions of Hermes V1 yet. - # For now, we can use the latest version of Hermes V1 published on maven and npm. HERMES_VERSION="latest-v1" else - HERMES_VERSION=$(sed -n 's/^HERMES_V1_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties) + HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties) fi echo "Using Hermes version: $HERMES_VERSION" echo "HERMES_VERSION=$HERMES_VERSION" >> $GITHUB_ENV diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 887dd97f6f19..8ff209bf9765 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -24,22 +24,18 @@ jobs: if: github.repository == 'facebook/react-native' outputs: HERMES_VERSION: ${{ steps.set_hermes_versions.outputs.HERMES_VERSION }} - HERMES_V1_VERSION: ${{ steps.set_hermes_versions.outputs.HERMES_V1_VERSION }} steps: - name: Checkout uses: actions/checkout@v6 - id: set_hermes_versions run: | - echo "Setting hermes versions to latest" + echo "Setting hermes version" hermes_version=$(grep -oE 'HERMES_VERSION_NAME=([0-9]+\.[0-9]+\.[0-9]+)' packages/react-native/sdks/hermes-engine/version.properties | cut -d'=' -f2) - hermes_v1_version=$(grep -oE 'HERMES_V1_VERSION_NAME=([0-9]+\.[0-9]+\.[0-9]+)' packages/react-native/sdks/hermes-engine/version.properties | cut -d'=' -f2) echo "HERMES_VERSION=$hermes_version" >> $GITHUB_OUTPUT - echo "HERMES_V1_VERSION=$hermes_v1_version" >> $GITHUB_OUTPUT - - name: Print hermes versions + - name: Print hermes version run: | echo "HERMES_VERSION=${{ steps.set_hermes_versions.outputs.HERMES_VERSION }}" - echo "HERMES_V1_VERSION=${{ steps.set_hermes_versions.outputs.HERMES_V1_VERSION }}" prebuild_apple_dependencies: if: github.repository == 'facebook/react-native' @@ -148,4 +144,3 @@ jobs: secrets: inherit with: hermesVersion: ${{ needs.set_hermes_versions.outputs.HERMES_VERSION }} - hermesV1Version: ${{ needs.set_hermes_versions.outputs.HERMES_V1_VERSION }} diff --git a/build.gradle.kts b/build.gradle.kts index 0858b5cb2917..945398e88db7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -118,7 +118,7 @@ if (project.findProperty("react.internal.useHermesStable")?.toString()?.toBoolea val hermesVersionPropertiesFile = rootProject.file("./packages/react-native/sdks/hermes-engine/version.properties") hermesVersionPropertiesFile.inputStream().use { hermesVersions.load(it) } - val selectedHermesVersion = hermesVersions["HERMES_V1_VERSION_NAME"] as String + val selectedHermesVersion = hermesVersions["HERMES_VERSION_NAME"] as String hermesSubstitution = selectedHermesVersion to "Users opted to use stable hermes release" } else if ( @@ -137,15 +137,7 @@ if (project.findProperty("react.internal.useHermesStable")?.toString()?.toBoolea ) } - val hermesV1Enabled = project.findProperty("hermesV1Enabled")?.toString()?.toBoolean() ?: true - // Hermes V1 stable releases are published without the -SNAPSHOT suffix. - // Legacy nightly builds use -SNAPSHOT. - val resolvedVersion = - if (hermesV1Enabled) hermesCompilerVersion else "$hermesCompilerVersion-SNAPSHOT" - val reason = - if (hermesV1Enabled) "Users opted to use hermes V1 stable" - else "Users opted to use hermes nightly" - hermesSubstitution = resolvedVersion to reason + hermesSubstitution = hermesCompilerVersion to "Users opted to use hermes stable" } else { logger.warn( """ diff --git a/gradle.properties b/gradle.properties index d7c39175371a..4c1f11da8041 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,6 +24,3 @@ react.internal.useHermesStable=false # Controls whether to use Hermes from nightly builds. This will speed up builds # but should NOT be turned on for CI or release builds. react.internal.useHermesNightly=true - -# Controls whether to use Hermes 1.0. Clean and rebuild when changing. -hermesV1Enabled=true diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt index e7859ff6ad0b..bf8f28952695 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt @@ -28,7 +28,6 @@ import com.facebook.react.utils.DependencyUtils.readVersionAndGroupStrings import com.facebook.react.utils.JdkConfiguratorUtils.configureJavaToolChains import com.facebook.react.utils.JsonUtils import com.facebook.react.utils.NdkConfiguratorUtils.configureReactNativeNdk -import com.facebook.react.utils.ProjectUtils.isHermesV1Enabled import com.facebook.react.utils.ProjectUtils.needsCodegenFromPackageJson import com.facebook.react.utils.findPackageJsonFile import java.io.File @@ -55,10 +54,6 @@ class ReactPlugin : Plugin { project, ) - if (!project.rootProject.isHermesV1Enabled) { - rootExtension.hermesV1Enabled.set(false) - } - // App Only Configuration project.pluginManager.withPlugin("com.android.application") { // We wire the root extension with the values coming from the app (either user populated or @@ -75,8 +70,7 @@ class ReactPlugin : Plugin { File(reactNativeDir, "sdks/hermes-engine/version.properties") val versionAndGroupStrings = readVersionAndGroupStrings(project, propertiesFile, hermesVersionPropertiesFile) - val hermesV1Enabled = rootExtension.hermesV1Enabled.get() - configureDependencies(project, versionAndGroupStrings, hermesV1Enabled) + configureDependencies(project, versionAndGroupStrings) configureRepositories(project, versionAndGroupStrings.isNightly) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt index 26174c0ce0de..0c993f59c607 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt @@ -11,7 +11,6 @@ import javax.inject.Inject import org.gradle.api.Project import org.gradle.api.file.DirectoryProperty import org.gradle.api.provider.ListProperty -import org.gradle.api.provider.Property /** * A private extension we set on the rootProject to make easier to share values at execution time @@ -58,6 +57,4 @@ abstract class PrivateReactExtension @Inject constructor(project: Project) { val codegenDir: DirectoryProperty = objects.directoryProperty().convention(root.dir("node_modules/@react-native/codegen")) - - val hermesV1Enabled: Property = objects.property(Boolean::class.java).convention(true) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt index c5f42cfdb43d..f685772c7019 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt @@ -13,7 +13,6 @@ import com.facebook.react.utils.PropertyUtils.EXCLUSIVE_ENTEPRISE_REPOSITORY import com.facebook.react.utils.PropertyUtils.INCLUDE_JITPACK_REPOSITORY import com.facebook.react.utils.PropertyUtils.INCLUDE_JITPACK_REPOSITORY_DEFAULT import com.facebook.react.utils.PropertyUtils.INTERNAL_HERMES_PUBLISHING_GROUP -import com.facebook.react.utils.PropertyUtils.INTERNAL_HERMES_V1_VERSION_NAME import com.facebook.react.utils.PropertyUtils.INTERNAL_HERMES_VERSION_NAME import com.facebook.react.utils.PropertyUtils.INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO import com.facebook.react.utils.PropertyUtils.INTERNAL_REACT_PUBLISHING_GROUP @@ -32,7 +31,6 @@ internal object DependencyUtils { internal data class Coordinates( val versionString: String, val hermesVersionString: String, - val hermesV1VersionString: String, val reactGroupString: String = DEFAULT_INTERNAL_REACT_PUBLISHING_GROUP, val hermesGroupString: String = DEFAULT_INTERNAL_HERMES_PUBLISHING_GROUP, private val isHermesNightly: Boolean = false, @@ -114,19 +112,12 @@ internal object DependencyUtils { * party libraries which are auto-linked. Specifically it takes care of: * - Forcing the react-android/hermes-android version to the one specified in the package.json * - Substituting `react-native` with `react-android` and `hermes-engine` with `hermes-android` - * - Selecting between the classic Hermes and Hermes V1 */ fun configureDependencies( project: Project, coordinates: Coordinates, - hermesV1Enabled: Boolean = true, ) { - if ( - coordinates.versionString.isBlank() || - (!hermesV1Enabled && coordinates.hermesVersionString.isBlank()) || - (hermesV1Enabled && coordinates.hermesV1VersionString.isBlank()) - ) - return + if (coordinates.versionString.isBlank() || coordinates.hermesVersionString.isBlank()) return project.rootProject.allprojects { eachProject -> eachProject.configurations.all { configuration -> // Here we set a dependencySubstitution for both react-native and hermes-engine as those @@ -134,7 +125,7 @@ internal object DependencyUtils { // This allows users to import libraries that are still using // implementation("com.facebook.react:react-native:+") and resolve the right dependency. configuration.resolutionStrategy.dependencySubstitution { - getDependencySubstitutions(coordinates, hermesV1Enabled).forEach { (module, dest, reason) + getDependencySubstitutions(coordinates).forEach { (module, dest, reason) -> it.substitute(it.module(module)).using(it.module(dest)).because(reason) } @@ -146,7 +137,7 @@ internal object DependencyUtils { // Contributors only: The hermes-engine version is forced only if the user has // not opted into using nightlies for local development. configuration.resolutionStrategy.force( - "${coordinates.hermesGroupString}:hermes-android:${if (hermesV1Enabled) coordinates.hermesV1VersionString else coordinates.hermesVersionString}" + "${coordinates.hermesGroupString}:hermes-android:${coordinates.hermesVersionString}" ) } } @@ -155,12 +146,9 @@ internal object DependencyUtils { internal fun getDependencySubstitutions( coordinates: Coordinates, - hermesV1Enabled: Boolean = true, ): List> { val dependencySubstitution = mutableListOf>() - val hermesVersion = - if (hermesV1Enabled) coordinates.hermesV1VersionString else coordinates.hermesVersionString - val hermesVersionString = "${coordinates.hermesGroupString}:hermes-android:${hermesVersion}" + val hermesVersionString = "${coordinates.hermesGroupString}:hermes-android:${coordinates.hermesVersionString}" dependencySubstitution.add( Triple( "com.facebook.react:react-native", @@ -245,14 +233,11 @@ internal object DependencyUtils { hermesVersionString } - val hermesV1Version = - (hermesVersionProperties[INTERNAL_HERMES_V1_VERSION_NAME] as? String).orEmpty() val isHermesNightly = (project.findProperty(INTERNAL_USE_HERMES_NIGHTLY) as? String).toBoolean() return Coordinates( versionString, hermesVersion, - hermesV1Version, reactGroupString, hermesGroupString, isHermesNightly, diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/ProjectUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/ProjectUtils.kt index 805b9f92dd57..02ef854b3a1e 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/ProjectUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/ProjectUtils.kt @@ -13,11 +13,9 @@ import com.facebook.react.utils.KotlinStdlibCompatUtils.lowercaseCompat import com.facebook.react.utils.KotlinStdlibCompatUtils.toBooleanStrictOrNullCompat import com.facebook.react.utils.PropertyUtils.EDGE_TO_EDGE_ENABLED import com.facebook.react.utils.PropertyUtils.HERMES_ENABLED -import com.facebook.react.utils.PropertyUtils.HERMES_V1_ENABLED import com.facebook.react.utils.PropertyUtils.REACT_NATIVE_ARCHITECTURES import com.facebook.react.utils.PropertyUtils.SCOPED_EDGE_TO_EDGE_ENABLED import com.facebook.react.utils.PropertyUtils.SCOPED_HERMES_ENABLED -import com.facebook.react.utils.PropertyUtils.SCOPED_HERMES_V1_ENABLED import com.facebook.react.utils.PropertyUtils.SCOPED_REACT_NATIVE_ARCHITECTURES import com.facebook.react.utils.PropertyUtils.SCOPED_USE_THIRD_PARTY_JSC import com.facebook.react.utils.PropertyUtils.USE_THIRD_PARTY_JSC @@ -29,8 +27,6 @@ internal object ProjectUtils { const val HERMES_FALLBACK = true - const val HERMES_V1_ENABLED_FALLBACK = true - internal fun Project.isNewArchEnabled(): Boolean = true internal val Project.isHermesEnabled: Boolean @@ -73,23 +69,6 @@ internal object ProjectUtils { (project.hasProperty(SCOPED_USE_THIRD_PARTY_JSC) && project.property(SCOPED_USE_THIRD_PARTY_JSC).toString().toBoolean()) - internal val Project.isHermesV1Enabled: Boolean - get() = - if ( - project.hasProperty(HERMES_V1_ENABLED) || project.hasProperty(SCOPED_HERMES_V1_ENABLED) - ) { - (project.hasProperty(HERMES_V1_ENABLED) && - project.property(HERMES_V1_ENABLED).toString().toBoolean()) || - (project.hasProperty(SCOPED_HERMES_V1_ENABLED) && - project.property(SCOPED_HERMES_V1_ENABLED).toString().toBoolean()) || - (project.extraProperties.has(HERMES_V1_ENABLED) && - project.extraProperties.get(HERMES_V1_ENABLED).toString().toBoolean()) || - (project.extraProperties.has(SCOPED_HERMES_V1_ENABLED) && - project.extraProperties.get(SCOPED_HERMES_V1_ENABLED).toString().toBoolean()) - } else { - HERMES_V1_ENABLED_FALLBACK - } - internal fun Project.needsCodegenFromPackageJson(rootProperty: DirectoryProperty): Boolean { val parsedPackageJson = readPackageJsonFile(this, rootProperty) return needsCodegenFromPackageJson(parsedPackageJson) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt index a52e4177fd0c..54b82fbad687 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt @@ -18,10 +18,6 @@ object PropertyUtils { const val HERMES_ENABLED = "hermesEnabled" const val SCOPED_HERMES_ENABLED = "react.hermesEnabled" - /** Public property that toggles Hermes V1 */ - const val HERMES_V1_ENABLED = "hermesV1Enabled" - const val SCOPED_HERMES_V1_ENABLED = "react.hermesV1Enabled" - /** Public property that toggles edge-to-edge */ const val EDGE_TO_EDGE_ENABLED = "edgeToEdgeEnabled" const val SCOPED_EDGE_TO_EDGE_ENABLED = "react.edgeToEdgeEnabled" @@ -92,5 +88,4 @@ object PropertyUtils { * are stored in sdks/hermes-engine/version.properties */ const val INTERNAL_HERMES_VERSION_NAME = "HERMES_VERSION_NAME" - const val INTERNAL_HERMES_V1_VERSION_NAME = "HERMES_V1_VERSION_NAME" } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt index 0454b5ece333..5c57bb296fa4 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt @@ -291,97 +291,48 @@ class DependencyUtilsTest { fun configureDependencies_withEmptyVersion_doesNothing() { val project = createProject() - configureDependencies(project, DependencyUtils.Coordinates("", "", "")) + configureDependencies(project, DependencyUtils.Coordinates("", "")) assertThat(project.configurations.first().resolutionStrategy.forcedModules.isEmpty()).isTrue() } @Test - fun configureDependencies_withVersionString_appliesResolutionStrategy_withClassicHermes() { + fun configureDependencies_withVersionString_appliesResolutionStrategy() { val project = createProject() - configureDependencies(project, DependencyUtils.Coordinates("1.2.3", "4.5.6", "7.8.9")) + configureDependencies(project, DependencyUtils.Coordinates("1.2.3", "4.5.6")) val forcedModules = project.configurations.first().resolutionStrategy.forcedModules assertThat(forcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" }) .isTrue() assertThat(forcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:4.5.6" }) - .isFalse() - assertThat(forcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" }) .isTrue() } @Test - fun configureDependencies_withVersionString_appliesResolutionStrategy_withHermesV1() { - val project = createProject() - - configureDependencies( - project, - DependencyUtils.Coordinates("1.2.3", "4.5.6", "7.8.9"), - hermesV1Enabled = true, - ) - - val forcedModules = project.configurations.first().resolutionStrategy.forcedModules - assertThat(forcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" }) - .isTrue() - assertThat(forcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" }) - .isTrue() - } - - @Test - fun configureDependencies_withVersionString_appliesOnAllProjects_withClassicHermes() { + fun configureDependencies_withVersionString_appliesOnAllProjects() { val rootProject = ProjectBuilder.builder().build() val appProject = ProjectBuilder.builder().withName("app").withParent(rootProject).build() val libProject = ProjectBuilder.builder().withName("lib").withParent(rootProject).build() appProject.plugins.apply("com.android.application") libProject.plugins.apply("com.android.library") - configureDependencies(appProject, DependencyUtils.Coordinates("1.2.3", "4.5.6", "7.8.9")) + configureDependencies(appProject, DependencyUtils.Coordinates("1.2.3", "4.5.6")) val appForcedModules = appProject.configurations.first().resolutionStrategy.forcedModules val libForcedModules = libProject.configurations.first().resolutionStrategy.forcedModules assertThat(appForcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" }) .isTrue() assertThat(appForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:4.5.6" }) - .isFalse() - assertThat(appForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" }) .isTrue() assertThat(libForcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" }) .isTrue() assertThat(libForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:4.5.6" }) - .isFalse() - assertThat(libForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" }) - .isTrue() - } - - @Test - fun configureDependencies_withVersionString_appliesOnAllProjects_withHermesV1() { - val rootProject = ProjectBuilder.builder().build() - val appProject = ProjectBuilder.builder().withName("app").withParent(rootProject).build() - val libProject = ProjectBuilder.builder().withName("lib").withParent(rootProject).build() - appProject.plugins.apply("com.android.application") - libProject.plugins.apply("com.android.library") - - configureDependencies( - appProject, - DependencyUtils.Coordinates("1.2.3", "4.5.6", "7.8.9"), - hermesV1Enabled = true, - ) - - val appForcedModules = appProject.configurations.first().resolutionStrategy.forcedModules - val libForcedModules = libProject.configurations.first().resolutionStrategy.forcedModules - assertThat(appForcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" }) - .isTrue() - assertThat(appForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" }) - .isTrue() - assertThat(libForcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" }) - .isTrue() - assertThat(libForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" }) .isTrue() } @Test - fun configureDependencies_withVersionStringAndGroupString_appliesOnAllProjects_withClassicHermes() { + fun configureDependencies_withVersionStringAndGroupString_appliesOnAllProjects() { val rootProject = ProjectBuilder.builder().build() val appProject = ProjectBuilder.builder().withName("app").withParent(rootProject).build() val libProject = ProjectBuilder.builder().withName("lib").withParent(rootProject).build() @@ -393,7 +344,6 @@ class DependencyUtilsTest { DependencyUtils.Coordinates( "1.2.3", "4.5.6", - "7.8.9", "io.github.test", "io.github.test.hermes", ), @@ -406,63 +356,19 @@ class DependencyUtilsTest { assertThat( appForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" } ) - .isFalse() - assertThat( - appForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:7.8.9" } - ) .isTrue() assertThat(libForcedModules.any { it.toString() == "io.github.test:react-android:1.2.3" }) .isTrue() assertThat( libForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" } ) - .isFalse() - assertThat( - libForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:7.8.9" } - ) - .isTrue() - } - - @Test - fun configureDependencies_withVersionStringAndGroupString_appliesOnAllProjects_withHermesV1() { - val rootProject = ProjectBuilder.builder().build() - val appProject = ProjectBuilder.builder().withName("app").withParent(rootProject).build() - val libProject = ProjectBuilder.builder().withName("lib").withParent(rootProject).build() - appProject.plugins.apply("com.android.application") - libProject.plugins.apply("com.android.library") - - configureDependencies( - appProject, - DependencyUtils.Coordinates( - "1.2.3", - "4.5.6", - "7.8.9", - "io.github.test", - "io.github.test.hermes", - ), - hermesV1Enabled = true, - ) - - val appForcedModules = appProject.configurations.first().resolutionStrategy.forcedModules - val libForcedModules = libProject.configurations.first().resolutionStrategy.forcedModules - assertThat(appForcedModules.any { it.toString() == "io.github.test:react-android:1.2.3" }) - .isTrue() - assertThat( - appForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:7.8.9" } - ) - .isTrue() - assertThat(libForcedModules.any { it.toString() == "io.github.test:react-android:1.2.3" }) - .isTrue() - assertThat( - libForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:7.8.9" } - ) .isTrue() } @Test - fun getDependencySubstitutions_withDefaultGroup_substitutesCorrectly_withHermesV1() { + fun getDependencySubstitutions_withDefaultGroup_substitutesCorrectly() { val dependencySubstitutions = - getDependencySubstitutions(DependencyUtils.Coordinates("0.42.0", "0.42.0", "0.43.0")) + getDependencySubstitutions(DependencyUtils.Coordinates("0.42.0", "0.42.0")) assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first) assertThat("com.facebook.react:react-android:0.42.0") @@ -472,7 +378,7 @@ class DependencyUtilsTest { ) .isEqualTo(dependencySubstitutions[0].third) assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first) - assertThat("com.facebook.hermes:hermes-android:0.43.0") + assertThat("com.facebook.hermes:hermes-android:0.42.0") .isEqualTo(dependencySubstitutions[1].second) assertThat( "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210." @@ -481,85 +387,17 @@ class DependencyUtilsTest { } @Test - fun getDependencySubstitutions_withDefaultGroupAndFallback_substitutesCorrectly_withClassicHermes() { - val dependencySubstitutions = - getDependencySubstitutions( - DependencyUtils.Coordinates("0.42.0", "0.42.0", "0.43.0"), - hermesV1Enabled = true, - ) - - assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first) - assertThat("com.facebook.react:react-android:0.42.0") - .isEqualTo(dependencySubstitutions[0].second) - assertThat( - "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210." - ) - .isEqualTo(dependencySubstitutions[0].third) - assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first) - assertThat("com.facebook.hermes:hermes-android:0.43.0") - .isEqualTo(dependencySubstitutions[1].second) - assertThat( - "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210." - ) - .isEqualTo(dependencySubstitutions[1].third) - } - - @Test - fun getDependencySubstitutions_withCustomGroup_substitutesCorrectly_withHermesV1() { + fun getDependencySubstitutions_withCustomGroup_substitutesCorrectly() { val dependencySubstitutions = getDependencySubstitutions( DependencyUtils.Coordinates( "0.42.0", "0.42.0", - "0.43.0", "io.github.test", "io.github.test.hermes", ) ) - assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first) - assertThat("io.github.test:react-android:0.42.0").isEqualTo(dependencySubstitutions[0].second) - assertThat( - "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210." - ) - .isEqualTo(dependencySubstitutions[0].third) - assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first) - assertThat("io.github.test.hermes:hermes-android:0.43.0") - .isEqualTo(dependencySubstitutions[1].second) - assertThat( - "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210." - ) - .isEqualTo(dependencySubstitutions[1].third) - assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[2].first) - assertThat("io.github.test.hermes:hermes-android:0.43.0") - .isEqualTo(dependencySubstitutions[2].second) - assertThat("The hermes-android artifact was moved to com.facebook.hermes publishing group.") - .isEqualTo(dependencySubstitutions[2].third) - assertThat("com.facebook.react:react-android").isEqualTo(dependencySubstitutions[3].first) - assertThat("io.github.test:react-android:0.42.0").isEqualTo(dependencySubstitutions[3].second) - assertThat("The react-android dependency was modified to use the correct Maven group.") - .isEqualTo(dependencySubstitutions[3].third) - assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[4].first) - assertThat("io.github.test.hermes:hermes-android:0.43.0") - .isEqualTo(dependencySubstitutions[4].second) - assertThat("The hermes-android dependency was modified to use the correct Maven group.") - .isEqualTo(dependencySubstitutions[4].third) - } - - @Test - fun getDependencySubstitutions_withCustomGroupAndFallbackToClassicHermes_substitutesCorrectly_withClassicHermes() { - val dependencySubstitutions = - getDependencySubstitutions( - DependencyUtils.Coordinates( - "0.42.0", - "0.42.0", - "0.43.0", - "io.github.test", - "io.github.test.hermes", - ), - hermesV1Enabled = false, - ) - assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first) assertThat("io.github.test:react-android:0.42.0").isEqualTo(dependencySubstitutions[0].second) assertThat( @@ -607,7 +445,6 @@ class DependencyUtilsTest { writeText( """ HERMES_VERSION_NAME=1000.0.0 - HERMES_V1_VERSION_NAME=1000.0.0 ANOTHER_PROPERTY=true """ .trimIndent() @@ -618,11 +455,9 @@ class DependencyUtilsTest { val strings = readVersionAndGroupStrings(project, propertiesFile, hermesVersionFile) val versionString = strings.versionString val hermesVersionString = strings.hermesVersionString - val hermesV1VersionString = strings.hermesV1VersionString assertThat(versionString).isEqualTo("1000.0.0") assertThat(hermesVersionString).isEqualTo("1000.0.0") - assertThat(hermesV1VersionString).isEqualTo("1000.0.0") } @Test @@ -633,7 +468,6 @@ class DependencyUtilsTest { """ VERSION_NAME=0.0.0-20221101-2019-cfe811ab1 HERMES_VERSION_NAME=0.12.0-commitly-20221101-2019-cfe811ab1 - HERMES_V1_VERSION_NAME=250829098.0.0-stable ANOTHER_PROPERTY=true """ .trimIndent() @@ -645,7 +479,6 @@ class DependencyUtilsTest { writeText( """ HERMES_VERSION_NAME=0.14.0 - HERMES_V1_VERSION_NAME=250829098.0.0-stable ANOTHER_PROPERTY=true """ .trimIndent() @@ -656,11 +489,9 @@ class DependencyUtilsTest { val strings = readVersionAndGroupStrings(project, propertiesFile, hermesVersionFile) val versionString = strings.versionString val hermesVersionString = strings.hermesVersionString - val hermesV1VersionString = strings.hermesV1VersionString assertThat(versionString).isEqualTo("0.0.0-20221101-2019-cfe811ab1-SNAPSHOT") assertThat(hermesVersionString).isEqualTo("0.14.0") - assertThat(hermesV1VersionString).isEqualTo("250829098.0.0-stable") } @Test @@ -689,10 +520,8 @@ class DependencyUtilsTest { val strings = readVersionAndGroupStrings(project, propertiesFile, hermesVersionFile) val versionString = strings.versionString val hermesVersionString = strings.hermesVersionString - val hermesV1VersionString = strings.hermesV1VersionString assertThat(versionString).isEqualTo("") assertThat(hermesVersionString).isEqualTo("") - assertThat(hermesV1VersionString).isEqualTo("") } @Test @@ -713,7 +542,6 @@ class DependencyUtilsTest { writeText( """ HERMES_VERSION_NAME= - HERMES_V1_VERSION_NAME= ANOTHER_PROPERTY=true """ .trimIndent() @@ -724,10 +552,8 @@ class DependencyUtilsTest { val strings = readVersionAndGroupStrings(project, propertiesFile, hermesVersionFile) val versionString = strings.versionString val hermesVersionString = strings.hermesVersionString - val hermesV1VersionString = strings.hermesV1VersionString assertThat(versionString).isEqualTo("") assertThat(hermesVersionString).isEqualTo("") - assertThat(hermesV1VersionString).isEqualTo("") } @Test @@ -749,7 +575,6 @@ class DependencyUtilsTest { writeText( """ HERMES_VERSION_NAME= - HERMES_V1_VERSION_NAME= ANOTHER_PROPERTY=true """ .trimIndent() @@ -782,7 +607,6 @@ class DependencyUtilsTest { writeText( """ HERMES_VERSION_NAME= - HERMES_V1_VERSION_NAME= ANOTHER_PROPERTY=true """ .trimIndent() diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt index f4ec2a40acf7..54a3016e9616 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt @@ -14,7 +14,6 @@ import com.facebook.react.tests.createProject import com.facebook.react.utils.ProjectUtils.getReactNativeArchitectures import com.facebook.react.utils.ProjectUtils.isEdgeToEdgeEnabled import com.facebook.react.utils.ProjectUtils.isHermesEnabled -import com.facebook.react.utils.ProjectUtils.isHermesV1Enabled import com.facebook.react.utils.ProjectUtils.isNewArchEnabled import com.facebook.react.utils.ProjectUtils.needsCodegenFromPackageJson import java.io.File @@ -116,32 +115,6 @@ class ProjectUtilsTest { assertThat(project.isEdgeToEdgeEnabled).isFalse() } - @Test - fun isHermesV1Enabled_returnsTrueByDefault() { - assertThat(createProject().isHermesV1Enabled).isTrue() - } - - @Test - fun isHermesV1Enabled_withDisabledViaProperty_returnsFalse() { - val project = createProject() - project.extensions.extraProperties.set("hermesV1Enabled", "false") - assertThat(project.isHermesV1Enabled).isFalse() - } - - @Test - fun isHermesV1Enabled_withEnabledViaProperty_returnsTrue() { - val project = createProject() - project.extensions.extraProperties.set("hermesV1Enabled", "true") - assertThat(project.isHermesV1Enabled).isTrue() - } - - @Test - fun isHermesV1Enabled_withInvalidViaProperty_returnsFalse() { - val project = createProject() - project.extensions.extraProperties.set("hermesV1Enabled", "ĀÆ\\_(惄)_/ĀÆ") - assertThat(project.isHermesV1Enabled).isFalse() - } - @Test fun needsCodegenFromPackageJson_withCodegenConfigInPackageJson_returnsTrue() { val project = createProject() diff --git a/packages/react-native/ReactAndroid/build.gradle.kts b/packages/react-native/ReactAndroid/build.gradle.kts index 99e05410f8c1..b0136db3c8f5 100644 --- a/packages/react-native/ReactAndroid/build.gradle.kts +++ b/packages/react-native/ReactAndroid/build.gradle.kts @@ -39,9 +39,6 @@ val downloadsDir = val thirdPartyNdkDir = File("$buildDir/third-party-ndk") val reactNativeRootDir = projectDir.parent -val hermesV1Enabled = - rootProject.extensions.getByType(PrivateReactExtension::class.java).hermesV1Enabled.get() - // We put the publishing version from gradle.properties inside ext. so other // subprojects can access it as well. extra["publishing_version"] = project.findProperty("VERSION_NAME")?.toString()!! @@ -583,10 +580,6 @@ android { "-DCMAKE_POLICY_DEFAULT_CMP0069=NEW", ) - if (hermesV1Enabled) { - arguments("-DHERMES_V1_ENABLED=1") - } - targets( "reactnative", "jsi", diff --git a/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts b/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts index faf4e4f9d1ff..18731ccdfec9 100644 --- a/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts +++ b/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts @@ -50,8 +50,6 @@ fun getSDKManagerPath(): String { } } -val hermesV1Enabled = - rootProject.extensions.getByType(PrivateReactExtension::class.java).hermesV1Enabled.get() val reactNativeRootDir = project(":packages:react-native:ReactAndroid").projectDir.parent val customDownloadDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR") val downloadsDir = @@ -82,11 +80,11 @@ val hermesBuildOutputFileTree = .include("**/*.cmake", "**/*.marks", "**/compiler_depends.ts", "**/Makefile", "**/link.txt") val hermesVersionProvider: Provider = providers.provider { - var hermesVersion = if (hermesV1Enabled) "250829098.0.0-stable" else "main" + var hermesVersion = "250829098.0.0-stable" val hermesVersionFile = File( reactNativeRootDir, - if (hermesV1Enabled) "sdks/.hermesv1version" else "sdks/.hermesversion", + "sdks/.hermesversion", ) if (hermesVersionFile.exists()) { @@ -172,9 +170,7 @@ fun configureBuildForHermesCommandLineArgs( if (Os.isFamily(Os.FAMILY_WINDOWS)) { cmakeCommandLine = cmakeCommandLine + "-GNMake Makefiles" } - if (hermesV1Enabled) { - cmakeCommandLine = cmakeCommandLine + "-DHERMESVM_HEAP_HV_MODE=HEAP_HV_PREFER32" - } + cmakeCommandLine = cmakeCommandLine + "-DHERMESVM_HEAP_HV_MODE=HEAP_HV_PREFER32" return cmakeCommandLine } @@ -358,9 +354,7 @@ android { "-DHERMES_ENABLE_INTL=True", ) - if (hermesV1Enabled) { - arguments("-DHERMESVM_HEAP_HV_MODE=HEAP_HV_PREFER32") - } + arguments("-DHERMESVM_HEAP_HV_MODE=HEAP_HV_PREFER32") targets("hermesvm") } diff --git a/packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt b/packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt index 01742cce7f07..13300ea8f8b7 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt +++ b/packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt @@ -22,8 +22,6 @@ file(TO_CMAKE_PATH "${REACT_ANDROID_DIR}" REACT_ANDROID_DIR) file(TO_CMAKE_PATH "${REACT_BUILD_DIR}" REACT_BUILD_DIR) file(TO_CMAKE_PATH "${REACT_COMMON_DIR}" REACT_COMMON_DIR) -set(HERMES_V1_ENABLED OFF CACHE BOOL "Build with support for Hermes v1") - # If you have ccache installed, we're going to honor it. find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) diff --git a/packages/react-native/ReactCommon/cmake-utils/react-native-flags.cmake b/packages/react-native/ReactCommon/cmake-utils/react-native-flags.cmake index b8a420af216d..d005a4e0b0d8 100644 --- a/packages/react-native/ReactCommon/cmake-utils/react-native-flags.cmake +++ b/packages/react-native/ReactCommon/cmake-utils/react-native-flags.cmake @@ -32,7 +32,4 @@ function(target_compile_reactnative_options target_name scope) if(ANDROID) target_compile_definitions(${target_name} ${scope} RN_SERIALIZABLE_STATE) endif() - if(HERMES_V1_ENABLED) - target_compile_definitions(${target_name} ${scope} HERMES_V1_ENABLED=1) - endif() endfunction() diff --git a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp index d83803fc4274..23ceb3f8f58f 100644 --- a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +++ b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp @@ -17,11 +17,6 @@ #include -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) -#include -#include -#endif - using namespace facebook::hermes; using namespace facebook::jsi; @@ -29,43 +24,6 @@ namespace facebook::react { namespace { -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - -class HermesExecutorRuntimeAdapter - : public facebook::hermes::inspector_modern::RuntimeAdapter { - public: - HermesExecutorRuntimeAdapter( - std::shared_ptr runtime, - std::shared_ptr thread) - : runtime_(runtime), thread_(std::move(thread)) {} - - virtual ~HermesExecutorRuntimeAdapter() = default; - - HermesRuntime& getRuntime() override { - return *runtime_; - } - - void tickleJs() override { - thread_->runOnQueue( - [weakRuntime = std::weak_ptr(runtime_)]() { - auto runtime = weakRuntime.lock(); - if (!runtime) { - return; - } - jsi::Function func = - runtime->global().getPropertyAsFunction(*runtime, "__tickleJs"); - func.call(*runtime); - }); - } - - private: - std::shared_ptr runtime_; - - std::shared_ptr thread_; -}; - -#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - struct ReentrancyCheck { // This is effectively a very subtle and complex assert, so only // include it in builds which would include asserts. @@ -149,26 +107,13 @@ class DecoratedRuntime : public jsi::WithRuntimeDecorator { const std::string& debuggerName) : jsi::WithRuntimeDecorator(*runtime, reentrancyCheck_), runtime_(std::move(runtime)) { -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - enableDebugger_ = enableDebugger; - if (enableDebugger_) { - std::shared_ptr rt(runtime_, &hermesRuntime); - auto adapter = - std::make_unique(rt, jsQueue); - debugToken_ = facebook::hermes::inspector_modern::chrome::enableDebugging( - std::move(adapter), debuggerName); - } -#else + (void)hermesRuntime; (void)jsQueue; -#endif // HERMES_ENABLE_DEBUGGER + (void)enableDebugger; + (void)debuggerName; } ~DecoratedRuntime() { -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - if (enableDebugger_) { - facebook::hermes::inspector_modern::chrome::disableDebugging(debugToken_); - } -#endif // HERMES_ENABLE_DEBUGGER } private: @@ -181,10 +126,6 @@ class DecoratedRuntime : public jsi::WithRuntimeDecorator { std::shared_ptr runtime_; ReentrancyCheck reentrancyCheck_; -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - bool enableDebugger_; - facebook::hermes::inspector_modern::chrome::DebugSessionToken debugToken_; -#endif // HERMES_ENABLE_DEBUGGER }; } // namespace diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp deleted file mode 100644 index ad07660ae18c..000000000000 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ConnectionDemux.h" - -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - -#include -#include - -#include - -#include - -namespace facebook::hermes::inspector_modern::chrome { - -using ::facebook::react::jsinspector_modern::ILocalConnection; -using ::facebook::react::jsinspector_modern::IRemoteConnection; - -namespace { - -class LocalConnection : public ILocalConnection { - public: - LocalConnection( - std::shared_ptr conn, - std::shared_ptr> inspectedContexts); - ~LocalConnection() override; - - void sendMessage(std::string message) override; - void disconnect() override; - - private: - std::shared_ptr conn_; - std::shared_ptr> inspectedContexts_; -}; - -LocalConnection::LocalConnection( - std::shared_ptr conn, - std::shared_ptr> inspectedContexts) - : conn_(conn), inspectedContexts_(std::move(inspectedContexts)) { - inspectedContexts_->insert(conn->getTitle()); -} - -LocalConnection::~LocalConnection() = default; - -void LocalConnection::sendMessage(std::string message) { - conn_->handle(std::move(message)); -} - -void LocalConnection::disconnect() { - inspectedContexts_->erase(conn_->getTitle()); - conn_->unregisterCallbacks(); -} - -} // namespace - -ConnectionDemux::ConnectionDemux( - facebook::react::jsinspector_modern::IInspector& inspector) - : globalInspector_(inspector), - inspectedContexts_(std::make_shared>()) {} - -ConnectionDemux::~ConnectionDemux() = default; - -DebugSessionToken ConnectionDemux::enableDebugging( - std::unique_ptr adapter, - const std::string& title) { - std::scoped_lock lock(mutex_); - - // TODO(#22976087): workaround for ComponentScript contexts never being - // destroyed. - // - // After a reload, the old ComponentScript VM instance stays alive. When we - // register the new CS VM instance, check for any previous CS VM (via strcmp - // of title) and remove them. - std::vector pagesToDelete; - for (auto& conn : conns_) { - if (conn.second->getTitle() == title) { - pagesToDelete.push_back(conn.first); - } - } - - for (auto pageId : pagesToDelete) { - removePage(pageId); - } - - auto waitForDebugger = - (inspectedContexts_->find(title) != inspectedContexts_->end()); - return addPage( - hermes::inspector_modern::chrome::CDPHandler::create( - std::move(adapter), title, waitForDebugger)); -} - -void ConnectionDemux::disableDebugging(DebugSessionToken session) { - std::scoped_lock lock(mutex_); - if (conns_.find(session) == conns_.end()) { - return; - } - removePage(session); -} - -int ConnectionDemux::addPage( - std::shared_ptr conn) { - auto connectFunc = [conn, this](std::unique_ptr remoteConn) - -> std::unique_ptr { - // This cannot be unique_ptr as std::function is copyable but unique_ptr - // isn't. TODO: Change the CDPHandler API to accommodate this and not - // require a copyable callback? - std::shared_ptr sharedConn = std::move(remoteConn); - if (!conn->registerCallbacks( - [sharedConn](const std::string& message) { - sharedConn->onMessage(message); - }, - [sharedConn]() { sharedConn->onDisconnect(); })) { - return nullptr; - } - - return std::make_unique(conn, inspectedContexts_); - }; - - int pageId = globalInspector_.addPage( - conn->getTitle(), "Hermes", std::move(connectFunc)); - conns_[pageId] = std::move(conn); - - return pageId; -} - -void ConnectionDemux::removePage(int pageId) { - globalInspector_.removePage(pageId); - - auto conn = conns_.at(pageId); - std::string title = conn->getTitle(); - inspectedContexts_->erase(title); - conn->unregisterCallbacks(); - conns_.erase(pageId); -} - -} // namespace facebook::hermes::inspector_modern::chrome - -#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h deleted file mode 100644 index cc8dae74f8a4..000000000000 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace facebook::hermes::inspector_modern::chrome { - -/* - * ConnectionDemux keeps track of all debuggable Hermes runtimes (called - * "pages" in the higher-level React Native API) in this process. See - * Registration.h for documentation of the public API. - */ -class ConnectionDemux { - public: - explicit ConnectionDemux(facebook::react::jsinspector_modern::IInspector &inspector); - ~ConnectionDemux(); - - ConnectionDemux(const ConnectionDemux &) = delete; - ConnectionDemux &operator=(const ConnectionDemux &) = delete; - - DebugSessionToken enableDebugging(std::unique_ptr adapter, const std::string &title); - void disableDebugging(DebugSessionToken session); - - private: - int addPage(std::shared_ptr conn); - void removePage(int pageId); - - facebook::react::jsinspector_modern::IInspector &globalInspector_; - - std::mutex mutex_; - std::unordered_map> conns_; - std::shared_ptr> inspectedContexts_; -}; - -} // namespace facebook::hermes::inspector_modern::chrome - -#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp deleted file mode 100644 index 3274cba4f592..000000000000 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "Registration.h" -#include "ConnectionDemux.h" - -#if defined(HERMES_ENABLE_DEBUGGER) - -#include - -#if !defined(HERMES_V1_ENABLED) - -namespace facebook::hermes::inspector_modern::chrome { -namespace { - -ConnectionDemux& demux() { - static ConnectionDemux instance{ - facebook::react::jsinspector_modern::getInspectorInstance()}; - return instance; -} - -} // namespace - -DebugSessionToken enableDebugging( - std::unique_ptr adapter, - const std::string& title) { - return demux().enableDebugging(std::move(adapter), title); -} - -void disableDebugging(DebugSessionToken session) { - demux().disableDebugging(session); -} - -} // namespace facebook::hermes::inspector_modern::chrome - -#else - -namespace facebook::hermes::inspector_modern { -class RuntimeAdapter { - // Backwards compatibility definition fallback for libraries that are compiled - // without `HERMES_V1_ENABLED` but are linked against React Native with - // `HERMES_V1_ENABLED` which doesn't provide this symbol. - public: - virtual ~RuntimeAdapter() = 0; - virtual HermesRuntime& getRuntime() = 0; - virtual void tickleJs(); -}; - -namespace chrome { - -using DebugSessionToken = int; - -DebugSessionToken enableDebugging( - std::unique_ptr, - const std::string&) { - // Backwards compatibility fallback for libraries that are compiled without - // `HERMES_V1_ENABLED` but are linked against React Native with - // `HERMES_V1_ENABLED` which doesn't provide this symbol. - return -1; -}; - -void disableDebugging(DebugSessionToken) { - // Backwards compatibility fallback for libraries that are compiled without - // `HERMES_V1_ENABLED` but are linked against React Native with - // `HERMES_V1_ENABLED` which doesn't provide this symbol. -} - -} // namespace chrome - -} // namespace facebook::hermes::inspector_modern - -#endif // !defined(HERMES_V1_ENABLED) - -#endif // defined(HERMES_ENABLE_DEBUGGER) diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.h b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.h deleted file mode 100644 index 2b60c27a6ee6..000000000000 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - -#include -#include - -#include -#include - -namespace facebook::hermes::inspector_modern::chrome { - -using DebugSessionToken = int; - -/* - * enableDebugging adds this runtime to the list of debuggable JS targets - * (called "pages" in the higher-level React Native API) in this process. It - * should be called before any JS runs in the runtime. The returned token - * can be used to disable debugging for this runtime. - */ -extern DebugSessionToken enableDebugging(std::unique_ptr adapter, const std::string &title); - -/* - * disableDebugging removes this runtime from the list of debuggable JS targets - * in this process. The runtime to remove is identified by the token returned - * from enableDebugging. - */ -extern void disableDebugging(DebugSessionToken session); - -} // namespace facebook::hermes::inspector_modern::chrome - -#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/tests/ConnectionDemuxTests.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/tests/ConnectionDemuxTests.cpp deleted file mode 100644 index 0e652e207b18..000000000000 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/tests/ConnectionDemuxTests.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace facebook { -namespace hermes { -namespace inspector_modern { -namespace chrome { - -using ::facebook::react::jsinspector_modern::IInspector; -using ::facebook::react::jsinspector_modern::InspectorPageDescription; -using ::facebook::react::jsinspector_modern::IRemoteConnection; - -namespace { - -std::unordered_map makePageMap( - const std::vector& pages) { - std::unordered_map pageMap; - - for (auto& page : pages) { - pageMap[page.id] = page.title; - } - - return pageMap; -} - -void expectPages( - IInspector& inspector, - const std::unordered_map& expected) { - auto pages = makePageMap(inspector.getPages()); - EXPECT_EQ(pages, expected); -} - -class TestRemoteConnection : public IRemoteConnection { - public: - class Data { - public: - void expectDisconnected() { - std::unique_lock lock(mutex_); - cv_.wait_for( - lock, std::chrono::milliseconds(2500), [&] { return !connected_; }); - EXPECT_FALSE(connected_); - } - - void setDisconnected() { - std::scoped_lock lock(mutex_); - connected_ = false; - cv_.notify_one(); - } - - private: - std::mutex mutex_; - std::condition_variable cv_; - bool connected_{true}; - }; - - TestRemoteConnection() : data_(std::make_shared()) {} - ~TestRemoteConnection() {} - - void onMessage(std::string message) override {} - - void onDisconnect() override { - data_->setDisconnected(); - } - - std::shared_ptr getData() { - return data_; - } - - private: - std::shared_ptr data_; -}; - -}; // namespace - -TEST(ConnectionDemuxTests, TestEnableDisable) { - std::shared_ptr runtime1( - facebook::hermes::makeHermesRuntime()); - std::shared_ptr runtime2( - facebook::hermes::makeHermesRuntime()); - auto inspector = - facebook::react::jsinspector_modern::makeTestInspectorInstance(); - - ConnectionDemux demux{*inspector}; - - int id1 = demux.enableDebugging( - std::make_unique(runtime1), "page1"); - int id2 = demux.enableDebugging( - std::make_unique(runtime2), "page2"); - - expectPages(*inspector, {{id1, "page1"}, {id2, "page2"}}); - - auto remoteConn1 = std::make_unique(); - auto remoteData1 = remoteConn1->getData(); - auto localConn1 = inspector->connect(id1, std::move(remoteConn1)); - EXPECT_NE(localConn1.get(), nullptr); - - { - // If we connect to the same page id again without disconnecting, we should - // get null - auto remoteConn = std::make_unique(); - auto localConn = inspector->connect(id1, std::move(remoteConn)); - EXPECT_EQ(localConn.get(), nullptr); - } - - auto remoteConn2 = std::make_unique(); - auto remoteData2 = remoteConn2->getData(); - auto localConn2 = inspector->connect(id2, std::move(remoteConn2)); - EXPECT_NE(localConn2.get(), nullptr); - - // Disable debugging on runtime2. This should remove its page from the list - // and call onDisconnect on its remoteConn - demux.disableDebugging(id2); - expectPages(*inspector, {{id1, "page1"}}); - remoteData2->expectDisconnected(); - - // Disconnect conn1. Its page should still be in the page list and - // onDisconnect should be called. - localConn1->disconnect(); - remoteData1->expectDisconnected(); - - { - // Should still be able to reconnect after disconnecting - auto remoteConn = std::make_unique(); - auto localConn = inspector->connect(id1, std::move(remoteConn)); - EXPECT_NE(localConn.get(), nullptr); - } -} - -} // namespace chrome -} // namespace inspector_modern -} // namespace hermes -} // namespace facebook diff --git a/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp b/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp index b308cfd42082..d843a8338aeb 100644 --- a/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp +++ b/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp @@ -12,90 +12,11 @@ #include #include -#ifdef HERMES_ENABLE_DEBUGGER -#include - -#ifndef HERMES_V1_ENABLED -#include -#endif - -#include -#endif - using namespace facebook::hermes; using namespace facebook::jsi; namespace facebook::react { -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - -// Wrapper that strongly retains the HermesRuntime for on device debugging. -// -// HermesInstanceRuntimeAdapter needs to strongly retain the HermesRuntime. Why: -// - facebook::hermes::inspector_modern::chrome::Connection::Impl owns the -// Adapter -// - facebook::hermes::inspector_modern::chrome::Connection::Impl also owns -// jsi:: objects -// - jsi:: objects need to be deleted before the Runtime. -// -// If Adapter doesn't share ownership over jsi::Runtime, the runtime can be -// deleted before Connection::Impl cleans up all its jsi:: Objects. This will -// lead to a runtime crash. -class HermesInstanceRuntimeAdapter : public inspector_modern::RuntimeAdapter { - public: - HermesInstanceRuntimeAdapter( - std::shared_ptr hermesRuntime, - std::shared_ptr msgQueueThread) - : hermesRuntime_(std::move(hermesRuntime)), - messageQueueThread_(std::move(msgQueueThread)) {} - virtual ~HermesInstanceRuntimeAdapter() = default; - - HermesRuntime& getRuntime() override { - return *hermesRuntime_; - } - - void tickleJs() override { - std::weak_ptr weakRuntime(hermesRuntime_); - messageQueueThread_->runOnQueue([weakRuntime]() { - auto runtime = weakRuntime.lock(); - if (!runtime) { - return; - } - jsi::Function func = - runtime->global().getPropertyAsFunction(*runtime, "__tickleJs"); - func.call(*runtime); - }); - } - - private: - std::shared_ptr hermesRuntime_; - std::shared_ptr messageQueueThread_; -}; - -class DecoratedRuntime : public jsi::RuntimeDecorator { - public: - DecoratedRuntime( - std::unique_ptr runtime, - std::shared_ptr msgQueueThread) - : RuntimeDecorator(*runtime), runtime_(std::move(runtime)) { - auto adapter = std::make_unique( - runtime_, msgQueueThread); - - debugToken_ = inspector_modern::chrome::enableDebugging( - std::move(adapter), "Hermes Bridgeless React Native"); - } - - ~DecoratedRuntime() { - inspector_modern::chrome::disableDebugging(debugToken_); - } - - private: - std::shared_ptr runtime_; - inspector_modern::chrome::DebugSessionToken debugToken_; -}; - -#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - class HermesJSRuntime : public JSRuntime { public: HermesJSRuntime( @@ -164,17 +85,7 @@ std::unique_ptr HermesInstance::createJSRuntime( .getPropertyAsObject(*hermesRuntime, "prototype"); errorPrototype.setProperty(*hermesRuntime, "jsEngine", "hermes"); -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) - auto& inspectorFlags = jsinspector_modern::InspectorFlags::getInstance(); - if (!inspectorFlags.getFuseboxEnabled()) { - std::unique_ptr decoratedRuntime = - std::make_unique( - std::move(hermesRuntime), msgQueueThread); - return std::make_unique(std::move(decoratedRuntime)); - } -#else (void)msgQueueThread; -#endif HermesRuntime& hermesRuntimeRef = *hermesRuntime; return std::make_unique( diff --git a/packages/react-native/package.json b/packages/react-native/package.json index e2e40fb75c77..d4a380df1fd9 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -128,7 +128,6 @@ "scripts/xcode/ccache.conf", "scripts/xcode/with-environment.sh", "sdks/.hermesversion", - "sdks/.hermesv1version", "sdks/hermes-engine", "sdks/hermesc", "settings.gradle.kts", @@ -176,7 +175,7 @@ "base64-js": "^1.5.1", "commander": "^12.0.0", "flow-enums-runtime": "^0.0.6", - "hermes-compiler": "0.0.0", + "hermes-compiler": "250829098.0.13", "invariant": "^2.2.4", "memoize-one": "^5.0.0", "metro-runtime": "^0.84.3", diff --git a/packages/react-native/scripts/cocoapods/jsengine.rb b/packages/react-native/scripts/cocoapods/jsengine.rb index a15c92897bb0..fd825c16a8af 100644 --- a/packages/react-native/scripts/cocoapods/jsengine.rb +++ b/packages/react-native/scripts/cocoapods/jsengine.rb @@ -13,7 +13,7 @@ def setup_hermes!(react_native_path: "../node_modules/react-native") react_native_dir = Pod::Config.instance.installation_root.join(react_native_path) # This `:tag => hermestag` below is only to tell CocoaPods to update hermes-engine when React Native version changes. # We have custom logic to compute the source for hermes-engine. See sdks/hermes-engine/* - hermestag_file_name = ENV['RCT_HERMES_V1_ENABLED'] == "1" ? ".hermesv1version" : ".hermesversion" + hermestag_file_name = ".hermesversion" hermestag_file = File.join(react_native_dir, "sdks", hermestag_file_name) hermestag = File.exist?(hermestag_file) ? File.read(hermestag_file).strip : '' pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes-engine/hermes-engine.podspec", :tag => hermestag diff --git a/packages/react-native/scripts/cocoapods/utils.rb b/packages/react-native/scripts/cocoapods/utils.rb index c31332b9e6c4..971af7afbc71 100644 --- a/packages/react-native/scripts/cocoapods/utils.rb +++ b/packages/react-native/scripts/cocoapods/utils.rb @@ -45,13 +45,8 @@ def self.has_pod(installer, name) end def self.set_gcc_preprocessor_definition_for_React_hermes(installer) - if ENV['RCT_HERMES_V1_ENABLED'] == "1" - self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-hermes", :debug) - self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-RuntimeHermes", :debug) - else - self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes", :debug) - self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes", :debug) - end + self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes", :debug) + self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes", :debug) self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "hermes-engine", :debug) end diff --git a/packages/react-native/scripts/hermes/__tests__/hermes-utils-test.js b/packages/react-native/scripts/hermes/__tests__/hermes-utils-test.js index 510000e27afb..573ad18914cd 100644 --- a/packages/react-native/scripts/hermes/__tests__/hermes-utils-test.js +++ b/packages/react-native/scripts/hermes/__tests__/hermes-utils-test.js @@ -10,17 +10,12 @@ import * as path from 'path'; -const { - readHermesTag, - readHermesV1Tag, - setHermesTag, -} = require('../hermes-utils'); +const {readHermesTag, setHermesTag} = require('../hermes-utils'); // $FlowFixMe[untyped-import] (OSS) memfs const {memfs} = require('memfs'); const hermesTag = 'hermes-2022-04-28-RNv0.69.0-15d07c2edd29a4ea0b8f15ab0588a0c1adb1200f'; -const hermesV1Tag = '250829098.0.0'; const ROOT_DIR = path.normalize(path.join(__dirname, '../../..')); const SDKS_DIR = path.join(ROOT_DIR, 'sdks'); @@ -61,45 +56,19 @@ describe('hermes-utils', () => { }); }); - describe('readHermesV1Tag', () => { - it('should throw if .hermesv1version does not exist', () => { - expect(() => { - readHermesV1Tag(); - }).toThrow('[Hermes] .hermesv1version does not exist.'); - }); - it('should fail if hermes v1 tag is empty', () => { - fs.writeFileSync(path.join(SDKS_DIR, '.hermesv1version'), ''); - expect(() => { - readHermesV1Tag(); - }).toThrow('[Hermes] .hermesv1version file is empty.'); - }); - it('should return tag from .hermesv1version if file exists', () => { - fs.writeFileSync(path.join(SDKS_DIR, '.hermesv1version'), hermesV1Tag); - expect(readHermesV1Tag()).toEqual(hermesV1Tag); - }); - }); - describe('setHermesTag', () => { it('should write tag to .hermesversion file', async () => { - await setHermesTag(hermesTag, hermesV1Tag); + await setHermesTag(hermesTag); expect( fs.readFileSync(path.join(SDKS_DIR, '.hermesversion'), { encoding: 'utf8', flag: 'r', }), ).toEqual(hermesTag); - - expect( - fs.readFileSync(path.join(SDKS_DIR, '.hermesv1version'), { - encoding: 'utf8', - flag: 'r', - }), - ).toEqual(hermesV1Tag); }); it('should set Hermes tag and read it back', async () => { - await setHermesTag(hermesTag, hermesV1Tag); + await setHermesTag(hermesTag); expect(readHermesTag()).toEqual(hermesTag); - expect(readHermesV1Tag()).toEqual(hermesV1Tag); }); }); }); diff --git a/packages/react-native/scripts/hermes/bump-hermes-version.js b/packages/react-native/scripts/hermes/bump-hermes-version.js index 5ced0536e3fe..9001d966b7f1 100755 --- a/packages/react-native/scripts/hermes/bump-hermes-version.js +++ b/packages/react-native/scripts/hermes/bump-hermes-version.js @@ -32,13 +32,7 @@ let argv = yargs .option('t', { alias: 'tag', describe: - 'Hermes release tag to use for this React Native release, ex. hermes-2022-02-21-RNv0.68.0. This tag will be used when building Hermes from source.', - required: true, - }) - .option('s', { - alias: 'v1-tag', - describe: - 'Hermes V1 release tag to use for this React Native release, ex. 250829098.0.0. This tag will be used when building Hermes V1 from source.', + 'Hermes release tag to use for this React Native release, ex. 250829098.0.0. This tag will be used when building Hermes from source.', required: true, }) .option('h', { @@ -46,39 +40,19 @@ let argv = yargs describe: 'Hermes version to use for this React Native release, ex. 250829098.0.0. This version will be used when consuming Hermes from a prebuilt package.', required: false, - }) - .option('v', { - alias: 'hermes-v1-version', - describe: - 'Hermes V1 version to use for this React Native release, ex. 250829098.0.0. This version will be used when consuming Hermes V1 from a prebuilt package.', - required: false, }).argv; async function main() { // $FlowFixMe[prop-missing] const hermesTag = argv.tag; // $FlowFixMe[prop-missing] - const hermesV1Tag = argv['v1-tag']; - // $FlowFixMe[prop-missing] let hermesVersion = argv['hermes-version']; - // $FlowFixMe[prop-missing] - let hermesV1Version = argv['hermes-v1-version']; if (!hermesVersion) { console.log( 'No Hermes version provided. Fetching the latest version from NPM...', ); hermesVersion = await getPackageVersionStrByTag( - 'hermes-compiler', - 'latest-v0', - ); - } - - if (!hermesV1Version) { - console.log( - 'No Hermes V1 version provided. Fetching the latest version from NPM...', - ); - hermesV1Version = await getPackageVersionStrByTag( 'hermes-compiler', 'latest-v1', ); @@ -87,7 +61,7 @@ async function main() { const {confirmHermesVersions} = await inquirer.prompt({ type: 'confirm', name: 'confirmHermesVersions', - message: `Do you want to use the Hermes version "${hermesVersion}" and Hermes V1 version "${hermesV1Version}" (for prebuilt)?`, + message: `Do you want to use the Hermes version "${hermesVersion}" (for prebuilt)?`, }); if (!confirmHermesVersions) { @@ -98,7 +72,7 @@ async function main() { const {confirmHermesTags} = await inquirer.prompt({ type: 'confirm', name: 'confirmHermesTags', - message: `Do you want to use the Hermes release tagged "${hermesTag}" and Hermes V1 release tagged "${hermesV1Tag}" (for building from source)?`, + message: `Do you want to use the Hermes release tagged "${hermesTag}" (for building from source)?`, }); if (!confirmHermesTags) { @@ -106,10 +80,10 @@ async function main() { return; } - await setHermesTag(hermesTag, hermesV1Tag); + await setHermesTag(hermesTag); - await updateHermesCompilerVersionInDependencies(hermesV1Version); - await updateHermesRuntimeDependenciesVersions(hermesVersion, hermesV1Version); + await updateHermesCompilerVersionInDependencies(hermesVersion); + await updateHermesRuntimeDependenciesVersions(hermesVersion); } void main().then(() => { diff --git a/packages/react-native/scripts/hermes/hermes-utils.js b/packages/react-native/scripts/hermes/hermes-utils.js index 16ee6810b8d5..236f72527a6c 100644 --- a/packages/react-native/scripts/hermes/hermes-utils.js +++ b/packages/react-native/scripts/hermes/hermes-utils.js @@ -21,7 +21,6 @@ type BuildType = 'dry-run' | 'release' | 'nightly'; const SDKS_DIR = path.normalize(path.join(__dirname, '..', '..', 'sdks')); const HERMES_TAG_FILE_PATH = path.join(SDKS_DIR, '.hermesversion'); -const HERMES_V1_TAG_FILE_PATH = path.join(SDKS_DIR, '.hermesv1version'); function readHermesTag() /*: string */ { if (fs.existsSync(HERMES_TAG_FILE_PATH)) { @@ -42,25 +41,6 @@ function readHermesTag() /*: string */ { throw new Error('[Hermes] .hermesversion does not exist.'); } -function readHermesV1Tag() /*: string */ { - if (fs.existsSync(HERMES_V1_TAG_FILE_PATH)) { - const data = fs - .readFileSync(HERMES_V1_TAG_FILE_PATH, { - encoding: 'utf8', - flag: 'r', - }) - .trim(); - - if (data.length > 0) { - return data; - } else { - throw new Error('[Hermes] .hermesv1version file is empty.'); - } - } - - throw new Error('[Hermes] .hermesv1version does not exist.'); -} - async function updateHermesTag( tagFile /*: string */, hermesTag /*: string */, @@ -94,18 +74,15 @@ async function updateHermesTag( async function setHermesTag( hermesTag /*: string */, - hermesV1Tag /*: string */, ) { if (!fs.existsSync(SDKS_DIR)) { fs.mkdirSync(SDKS_DIR, {recursive: true}); } await updateHermesTag(HERMES_TAG_FILE_PATH, hermesTag, 'Hermes'); - await updateHermesTag(HERMES_V1_TAG_FILE_PATH, hermesV1Tag, 'Hermes V1'); } module.exports = { readHermesTag, - readHermesV1Tag, setHermesTag, }; diff --git a/packages/react-native/scripts/hermes/release-hermes-for-branch-cut.js b/packages/react-native/scripts/hermes/release-hermes-for-branch-cut.js index ac1dcb811f46..e16d93f0fbb8 100755 --- a/packages/react-native/scripts/hermes/release-hermes-for-branch-cut.js +++ b/packages/react-native/scripts/hermes/release-hermes-for-branch-cut.js @@ -39,10 +39,8 @@ const argv = yargs const DRY_RUN = argv['dry-run']; const HERMES_REPO_PATH = path.join(os.homedir(), 'git', 'hermes'); -const HERMES_LEGACY_BRANCH = 'main'; -const HERMES_LEGACY_LABEL = 'Hermes Legacy'; -const HERMES_V1_BRANCH = '250829098.0.0-stable'; -const HERMES_V1_LABEL = 'Hermes V1'; +const HERMES_BRANCH = '250829098.0.0-stable'; +const HERMES_LABEL = 'Hermes'; const RN_REPO_ROOT = path.resolve(__dirname, '..', '..', '..', '..'); async function releaseHermesForBranchCut() /*: Promise */ { @@ -98,20 +96,16 @@ async function releaseHermesForBranchCut() /*: Promise */ { exit(1); } - // Step 3: Get versions from Hermes - console.log('\nšŸ“„ Fetching Hermes versions...'); + // Step 3: Get version from Hermes + console.log('\nšŸ“„ Fetching Hermes version...'); - const legacyHermesVersion = fetchHermesVersion( - HERMES_LEGACY_BRANCH, - HERMES_LEGACY_LABEL, - ); - const v1HermesVersion = fetchHermesVersion(HERMES_V1_BRANCH, HERMES_V1_LABEL); + const hermesVersion = fetchHermesVersion(HERMES_BRANCH, HERMES_LABEL); console.log(''); const {confirmVersions} = await inquirer.prompt({ type: 'confirm', name: 'confirmVersions', - message: `Double-check the Hermes versions above. Do you want to proceed?`, + message: `Double-check the Hermes version above. Do you want to proceed?`, }); if (!confirmVersions) { @@ -119,103 +113,64 @@ async function releaseHermesForBranchCut() /*: Promise */ { exit(0); } - // Step 4: Create release branch in Hermes - const releaseBranch = `release-v${legacyHermesVersion}`; - console.log('\n🌿 Creating release branch for legacy Hermes...'); - execInRepo(`git checkout ${HERMES_LEGACY_BRANCH}`, HERMES_REPO_PATH, { - silent: true, - }); - - if (DRY_RUN) { - console.log(` [DRY RUN] Would create and push branch: ${releaseBranch}`); - } else { - execInRepo(`git checkout -b ${releaseBranch}`, HERMES_REPO_PATH); - execInRepo(`git push -u origin ${releaseBranch}`, HERMES_REPO_PATH); - console.log(`āœ… Created and pushed branch: ${releaseBranch}`); - } - - // Step 5: Trigger GitHub workflows - console.log('\nšŸ”„ Triggering GitHub workflows...'); + // Step 4: Trigger GitHub workflow + console.log('\nšŸ”„ Triggering GitHub workflow...'); - const legacyWorkflowUrl = `https://github.com/facebook/hermes/actions/workflows/rn-build-hermes.yml?query=branch%3A${releaseBranch}`; - const v1WorkflowUrl = `https://github.com/facebook/hermes/actions/workflows/rn-build-hermes.yml?query=branch%3A${HERMES_V1_BRANCH}`; + const workflowUrl = `https://github.com/facebook/hermes/actions/workflows/rn-build-hermes.yml?query=branch%3A${HERMES_BRANCH}`; if (DRY_RUN) { console.log( - ` [DRY RUN] Would trigger workflow for ${releaseBranch} with release_type=Release`, - ); - console.log( - ` [DRY RUN] Would trigger workflow for ${HERMES_V1_BRANCH} with release_type=Release`, + ` [DRY RUN] Would trigger workflow for ${HERMES_BRANCH} with release_type=Release`, ); } else { - console.log(` Triggering workflow for ${releaseBranch}...`); + console.log(` Triggering workflow for ${HERMES_BRANCH}...`); execSync( - `gh workflow run rn-build-hermes.yml -R facebook/hermes -f branch=${releaseBranch} -f release_type=Release`, + `gh workflow run rn-build-hermes.yml -R facebook/hermes -f branch=${HERMES_BRANCH} -f release_type=Release`, {stdio: 'inherit'}, ); - console.log(` → ${legacyWorkflowUrl}`); + console.log(` → ${workflowUrl}`); - console.log(` Triggering workflow for ${HERMES_V1_BRANCH}...`); - execSync( - `gh workflow run rn-build-hermes.yml -R facebook/hermes -f branch=${HERMES_V1_BRANCH} -f release_type=Release`, - {stdio: 'inherit'}, - ); - console.log(` → ${v1WorkflowUrl}`); - - console.log('āœ… Workflows triggered successfully.'); + console.log('āœ… Workflow triggered successfully.'); } - // Step 6: Update RN repo and create commit + // Step 5: Update RN repo and create commit console.log('\nā¬†ļø Bump Hermes version in RN release branch...'); if (DRY_RUN) { - console.log(` [DRY RUN] Would set Hermes tags:`); - console.log(` - .hermesversion: ${releaseBranch}`); - console.log(` - .hermesv1version: ${HERMES_V1_BRANCH}`); + console.log(` [DRY RUN] Would set Hermes tag:`); + console.log(` - .hermesversion: ${HERMES_BRANCH}`); console.log( - ` [DRY RUN] Would update hermes-compiler dependency to ${v1HermesVersion}`, + ` [DRY RUN] Would update hermes-compiler dependency to ${hermesVersion}`, ); console.log(` [DRY RUN] Would update version.properties:`); - console.log(` - HERMES_VERSION_NAME: ${legacyHermesVersion}`); - console.log(` - HERMES_V1_VERSION_NAME: ${v1HermesVersion}`); + console.log(` - HERMES_VERSION_NAME: ${hermesVersion}`); console.log(' [DRY RUN] Would create commit: "Bump hermes version"'); } else { - await setHermesTag(releaseBranch, HERMES_V1_BRANCH); - await updateHermesCompilerVersionInDependencies(v1HermesVersion); - await updateHermesRuntimeDependenciesVersions( - legacyHermesVersion, - v1HermesVersion, - ); + await setHermesTag(HERMES_BRANCH); + await updateHermesCompilerVersionInDependencies(hermesVersion); + await updateHermesRuntimeDependenciesVersions(hermesVersion); execInRepo('git add .', RN_REPO_ROOT); execInRepo('git commit -m "Bump hermes version"', RN_REPO_ROOT); console.log('āœ… Commit created (not pushed yet).'); } - // Step 7: Bump Hermes versions for next release (PRs) - const newLegacyVersion = createHermesBumpPR({ - currentVersion: legacyHermesVersion, - baseBranch: HERMES_LEGACY_BRANCH, - bumpVersion: bumpMinorVersion, - label: HERMES_LEGACY_LABEL, - rnBranch, - }); - - const newV1Version = createHermesBumpPR({ - currentVersion: v1HermesVersion, - baseBranch: HERMES_V1_BRANCH, + // Step 6: Bump Hermes version for next release (PR) + const newVersion = createHermesBumpPR({ + currentVersion: hermesVersion, + baseBranch: HERMES_BRANCH, bumpVersion: bumpPatchVersion, - label: HERMES_V1_LABEL, + label: HERMES_LABEL, rnBranch, }); - // Step 9: Bump RN main (PR) - console.log('\nšŸ“ Creating PR to bump Hermes V1 version on RN main...'); - const rnBumpBranch = `bump-hermes-v1-${newV1Version}`; + // Step 7: Bump RN main (PR) + console.log('\nšŸ“ Creating PR to bump Hermes version on RN main...'); + const rnBumpBranch = `bump-hermes-${newVersion}`; if (DRY_RUN) { console.log(` [DRY RUN] Would create branch ${rnBumpBranch} on RN main`); console.log( - ` [DRY RUN] Would update HERMES_V1_VERSION_NAME to ${newV1Version}`, + ` [DRY RUN] Would update HERMES_VERSION_NAME to ${newVersion}`, ); console.log( ` [DRY RUN] Would create PR: "Bump hermes version for RN release ${rnBranch}" → main`, @@ -235,26 +190,26 @@ async function releaseHermesForBranchCut() /*: Promise */ { ); updateVersionProperties( versionPropertiesPath, - 'HERMES_V1_VERSION_NAME', - newV1Version, + 'HERMES_VERSION_NAME', + newVersion, ); execInRepo( 'git add packages/react-native/sdks/hermes-engine/version.properties', RN_REPO_ROOT, ); execInRepo( - `git commit -m "Bump hermes v1 version to ${newV1Version}"`, + `git commit -m "Bump hermes version to ${newVersion}"`, RN_REPO_ROOT, ); execInRepo(`git push -u origin ${rnBumpBranch}`, RN_REPO_ROOT); execSync( - `gh pr create --title "Bump hermes version for RN release ${rnBranch}" --body "Bumps HERMES_V1_VERSION_NAME to ${newV1Version} for the next release." --base main`, + `gh pr create --title "Bump hermes version for RN release ${rnBranch}" --body "Bumps HERMES_VERSION_NAME to ${newVersion} for the next release." --base main`, {stdio: 'inherit', cwd: RN_REPO_ROOT}, ); - console.log(`āœ… Created PR for RN main Hermes V1 bump (${newV1Version})`); + console.log(`āœ… Created PR for RN main Hermes bump (${newVersion})`); } - // Step 10: Return to stable branch and show summary + // Step 8: Return to stable branch and show summary if (!DRY_RUN) { execInRepo(`git checkout ${rnBranch}`, RN_REPO_ROOT, {silent: true}); } @@ -263,28 +218,24 @@ async function releaseHermesForBranchCut() /*: Promise */ { console.log(` āœ… Dry run completed! Here's what would happen: -1. Create release branch: ${releaseBranch} -2. Trigger workflows on ${releaseBranch} and ${HERMES_V1_BRANCH} -3. Update RN repo with Hermes versions and create commit -4. Create PR to bump Hermes legacy to ${newLegacyVersion} -5. Create PR to bump Hermes V1 to ${newV1Version} -6. Create PR to bump RN main HERMES_V1_VERSION_NAME to ${newV1Version} +1. Trigger workflow on ${HERMES_BRANCH} +2. Update RN repo with Hermes version and create commit +3. Create PR to bump Hermes to ${newVersion} +4. Create PR to bump RN main HERMES_VERSION_NAME to ${newVersion} -Workflow URLs (when created): - • Legacy Hermes: ${legacyWorkflowUrl} - • Hermes V1: ${v1WorkflowUrl} +Workflow URL (when created): + • Hermes: ${workflowUrl} -āš ļø IMPORTANT: Do NOT push the RN release branch until the workflows complete. +āš ļø IMPORTANT: Do NOT push the RN release branch until the workflow completes. `); } else { console.log(` āœ… Branch cut workflow completed! -Monitor the workflows here: - • Legacy Hermes: ${legacyWorkflowUrl} - • Hermes V1: ${v1WorkflowUrl} +Monitor the workflow here: + • Hermes: ${workflowUrl} -āš ļø IMPORTANT: Do NOT push the RN release branch until the workflows complete. +āš ļø IMPORTANT: Do NOT push the RN release branch until the workflow completes. `); } } @@ -399,13 +350,6 @@ function getHermesVersionFromPackageJson(repoPath /*: string */) /*: string */ { return packageJson.version; } -function bumpMinorVersion(version /*: string */) /*: string */ { - const parts = version.split('.'); - const major = parseInt(parts[0], 10); - const minor = parseInt(parts[1], 10); - return `${major}.${minor + 1}.0`; -} - function bumpPatchVersion(version /*: string */) /*: string */ { const parts = version.split('.'); const major = parseInt(parts[0], 10); diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 3296a20bbd55..2767a2944e6a 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -95,11 +95,6 @@ def use_react_native! ( # excluding the legacy arch unless the user turns this flag off explicitly. ENV['RCT_REMOVE_LEGACY_ARCH'] = ENV['RCT_REMOVE_LEGACY_ARCH'] == '0' ? '0' : '1' - # Enable Hermes V1 by default. - # Users can still turn it off and use legacy hermes by setting the RCT_HERMES_V1_ENABLED - # environment variable to '0'. - ENV['RCT_HERMES_V1_ENABLED']= ENV['RCT_HERMES_V1_ENABLED'] == '0' ? '0' : '1' - ReactNativePodsUtils.check_minimum_required_xcode() # Current target definition is provided by Cocoapods and it refers to the target diff --git a/packages/react-native/sdks/hermes-engine/hermes-engine.podspec b/packages/react-native/sdks/hermes-engine/hermes-engine.podspec index 58e003985c6d..f3af9cd0fb7f 100644 --- a/packages/react-native/sdks/hermes-engine/hermes-engine.podspec +++ b/packages/react-native/sdks/hermes-engine/hermes-engine.podspec @@ -22,20 +22,7 @@ end package = JSON.parse(File.read(File.join(react_native_path, "package.json"))) versionProperties = Hash[*File.read("version.properties").split(/[=\n]+/)] -if ENV['RCT_HERMES_V1_ENABLED'] == "0" - version = versionProperties['HERMES_VERSION_NAME'] -else - version = versionProperties['HERMES_V1_VERSION_NAME'] -end - -# Local monorepo build -# We don't want to build Hermes V1 from source -if ENV['RCT_HERMES_V1_ENABLED'] == "0" && package['version'] == "1000.0.0" then - hermesCompilerVersion = package['dependencies']['hermes-compiler'] - if hermesCompilerVersion != "0.0.0" then - version = hermesCompilerVersion - end -end +version = versionProperties['HERMES_VERSION_NAME'] source_type = hermes_source_type(version, react_native_path) source = podspec_source(source_type, version, react_native_path) @@ -69,15 +56,7 @@ Pod::Spec.new do |spec| spec.subspec 'Pre-built' do |ss| ss.preserve_paths = ["destroot/bin/*"].concat(["**/*.{h,c,cpp}"]) - if ENV["RCT_HERMES_V1_ENABLED"] == "0" - ss.source_files = "destroot/include/hermes/**/*.h" - else - # Hermes v1 is shipping a jsi/hermes.h header which is imported by the hermes.h header - # and that file is not present in React Native's JSI - # (see https://github.com/facebook/react-native/tree/main/packages/react-native/ReactCommon/jsi/jsi/ where there is - # hermes-interface.h but not hermes.h) - ss.source_files = ["destroot/include/hermes/**/*.h", "destroot/include/jsi/hermes.h"] - end + ss.source_files = ["destroot/include/hermes/**/*.h", "destroot/include/jsi/hermes.h"] ss.header_mappings_dir = "destroot/include" ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermesvm.xcframework" ss.visionos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermesvm.xcframework" @@ -140,20 +119,6 @@ Pod::Spec.new do |spec| ss.header_dir = 'hermes/Public' end - if ENV['RCT_HERMES_V1_ENABLED'] == "0" - spec.subspec 'inspector' do |ss| - ss.source_files = '' - ss.public_header_files = 'API/hermes/inspector/*.h' - ss.header_dir = 'hermes/inspector' - end - - spec.subspec 'inspector_chrome' do |ss| - ss.source_files = '' - ss.public_header_files = 'API/hermes/inspector/chrome/*.h' - ss.header_dir = 'hermes/inspector/chrome' - end - end - hermesc_path = "${PODS_ROOT}/hermes-engine/build_host_hermesc" if ENV.has_key?('HERMES_OVERRIDE_HERMESC_PATH') && File.exist?(ENV['HERMES_OVERRIDE_HERMESC_PATH']) then diff --git a/packages/react-native/sdks/hermes-engine/hermes-utils.rb b/packages/react-native/sdks/hermes-engine/hermes-utils.rb index 65e7e450b28c..ee81af551782 100644 --- a/packages/react-native/sdks/hermes-engine/hermes-utils.rb +++ b/packages/react-native/sdks/hermes-engine/hermes-utils.rb @@ -85,10 +85,6 @@ def hermes_commit_envvar_defined() return ENV.has_key?('HERMES_COMMIT') end -def hermes_v1_enabled() - return ENV['RCT_HERMES_V1_ENABLED'] != "0" -end - def force_build_from_tag(react_native_path) return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path)) end @@ -175,16 +171,12 @@ def podspec_source_build_from_github_commit() def podspec_source_build_from_github_tag(react_native_path) tag = File.read(hermestag_file(react_native_path)).strip - if hermes_v1_enabled() - hermes_log("Using tag defined in sdks/.hermesv1version: #{tag}") - else - hermes_log("Using tag defined in sdks/.hermesversion: #{tag}") - end + hermes_log("Using tag defined in sdks/.hermesversion: #{tag}") return {:git => HERMES_GITHUB_URL, :tag => tag} end def podspec_source_build_from_github_main() - branch = hermes_v1_enabled() ? "250829098.0.0-stable" : "main" + branch = "250829098.0.0-stable" hermes_log("Using the latest commit from #{branch}.") return {:git => HERMES_GITHUB_URL, :commit => `git ls-remote #{HERMES_GITHUB_URL} #{branch} | cut -f 1`.strip} end @@ -210,11 +202,7 @@ def artifacts_dir() end def hermestag_file(react_native_path) - if hermes_v1_enabled() - return File.join(react_native_path, "sdks", ".hermesv1version") - else - return File.join(react_native_path, "sdks", ".hermesversion") - end + return File.join(react_native_path, "sdks", ".hermesversion") end def release_tarball_url(version, build_type) diff --git a/packages/react-native/sdks/hermes-engine/version.properties b/packages/react-native/sdks/hermes-engine/version.properties index e5d8f2e9a530..a71f2edb838a 100644 --- a/packages/react-native/sdks/hermes-engine/version.properties +++ b/packages/react-native/sdks/hermes-engine/version.properties @@ -1,2 +1 @@ -HERMES_VERSION_NAME=1000.0.0 -HERMES_V1_VERSION_NAME=250829098.0.12 +HERMES_VERSION_NAME=250829098.0.12 diff --git a/packages/react-native/settings.gradle.kts b/packages/react-native/settings.gradle.kts index 62527f0149f2..7da5cf675c32 100644 --- a/packages/react-native/settings.gradle.kts +++ b/packages/react-native/settings.gradle.kts @@ -45,7 +45,7 @@ project(":packages:react-native").projectDir = file("/tmp") // and apply relevant properties to the :react-native project. buildscript { val properties = java.util.Properties() - val propertiesToInherit = listOf("hermesV1Enabled", "react.hermesV1Enabled") + val propertiesToInherit = emptyList() // We cannot assume that the node_modules are next to the android project, for example // in monorepos, they might get hoisted. diff --git a/private/react-native-fantom/build.gradle.kts b/private/react-native-fantom/build.gradle.kts index 55d6a92d9dff..13f8846c469f 100644 --- a/private/react-native-fantom/build.gradle.kts +++ b/private/react-native-fantom/build.gradle.kts @@ -6,7 +6,6 @@ */ import com.android.build.gradle.internal.tasks.factory.dependsOn -import com.facebook.react.internal.PrivateReactExtension import com.facebook.react.tasks.internal.* import com.facebook.react.tasks.internal.utils.* import de.undercouch.gradle.tasks.download.Download @@ -16,9 +15,6 @@ plugins { alias(libs.plugins.download) } -val hermesV1Enabled = - rootProject.extensions.getByType(PrivateReactExtension::class.java).hermesV1Enabled.get() - // This is the version of CMake we're requesting to the Android SDK to use. // If missing it will be downloaded automatically. Only CMake versions shipped with the // Android SDK are supported (you can find them listed in the SDK Manager of Android Studio). @@ -203,10 +199,6 @@ val configureFantomTester by "-DRN_ENABLE_DEBUG_STRING_CONVERTIBLE=ON", ) - if (hermesV1Enabled) { - cmdArgs.add("-DHERMES_V1_ENABLED=1") - } - commandLine(cmdArgs) standardOutputFile.set(project.file("$buildDir/reports/configure-fantom_tester.log")) errorOutputFile.set(project.file("$buildDir/reports/configure-fantom_tester.error.log")) diff --git a/scripts/releases/utils/hermes-utils.js b/scripts/releases/utils/hermes-utils.js index f911f4240e22..2fcb5c74c649 100644 --- a/scripts/releases/utils/hermes-utils.js +++ b/scripts/releases/utils/hermes-utils.js @@ -34,27 +34,16 @@ const GRADLE_PROPERTIES_PATH = path.join( async function getLatestHermesNightlyVersion() /*: Promise<{ compilerVersion: string, - compilerV1Version: string, runtimeVersion: string, - runtimeV1Version: string, }> */ { - // fetch the latest commitly version of hermes v0 const compilerVersion = await getPackageVersionStrByTag( - 'hermes-compiler', - 'nightly', - ); - // fetch the latest version of hermes v1 - const compilerV1Version = await getPackageVersionStrByTag( 'hermes-compiler', 'latest-v1', ); return { compilerVersion, - compilerV1Version, - // runtime version should match the compiler version runtimeVersion: compilerVersion, - runtimeV1Version: compilerV1Version, }; } @@ -102,11 +91,8 @@ async function updateHermesCompilerVersionInDependencies( async function updateHermesRuntimeDependenciesVersions( hermesVersion /*: string */, - hermesV1Version /*: string */, ) /*: Promise */ { - const newVersionsFile = - `HERMES_VERSION_NAME=${hermesVersion}\n` + - `HERMES_V1_VERSION_NAME=${hermesV1Version}`; + const newVersionsFile = `HERMES_VERSION_NAME=${hermesVersion}`; await fs.writeFile(MAVEN_VERSIONS_FILE_PATH, newVersionsFile.trim() + '\n'); } @@ -114,11 +100,10 @@ async function updateHermesRuntimeDependenciesVersions( async function updateHermesVersionsToNightly() { const hermesVersions = await getLatestHermesNightlyVersion(); await updateHermesCompilerVersionInDependencies( - hermesVersions.compilerV1Version, + hermesVersions.compilerVersion, ); await updateHermesRuntimeDependenciesVersions( hermesVersions.runtimeVersion, - hermesVersions.runtimeV1Version, ); }