mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Remove hermesV1Enabled Gradle property and simplify Hermes version resolution (#56733)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56733 - Remove `hermesV1Enabled` / `react.hermesV1Enabled` Gradle property and all branching it controls - Rename `HERMES_V1_VERSION_NAME` to `HERMES_VERSION_NAME` in `version.properties` - Remove `hermesV1Enabled` from `PrivateReactExtension`, `ProjectUtils`, `PropertyUtils`, `ReactPlugin` - Simplify `DependencyUtils.Coordinates` to single Hermes version - Make `-DHERMESVM_HEAP_HV_MODE=HEAP_HV_PREFER32` CMake flag unconditional - Remove `-DHERMES_V1_ENABLED=1` CMake argument from `ReactAndroid` and Fantom builds - Delete `hermesV1Enabled=true` from `gradle.properties` - Update all Gradle plugin tests ## Changelog: [Android][Removed] - Remove hermesV1Enabled and simplify the code ## Test plan - [x] Gradle plugin: `./gradlew -p packages/gradle-plugin build` — BUILD SUCCESSFUL, all tests pass - [x] Android: `./gradlew :packages:rn-tester:android:app:assembleDebug` — BUILD SUCCESSFUL Reviewed By: cortinico Differential Revision: D104244582 fbshipit-source-id: 7d12af5b934aac9d431e89d9a2eac41213c997a1
This commit is contained in:
1 parent
f9476256bd
commit
0a5c8c6b4b
20 files changed
+65
-382
No files matched your search
@@ -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
|
||||
|
||||
@@ -32,10 +32,9 @@ jobs:
|
||||
run: |
|
||||
echo "Setting hermes versions to latest"
|
||||
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
|
||||
echo "HERMES_V1_VERSION=$hermes_version" >> $GITHUB_OUTPUT
|
||||
- name: Print hermes versions
|
||||
run: |
|
||||
echo "HERMES_VERSION=${{ steps.set_hermes_versions.outputs.HERMES_VERSION }}"
|
||||
|
||||
+2
-10
@@ -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 V1 prebuilt"
|
||||
} else {
|
||||
logger.warn(
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
+21
-5
@@ -28,8 +28,8 @@ 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.PropertyUtils
|
||||
import com.facebook.react.utils.findPackageJsonFile
|
||||
import java.io.File
|
||||
import kotlin.system.exitProcess
|
||||
@@ -55,8 +55,25 @@ class ReactPlugin : Plugin<Project> {
|
||||
project,
|
||||
)
|
||||
|
||||
if (!project.rootProject.isHermesV1Enabled) {
|
||||
rootExtension.hermesV1Enabled.set(false)
|
||||
// Warn users if they still have the hermesV1Enabled property set.
|
||||
if (
|
||||
project.rootProject.hasProperty(PropertyUtils.HERMES_V1_ENABLED) ||
|
||||
project.rootProject.hasProperty(PropertyUtils.SCOPED_HERMES_V1_ENABLED)
|
||||
) {
|
||||
val value =
|
||||
(project.rootProject.findProperty(PropertyUtils.HERMES_V1_ENABLED)
|
||||
?: project.rootProject.findProperty(PropertyUtils.SCOPED_HERMES_V1_ENABLED))
|
||||
.toString()
|
||||
.toBoolean()
|
||||
if (value) {
|
||||
project.logger.warn(
|
||||
"WARNING: The 'hermesV1Enabled' property is no longer needed. Hermes V1 is now always enabled. You can safely remove this property from your gradle.properties."
|
||||
)
|
||||
} else {
|
||||
project.logger.warn(
|
||||
"WARNING: Opting out of Hermes V1 is no longer supported. The 'hermesV1Enabled=false' property will be ignored. Hermes V1 is now always enabled. Please remove this property from your gradle.properties."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// App Only Configuration
|
||||
@@ -75,8 +92,7 @@ class ReactPlugin : Plugin<Project> {
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
-3
@@ -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<Boolean> = objects.property(Boolean::class.java).convention(true)
|
||||
}
|
||||
+5
-20
@@ -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,8 +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 +136,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 +145,10 @@ internal object DependencyUtils {
|
||||
|
||||
internal fun getDependencySubstitutions(
|
||||
coordinates: Coordinates,
|
||||
hermesV1Enabled: Boolean = true,
|
||||
): List<Triple<String, String, String>> {
|
||||
val dependencySubstitution = mutableListOf<Triple<String, String, String>>()
|
||||
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,
|
||||
|
||||
-21
@@ -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)
|
||||
|
||||
+4
-2
@@ -18,7 +18,10 @@ object PropertyUtils {
|
||||
const val HERMES_ENABLED = "hermesEnabled"
|
||||
const val SCOPED_HERMES_ENABLED = "react.hermesEnabled"
|
||||
|
||||
/** Public property that toggles Hermes V1 */
|
||||
/**
|
||||
* Deprecated property that used to toggle Hermes V1. Hermes V1 is now always enabled. Kept here
|
||||
* so we can detect usage and warn users to remove it from their gradle.properties.
|
||||
*/
|
||||
const val HERMES_V1_ENABLED = "hermesV1Enabled"
|
||||
const val SCOPED_HERMES_V1_ENABLED = "react.hermesV1Enabled"
|
||||
|
||||
@@ -92,5 +95,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"
|
||||
}
|
||||
+10
-186
@@ -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()
|
||||
|
||||
-27
@@ -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()
|
||||
|
||||
@@ -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,9 +580,7 @@ android {
|
||||
"-DCMAKE_POLICY_DEFAULT_CMP0069=NEW",
|
||||
)
|
||||
|
||||
if (hermesV1Enabled) {
|
||||
arguments("-DHERMES_V1_ENABLED=1")
|
||||
}
|
||||
arguments("-DHERMES_V1_ENABLED=1")
|
||||
|
||||
targets(
|
||||
"reactnative",
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import com.facebook.react.internal.PrivateReactExtension
|
||||
import com.facebook.react.tasks.internal.*
|
||||
import de.undercouch.gradle.tasks.download.Download
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
@@ -50,8 +49,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 +79,11 @@ val hermesBuildOutputFileTree =
|
||||
.include("**/*.cmake", "**/*.marks", "**/compiler_depends.ts", "**/Makefile", "**/link.txt")
|
||||
|
||||
val hermesVersionProvider: Provider<String> = 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/.hermesv1version",
|
||||
)
|
||||
|
||||
if (hermesVersionFile.exists()) {
|
||||
@@ -172,9 +169,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 +353,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")
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ async function main() {
|
||||
await setHermesTag(hermesTag, hermesV1Tag);
|
||||
|
||||
await updateHermesCompilerVersionInDependencies(hermesV1Version);
|
||||
await updateHermesRuntimeDependenciesVersions(hermesVersion, hermesV1Version);
|
||||
await updateHermesRuntimeDependenciesVersions(hermesV1Version);
|
||||
}
|
||||
|
||||
void main().then(() => {
|
||||
|
||||
@@ -176,16 +176,12 @@ async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
` [DRY RUN] Would update hermes-compiler dependency to ${v1HermesVersion}`,
|
||||
);
|
||||
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: ${v1HermesVersion}`);
|
||||
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 updateHermesRuntimeDependenciesVersions(v1HermesVersion);
|
||||
execInRepo('git add .', RN_REPO_ROOT);
|
||||
execInRepo('git commit -m "Bump hermes version"', RN_REPO_ROOT);
|
||||
console.log('✅ Commit created (not pushed yet).');
|
||||
@@ -215,7 +211,7 @@ async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
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 ${newV1Version}`,
|
||||
);
|
||||
console.log(
|
||||
` [DRY RUN] Would create PR: "Bump hermes version for RN release ${rnBranch}" → main`,
|
||||
@@ -235,7 +231,7 @@ async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
);
|
||||
updateVersionProperties(
|
||||
versionPropertiesPath,
|
||||
'HERMES_V1_VERSION_NAME',
|
||||
'HERMES_VERSION_NAME',
|
||||
newV1Version,
|
||||
);
|
||||
execInRepo(
|
||||
@@ -243,12 +239,12 @@ async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
RN_REPO_ROOT,
|
||||
);
|
||||
execInRepo(
|
||||
`git commit -m "Bump hermes v1 version to ${newV1Version}"`,
|
||||
`git commit -m "Bump hermes version to ${newV1Version}"`,
|
||||
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 ${newV1Version} for the next release." --base main`,
|
||||
{stdio: 'inherit', cwd: RN_REPO_ROOT},
|
||||
);
|
||||
console.log(`✅ Created PR for RN main Hermes V1 bump (${newV1Version})`);
|
||||
@@ -268,7 +264,7 @@ async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
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}
|
||||
6. Create PR to bump RN main HERMES_VERSION_NAME to ${newV1Version}
|
||||
|
||||
Workflow URLs (when created):
|
||||
• Legacy Hermes: ${legacyWorkflowUrl}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
HERMES_VERSION_NAME=1000.0.0
|
||||
HERMES_V1_VERSION_NAME=250829098.0.13
|
||||
HERMES_VERSION_NAME=250829098.0.13
|
||||
@@ -38,46 +38,3 @@ project(":packages:react-native:ReactAndroid:hermes-engine").projectDir =
|
||||
project(":packages").projectDir = file("/tmp")
|
||||
|
||||
project(":packages:react-native").projectDir = file("/tmp")
|
||||
|
||||
// Gradle properties defined in `gradle.properties` are not inherited by
|
||||
// included builds, see https://github.com/gradle/gradle/issues/2534.
|
||||
// This is a workaround to read the configuration from the consuming project,
|
||||
// and apply relevant properties to the :react-native project.
|
||||
buildscript {
|
||||
val properties = java.util.Properties()
|
||||
val propertiesToInherit = listOf("hermesV1Enabled", "react.hermesV1Enabled")
|
||||
|
||||
// We cannot assume that the node_modules are next to the android project, for example
|
||||
// in monorepos, they might get hoisted.
|
||||
// In a composite build, this included build can access the invoking (consumer) build
|
||||
// via `gradle.parent`. We use its StartParameter to locate the app's `gradle.properties`:
|
||||
// - `projectDir/gradle.properties` when Gradle is run with `-p <androidDir>`
|
||||
// - `currentDir/gradle.properties` when run from the app android folder
|
||||
// If neither exists, we keep the legacy RN fallback path below.
|
||||
|
||||
val parentGradle = gradle.parent
|
||||
val parentProjectDir = parentGradle?.startParameter?.projectDir
|
||||
val parentCurrentDir = parentGradle?.startParameter?.currentDir
|
||||
val gradlePropertiesCandidates =
|
||||
listOfNotNull(
|
||||
parentProjectDir?.resolve("gradle.properties"),
|
||||
parentCurrentDir?.resolve("gradle.properties"),
|
||||
// Backward-compatible fallback for classic RN app layouts.
|
||||
file("../../android/gradle.properties"),
|
||||
)
|
||||
|
||||
try {
|
||||
val propertiesFile = gradlePropertiesCandidates.firstOrNull { it.exists() }
|
||||
propertiesFile?.inputStream()?.use { properties.load(it) }
|
||||
|
||||
gradle.rootProject {
|
||||
propertiesToInherit.forEach { property ->
|
||||
if (properties.containsKey(property)) {
|
||||
gradle.rootProject.extra.set(property, properties.getProperty(property))
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// fail silently
|
||||
}
|
||||
}
|
||||
@@ -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,9 +199,7 @@ val configureFantomTester by
|
||||
"-DRN_ENABLE_DEBUG_STRING_CONVERTIBLE=ON",
|
||||
)
|
||||
|
||||
if (hermesV1Enabled) {
|
||||
cmdArgs.add("-DHERMES_V1_ENABLED=1")
|
||||
}
|
||||
cmdArgs.add("-DHERMES_V1_ENABLED=1")
|
||||
|
||||
commandLine(cmdArgs)
|
||||
standardOutputFile.set(project.file("$buildDir/reports/configure-fantom_tester.log"))
|
||||
|
||||
@@ -102,11 +102,8 @@ async function updateHermesCompilerVersionInDependencies(
|
||||
|
||||
async function updateHermesRuntimeDependenciesVersions(
|
||||
hermesVersion /*: string */,
|
||||
hermesV1Version /*: string */,
|
||||
) /*: Promise<void> */ {
|
||||
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');
|
||||
}
|
||||
@@ -116,8 +113,11 @@ async function updateHermesVersionsToNightly() {
|
||||
await updateHermesCompilerVersionInDependencies(
|
||||
hermesVersions.compilerV1Version,
|
||||
);
|
||||
// Both Android Gradle and the iOS podspec now resolve Hermes from the single
|
||||
// HERMES_VERSION_NAME key, so we must write the latest-v1 value into it.
|
||||
// The legacy nightly v0 version (`runtimeVersion`) is not published to Maven
|
||||
// Central and would leave Android falling back to BUILD_FROM_GITHUB_MAIN.
|
||||
await updateHermesRuntimeDependenciesVersions(
|
||||
hermesVersions.runtimeVersion,
|
||||
hermesVersions.runtimeV1Version,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user