Skip to content
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

[Build] Update Gradle to 8.12.1 and AGP to 8.8.1 #21680

Merged
merged 17 commits into from
Feb 18, 2025

Conversation

ParaskP7
Copy link
Contributor

@ParaskP7 ParaskP7 commented Feb 12, 2025

Issue: apps-infra-plans#174
Depends On (for local builds): GBKit#92

Description

This PR updates Gradle to 8.12.1 and AGP to 8.8.1 (context).


Review

During review, please take a closer look at the below commits:


To Test:

Testing Steps

  1. Verify that all the CI checks are successful.
  2. Smoke test both apps, Jetpack and WordPress, without composite builds, and verify everything is working as expected.
  3. Smoke test both apps again, Jetpack and WordPress, but this time, using the composite builds, focusing solely on GBK (following the instructions in local-builds.gradle-example file).
  4. Try to test for build time increases both, locally and on CI.
    • For example, all main jobs of this initial build on CI seem to take a bit longer than usual:

    • This is because dependency resolution and network activity skyrocketed, from a few seconds, to minutes again, from just a couple of hundred network requests to 3-4K of those, effectively ignoring the dependency cache altogether. This is expected due to the bump in Gradle versions, from 8.8.1 to 8.12.1. This diff will go back to normal as soon as this PR get merged and a fresh copy of dependency cache is saved.

      • FYI: Reading the docs you'll find out that metadata-2.106 is used with Gradle 8.2 to Gradle 8.10.2 and metadata-2.107 is used with Gradle 8.11 and above. We are indeed creating/using a new metadata cache since Gradle is now updated to 8.12.1:

      Note that creating the cache and consuming it should be done using compatible Gradle version, as shown in the table below. Otherwise, the build might still require some interactions with remote repositories to complete missing information, which might be available in a different version. If multiple incompatible Gradle versions are in play, all should be used when seeding the cache.

    • Triggering another build on CI seems to make things much better, most probably because we now have a build cache available from the initial build. But, and as expected, the dependency cache problem still persists (scan).

  5. Locally, in addition to the debug variants, assemble/lint the release variants, and verify everything is working as expected.
    • Run: ./gradlew assembleJetpackVanillaRelease or/and ./gradlew assembleWordpressVanillaRelease
    • Run: ./gradlew lintJetpackVanillaRelease or/and ./gradlew lintWordpressVanillaRelease
  6. Check build environment changes. Unfortunately, this is not possible due to this Content exceeds 65400 characters. problem. Good news are, that we are aware of this problem and plan to fix it, or else, work around it (see apps-infra-plans#182).

Merge Instructions


Post Merge Instructions


Regression Notes

  1. Potential unintended areas of impact

    • CI builds failing or slower than expected.
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • See To Test section above.
  3. What automated tests I added (or what prevented me from doing so)

    • N/A

PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist (strike-out the not-applying and unnecessary ones): N/A

Release Notes: https://developer.android.com/build/releases/
past-releases/agp-8-6-0-release-notes
Release Notes: https://docs.gradle.org/8.9/release-notes.html

Command: ./gradlew wrapper --gradle-version=8.9
--distribution-type=all --gradle-distribution-sha256-sum=
258e722ec21e955201e31447b0aed14201765a3bfbae296a46cf60b70e66db70
Release Notes: https://developer.android.com/build/releases/
past-releases/agp-8-7-0-release-notes
Release Notes: https://docs.gradle.org/8.10.2/release-notes.html

Command: ./gradlew wrapper --gradle-version=8.10.2
--distribution-type=all --gradle-distribution-sha256-sum=
2ab88d6de2c23e6adae7363ae6e29cbdd2a709e992929b48b6530fd0c7133bd6
Release Notes: https://docs.gradle.org/8.11.1/release-notes.html

Command: ./gradlew wrapper --gradle-version=8.11.1
--distribution-type=all --gradle-distribution-sha256-sum=
89d4e70e4e84e2d2dfbb63e4daa53e21b25017cc70c37e4eea31ee51fb15098a
Release Notes: https://docs.gradle.org/8.12.1/release-notes.html

Command: ./gradlew wrapper --gradle-version=8.12.1
--distribution-type=all --gradle-distribution-sha256-sum=
296742a352f0b20ec14b143fb684965ad66086c7810b7b255dee216670716175
This Lint warning can be suppressed because 'NoCredentialException' is
actually a subclass of 'GetCredentialException', which means that it is
already caught.

Warning Message: "Call to CredentialManager.getCredential without use of
NoCredentialException"

Explanation: "When calling CredentialManager.getCredential or
CredentialManager.getCredentialAsync, you should handle
NoCredentialException somewhere in your project.

More info: https://developer.android.com/identity/sign-in/
credential-manager#handle-exceptions"
I18n is not actually needed on these specific cases.

Warning Messages: "Number formatting does not take into account locale
settings. Consider using String.format instead."

Explanation: "When calling TextView#setText
* Never call Number#toString() to format numbers; it will not handle
fraction separators and locale-specific digits properly. Consider using
String#format with proper format specifications (%d or %f) instead.
* Do not pass a string literal (e.g. "Hello") to display text. Hardcoded
text can not be properly translated to other languages. Consider using
Android resource strings instead.
* Do not build messages by concatenating text chunks. Such messages can
not be properly translated.

More info: https://developer.android.com/guide/topics/resources/
localization.html"
@dangermattic
Copy link
Collaborator

dangermattic commented Feb 12, 2025

1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 12, 2025

Build environment changes

Content exceeds 65400 characters. Navigate to Buildkite build artifacts to see details.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 12, 2025

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr21680-b9e2e1b
Commitb9e2e1b
Direct Downloadwordpress-prototype-build-pr21680-b9e2e1b.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 12, 2025

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr21680-b9e2e1b
Commitb9e2e1b
Direct Downloadjetpack-prototype-build-pr21680-b9e2e1b.apk
Note: Google Login is not supported on these builds.

This 'Gutenberg Kit' PR hash updates the library to that branch
version where 'Gradle & AGP' is also upgraded to version
'8.12.1 & 8.8.0' respectively.

Gutenberg Kit PR: https://github.com/wordpress-mobile/
GutenbergKit/pull/92

This step is required in order to check that these 'Gutenberg Kit'
related changes work as expected for JP/WPAndroid.
@ParaskP7
Copy link
Contributor Author

👋 @dcalhoun, about this, I just wanted to share the progress done so far so that you know what to expect reviewing/supporting this work to completion next week.

  1. The PR is ready to be reviewed/merged as is, without local build support.
  2. The GBKit#92 PR is also ready to be reviewed, and (if need be) worked-on, which will ultimately unblock local build support1 for GBKit. What I did with that:

FYI: I'll now mark this as Ready for review and add you, @nbradbury and @wzieba as reviewers to move this forward. 🏁

PS: Let me know if I am missing something in terms of how to progress this. With GBM, we followed a similar process, thus, I just copied that. Not sure if the same applies to GBKit and to what extend. 🙏

Footnotes

  1. It would be good if also test these scenarios, just like I did, and then let me know if everything is working as expected, or more work is needed. Then, we could most probably be able to move forward, following the Merge Instructions that are mentioned on the PR's description, first merge GBKit#92 PR, then gutenberg-kit version to reference the trunk hash or tag and finally review/merge this as a whole.

@ParaskP7 ParaskP7 marked this pull request as ready for review February 13, 2025 14:19
@nbradbury
Copy link
Contributor

Results from my first round with this:

✅ Smoke test both apps without composite builds
❌ Smoke test both apps again using the composite builds, focusing solely on GBK
✅ ./gradlew assembleJetpackVanillaRelease
✅ ./gradlew lintJetpackVanillaRelease

The composite build fails with, "Using multiple versions of the Android Gradle Plugin [8.8.0, 8.5.1] across Gradle builds is not allowed," but that's expected until the GBK update is ready.

@ParaskP7
Copy link
Contributor Author

👋 @nbradbury and thanks for the review/testing! 🙇

❌ Smoke test both apps again using the composite builds, focusing solely on GBK

The composite build fails with, "Using multiple versions of the Android Gradle Plugin [8.8.0, 8.5.1] across Gradle builds is not allowed," but that's expected until the GBK update is ready.

Actually, that's why I already created this GBKit#92 PR too. Now, if you first checkout this PR locally, which will point this repo to build/update-gradle-to-8.12.1-and-agp-to-8.8 as well, and then try smoke testing both apps again using the composite builds, you will notice that Using multiple versions... not allowed will go await, and this is because both repos will now point to Gradle 8.12.2 and AGP 8.8.0.

Hope that helps resume you testing this path as well. 🙏

… into build/update-gradle-to-8.12.1-and-agp-to-8.8
This 'Gutenberg Kit' PR hash updates the library to that branch
version where 'Gradle & AGP' is also upgraded to version
'8.12.1 & 8.8.0' respectively.

Gutenberg Kit PR: https://github.com/wordpress-mobile/
GutenbergKit/pull/92

This step is required in order to check that these 'Gutenberg Kit'
related changes work as expected for JP/WPAndroid.
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 39.41%. Comparing base (7c3d45d) to head (b9e2e1b).
Report is 1 commits behind head on trunk.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #21680   +/-   ##
=======================================
  Coverage   39.41%   39.41%           
=======================================
  Files        2122     2122           
  Lines       99570    99570           
  Branches    15324    15324           
=======================================
  Hits        39247    39247           
  Misses      56844    56844           
  Partials     3479     3479           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

… into build/update-gradle-to-8.12.1-and-agp-to-8.8
This 'Gutenberg Kit' PR hash updates the library to that branch
version where 'Gradle & AGP' is also upgraded to version
'8.12.1 & 8.8.1' respectively.

Gutenberg Kit PR: https://github.com/wordpress-mobile/
GutenbergKit/pull/92

This step is required in order to check that these 'Gutenberg Kit'
related changes work as expected for JP/WPAndroid.
@ParaskP7 ParaskP7 changed the title [Build] Update Gradle to 8.12.1 and AGP to 8.8 [Build] Update Gradle to 8.12.1 and AGP to 8.8.1 Feb 17, 2025
@ParaskP7
Copy link
Contributor Author

FYI: I just updated trunk again but most importantly I included the new patch version of AGP (8.8.1) and did the same for GBKit (8281326) so that when this PR is merged we get all the fixes it includes.

Copy link
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test plan succeeded for me aside from one ./gradlew lintJetpackVanillaRelease error, but this appears to be present in trunk as well. So, I think it is safe to merge this.

I'll let others more experienced in Android development provide formal PR approval. Thank you for completing this upgrade. 🙇🏻‍♂️

android/Gutenberg/src/main/java/org/wordpress/gutenberg/GutenbergView.kt:144: Error: The intent action android.intent.action.VIEW (used to start an activity) matches the intent filter of a non-exported component org.wordpress.android.ui.JetpackConnectionResultActivity from a manifest. If you are trying to invoke this specific component via the action then you should make the intent explicit by calling Intent.set{Component,Class,ClassName}. [UnsafeImplicitIntentLaunch]
                      val intent = Intent(Intent.ACTION_VIEW, Uri.parse(it))
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@ParaskP7
Copy link
Contributor Author

Test plan succeeded for me aside from one ./gradlew lintJetpackVanillaRelease error, but this appears to be present in trunk as well. So, I think it is safe to merge this.

Awesome @dcalhoun , thanks for testing and verifying that everything is working as expected! 🙇 🎉 🚀

PS: Yea, about the ./gradlew lintJetpackVanillaRelease error with the GBKit related android/Gutenberg/src/main/java/org/wordpress/gutenberg/GutenbergView.kt file:

  1. As you said, as long as this was already the case on trunk I wouldn't worry about it.
  2. Since ./gradle lintRelease on GBKit#92 succeeds we should be fine.
  3. Since ./gradle lintJetpackVanillaRelease without enabling the localGutenbergKitPath local build succeeds we should be fine.
  4. Having the ./gradle lintJetpackVanillaRelease erroring when the localGutenbergKitPath local build is enabled (IMHO) should be fixed, but this doesn't (necessarily) need to be part of this PR.

I'll let others more experienced in Android development provide formal PR approval. Thank you for completing this upgrade. 🙇🏻‍♂️

Great, so, after we get a 👍 on this from @nbradbury (and maybe also @wzieba) , we can go ahead and merge this GBKit#92 PR and more forward with the rest of the Merge Instructions steps, right? 🙏

@dcalhoun
Copy link
Member

Great, so, after we get a 👍 on this from @nbradbury (and maybe also @wzieba) , we can go ahead and merge this GBKit#92 PR and more forward with the rest of the Merge Instructions steps, right?

Correct.

Copy link
Contributor

@nbradbury nbradbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ParaskP7 This is working great for me! I'll approve it, and you can merge either now or after @wzieba takes a look. :shipit:

@ParaskP7
Copy link
Contributor Author

Awesome @nbradbury , thanks for taking a final look at it! 🙇❤️🚀

… into build/update-gradle-to-8.12.1-and-agp-to-8.8
@ParaskP7
Copy link
Contributor Author

Awesome folks, I got all the 👍s I needed to proceed with the rest of the merge instructions, I am currently on it, starting with merging GBKit#92, thank YOU all! 🙇 🏃

This 'Gutenberg Kit' trunk hash updates the library to that branch
version where 'Gradle & AGP' is also upgraded to version
'8.12.1 & 8.8.1' respectively.

Gutenberg Kit PR: https://github.com/wordpress-mobile/
GutenbergKit/pull/92

This step is required in order to check that these 'Gutenberg Kit'
related changes work as expected for JP/WPAndroid.
@ParaskP7 ParaskP7 merged commit 93ff765 into trunk Feb 18, 2025
24 checks passed
@ParaskP7 ParaskP7 deleted the build/update-gradle-to-8.12.1-and-agp-to-8.8 branch February 18, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants