-
Notifications
You must be signed in to change notification settings - Fork 1.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
[Gutenberg] Force using release
variants for editor libraries
#18760
[Gutenberg] Force using release
variants for editor libraries
#18760
Conversation
📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
|
@ParaskP7, 👋 , I wonder if I might be able to pick your brain here. We're attempting to enforce the I attempted to see if changing the debug Do you happen to know if there are any valid ways to enforce that the editor module is always built in the |
libs/editor/build.gradle
Outdated
@@ -34,6 +34,13 @@ android { | |||
targetSdkVersion rootProject.targetSdkVersion | |||
} | |||
|
|||
buildTypes { | |||
debug { | |||
minifyEnabled true |
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.
Just and FYI and as per the documentation when minifyEnabled
is set to true then this enables code shrinking, obfuscation, and optimization for only your project's release build type. Make sure to use a build variant with 'isDebuggable=false'.
PS: I am not sure if that's what you want and whether this will help the editor to load faster. 🤔
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 Petros, this code was a hacky experiment to see if I could "trick" the debug variant into matching the main app's release variant. 😅 It didn't appear to have any impact on the editor's load time, and from your comments it does seem like it isn't a viable approach to continue experimenting with. Really appreciate your expertise here. 🙇♀️
libs/editor/build.gradle
Outdated
buildTypes { | ||
debug { | ||
minifyEnabled true | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg' |
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.
Just and FYI and as per the documentation when proguardFiles
is configured then this includes the default ProGuard rules files that are packaged with the Android Gradle plugin.
PS: I am not sure this will work as there is no proguard.cfg
file for the editor
module, we only got that on the WordPress
module. 🤔
👋 @SiobhyB and thanks for the ping!
I am looking into that and trying to think what can we do about that. I will share some insights once I have something concrete for you. PS: However, and no matter our looking into that, or whether something like that is feasible or not, IMHO enforcing the |
Following this
I now wonder if that is indeed the correct way of dealing with this problem, that is, even if that ends-up being possible. It is another thing to filter the published RN debug artifacts, and thus only use the release ones as a binary dependency, and, it is another thing to enforce the One might try the following on the android {
...
variantFilter {
// Exclude debug builds from APKs
if (buildType.name == 'debug') {
setIgnore(true)
}
}
} The above filters out the Another way to do it is to duplicate the PS: The To my understanding, we are just trying to overcome a problem on filtering out published debug RN artifacts from the If that is still the case and you can do that again to overcome the slow startup time on Android, I suggest doing that instead of trying to enforce the I understand that you would like to solve this issue on the WPAndroid level, once and for all, so that to avoid having to go through that painful process of analysing, investigating and solving this issue, again and again, but I wonder if the solution lies on the RN level, not the Let me know your thoughts on all the above and I can further investigate this. |
Let me shamelessly plug @oguzkocer into this discussion too, I am keen to hear his thoughts on it (🙏), him being an expert on this kind of |
@ParaskP7, thank you again for all the insights here. It's super useful. Here's where my understanding is currently at:
Does that sound right to you? |
This reverts commit 88d9a3e.
👋 @SiobhyB and thank you for the reply, your understanding is spot-on! 💯
👍
That's right, it does "appears" so, but I want to be clear here that didn't invest a whole bunch of time in really digging deeper into that as IMHO we shouldn't even consider trying to do this change, that is, unless we have exhausted every other "alternative".
Yes, this is what I understand as well. Also, to my understanding, on past RN upgrades, some of them, this is what was done. Please someone correct me if I am wrong. |
Following the latest discussion at p1689171765012609/1688741473.102169-slack-CSYKQSY8G, we've decided to leave this issue for now. There doesn't appear to be any straightforward way to enforce the release variants of the |
@SiobhyB We used to publish our own artifacts for Facebook recently started publishing Also worth noting that |
💯 ⬆️ 💯 |
@oguzkocer, thanks for your insight. I appreciate we can generally work to resolve errors, but I noted the error in this case as an obstacle to consider when weighing up our next steps. It sounds like we're on the same page with keeping the small delay for debug builds, and not spending further time working on ways to enforce release variants, though not let me know if I'm missing anything. Thanks again for the help, all! |
Description
We noticed in the latest Android installable build, as part of the RN upgrade, that the editor takes a bit longer to load. After checking the latest upgrade we made (version 0.69.4), the team involved in that effort pointed out that we experienced a similar issue (p1688741473102169-slack-CSYKQSY8G). The culprit, in that case, was the fact that WP-Android is using the debug variant of React Native modules.
As such, we want to attempt to enforce the release variant for all scenarios.
Testing
TBD
Regression Notes
TBD
TBD
TBD
PR submission checklist:
RELEASE-NOTES.txt
if necessary.