-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Let react.gradle Hermes config use devDisabledIn-flag #28493
Conversation
Base commit: 6f627f6 |
Base commit: 6f627f6 |
@@ -116,6 +116,10 @@ afterEvaluate { | |||
|
|||
def enableHermes = enableHermesForVariant(variant) | |||
|
|||
// Set up dev mode | |||
def devEnabled = !(config."devDisabledIn${targetName}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding a new config value what'd work similarly to devDisabledIn...
and bundleIn...
specific to hermes release mode? Overloading devDisabledIn
might not be the expected behavior for everyone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're probably right, it will be unexpected behaviour for those who know about the config flag. The devDisabledIn..
and bundleIn..
are specific to the react-native bundle
task as it stands today.
I find the description in a vanilla build.gradle
to be a bit more general though:
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true
And I wonder how many would disable dev
-mode bundling in a non-Release
build? It seemed appropriate to me to "merge" behaviour here.
There are a lot of other specific config flags in build.gradle
though, so I'm definitely open for adding another config flag for "hermes release mode" if that seems appropriate.
Thanks for sending the PR. I'm closing this as the logic is completely rewritten now. |
Summary
Issues: #27829 #25601
At the moment
react.gradle
doesn't support custom build variants for Hermes in release-builds. Say I have have a build type in myandroid/app/build.gradle
namedstore
, which is supposed to be a release-build:Then the explicit check for the target name in
react.gradle
will not work:My suggestion is that we let the "release"-check for Hermes be the
"devDisabledIn${targetName}"
flag. This is used to assign thedevEnabled
variable, which also does the releasetargetName
-check, and should in this case be backwards-compatible.This would let me configure the behaviour through the pre-existing
devDisabledIn
-flag in myandroid/app/build.gradle
:Changelog
[Android] [Added] - Hermes now supports the
devDisabledIn{targetName}
-flag for custom build variants inbuild.gradle
Test Plan
release
build type:staging
build variant in my config, enable Hermes:dependencies
for the build variant (stagingImplementation)
:staging
variant and run on device to verify that it works.