-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Add hermesFlagsForVariant and deleteDebugFilesForVariant #32281
Add hermesFlagsForVariant and deleteDebugFilesForVariant #32281
Conversation
Base commit: 4790146 |
Base commit: 4790146 |
@ShikaSD has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Hey, thanks for submitting this change!
|
Since |
Yep, good point. We are thinking about deprecating these flags, so maybe lambda can just override it? Something like:
We don't have a proper variant aware API at the moment, but it is a step into right direction |
a658dbd
to
6bbc781
Compare
6bbc781
to
5e07992
Compare
@ShikaSD Sorry for the delay, but I found some time yesterday to convert the parameters into lambdas. |
@ShikaSD has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
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.
Thanks for following up on this. Overall looks good on my end, just left a couple of comments.
* return [hermesFlagsRelease] for Release variants and [hermesFlagsDebug] for Debug variants. | ||
*/ | ||
var hermesFlagsForVariant: (BaseVariant) -> List<String> = { | ||
variant -> if (variant.name.toLowerCase().contains("release")) hermesFlagsRelease.get() else hermesFlagsDebug.get() |
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.
variant -> if (variant.name.toLowerCase().contains("release")) hermesFlagsRelease.get() else hermesFlagsDebug.get() | |
variant -> if (variant.isRelease) hermesFlagsRelease.get() else hermesFlagsDebug.get() |
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.
After making that change the build is failing with Cannot access 'isRelease': it is private in file
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.
See the other comment 👍
* return True for Release variants and False for Debug variants. | ||
*/ | ||
var deleteDebugFilesForVariant: (BaseVariant) -> Boolean = { | ||
variant -> variant.name.toLowerCase().contains("release") |
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.
variant -> variant.name.toLowerCase().contains("release") | |
variant -> variant.isRelease |
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.
After making that change the build is failing with Cannot access 'isRelease': it is private in file
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.
I think it makes sense to make it internal to expose this functionality :)
@cortinico we should consider moving it to some common utils
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.
Yup basically what @ShikaSD mentioned. If you want to export it to a VariantUtil.kt
file as well, that would be fine. As long as it's internal
all is good 👌
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.
It's passing now after making it internal (the failing check is a connection timeout to jitpack)
react.gradle
Outdated
@@ -151,6 +173,7 @@ afterEvaluate { | |||
|
|||
// Set up dev mode | |||
def devEnabled = !(config."devDisabledIn${targetName}" | |||
|| config."devDisabledIn${variant.buildType.name.capitalize()}" |
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.
This should not be needed
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.
I will remove it from this PR, but it is added in another PR to fix an issue with devDisabledIn${buildType}
not working for productFlavors
.
5e07992
to
48958d8
Compare
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.
I think it looks almost good for me, the only thing left is the Variant.isRelease
function. Could you make it internal
to allow access to it in extension and then use it instead?
Thanks!
747ac5c
to
f79026c
Compare
PR build artifact for f79026c is ready. |
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.
LGTM 👍 Thanks for the follow up
@ShikaSD has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @grit96 in 91adb76. When will my fix make it into a release? | Upcoming Releases |
Thanks for merging. Is there any possibility of having a look at the other related PR I mentioned (fixing |
@grit96 sure, it seems like it will require similar updates though :) |
Ref #25601 (comment).
From #31040.
Summary
The
hermesFlagsRelease
option only works with the release build type, but not with other build types.This PR allows hermes flags on a per variant basis to be specified using the
hermesFlagsForVariant
lambda.It also allows the hermes debugger cleanup to be run on a per variant basis using the
deleteDebugFilesForVariant
lambda.Changelog
[Android] [Fixed] - Fix hermesFlags not working with multiple variants
Test Plan
Set the following options in
android/app/build.gradle
and ensure warnings are hidden when running./gradlew assembleRelease
and./gradlew assembleLive
.