Skip to content

Commit 90e27c2

Browse files
Kudofacebook-github-bot
authored andcommitted
show JSC removal message on Android (facebook#49709)
Summary: show build time jsc removal warning. facebook#49692 but for android ![Screenshot 2025-02-27 at 3 41 43 PM](https://github.com/user-attachments/assets/a4fe6d52-5e05-45b0-a403-c71372dfba06) ## Changelog: [ANDROID] [CHANGED] - Add a build time JSC lean core warning Pull Request resolved: facebook#49709 Test Plan: - test on rn-tester. rn-tester has a jsc build variant. it shows the warning anyway. commenting out `enableHermesOnlyInVariants` will suppress the warning. Reviewed By: rshest Differential Revision: D70323283 Pulled By: cortinico fbshipit-source-id: 632a8b9086c5d90d7f14ea705464356a1292bcad
1 parent 13a0b46 commit 90e27c2

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package com.facebook.react
99

1010
import com.android.build.api.variant.Variant
1111
import com.facebook.react.tasks.BundleHermesCTask
12+
import com.facebook.react.utils.BackwardCompatUtils.showJSCRemovalMessage
1213
import com.facebook.react.utils.KotlinStdlibCompatUtils.capitalizeCompat
1314
import com.facebook.react.utils.NdkConfiguratorUtils.configureJsEnginePackagingOptions
1415
import com.facebook.react.utils.NdkConfiguratorUtils.configureNewArchPackagingOptions
@@ -53,6 +54,9 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio
5354

5455
configureNewArchPackagingOptions(project, config, variant)
5556
configureJsEnginePackagingOptions(config, variant, isHermesEnabledInThisVariant, useThirdPartyJSC)
57+
if (!isHermesEnabledInThisVariant && !useThirdPartyJSC) {
58+
showJSCRemovalMessage(project)
59+
}
5660

5761
if (!isDebuggableVariant) {
5862
val entryFileEnvVariable = System.getenv("ENTRY_FILE")

packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import java.util.*
1111
import org.gradle.api.Project
1212

1313
internal object BackwardCompatUtils {
14+
private var hasShownJSCRemovalMessage = false
1415

1516
fun configureBackwardCompatibilityReactMap(project: Project) {
1617
if (project.extensions.extraProperties.has("react")) {
@@ -45,4 +46,25 @@ internal object BackwardCompatUtils {
4546
// We set an empty react[] map so if a library is reading it, they will find empty values.
4647
project.extensions.extraProperties.set("react", mapOf<String, String>())
4748
}
49+
50+
fun showJSCRemovalMessage(project: Project) {
51+
if (hasShownJSCRemovalMessage) {
52+
return
53+
}
54+
55+
val message =
56+
"""
57+
58+
=============== JavaScriptCore is being moved ===============
59+
JavaScriptCore has been extracted from react-native core
60+
and will be removed in a future release. It can now be
61+
installed from `@react-native-community/javascriptcore`
62+
See: https://github.com/react-native-community/javascriptcore
63+
=============================================================
64+
65+
"""
66+
.trimIndent()
67+
project.logger.warn(message)
68+
hasShownJSCRemovalMessage = true
69+
}
4870
}

0 commit comments

Comments
 (0)