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

Upgrade Android Gradle to version 7.2 #53610

Merged
merged 1 commit into from
Oct 14, 2021

Conversation

madmiraal
Copy link
Contributor

@madmiraal madmiraal commented Oct 9, 2021

Upgrades Android Gradle build tools to the current stable version: 7.2, the Android Gradle plug-in to the current stable version 7.0.3, and the supported Java version to 11.

The upgrade was done using ./gradlew wrapper --gradle-version 7.2 --distribution-type bin. This ensures that the gradle wrapper (gradle-wrapper.jar) and the gradle wrapper scripts (gradlew and gradlew.bat) are upgraded too. Furthermore, using --distribution-type bin (the default) ensures that only the binaries are installed instead of the source and documentation, which has being done since #31919 for no good reason I could identify.

Includes updating the .gitattributes file to ensure that the Windows only gradlew.bat file's line endings are not changed by git from CRLF to LF.

Can be cherry-picked for 3.x.

The Android Gradle plug-in 7.0 is dependent on JDK 11, so #53609 is required for passing CI.

@madmiraal madmiraal requested review from a team as code owners October 9, 2021 18:46
@Chaosus Chaosus added this to the 4.0 milestone Oct 9, 2021
@Chaosus Chaosus added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Oct 9, 2021
@m4gr3d
Copy link
Contributor

m4gr3d commented Oct 11, 2021

@madmiraal Thanks for the upgrade!

This version of the Android gradle plugin may deprecate the enableResourceOptimizations flag which would reintroduce #50623.

Could you check that it's not the case.

@akien-mga FYI, we may need to deprecate the legacy build system for release builds in the near future, as I'm uncertain how we would avoid #50623 if the enableResourceOptimizations flag is deprecated.

@m4gr3d
Copy link
Contributor

m4gr3d commented Oct 11, 2021

@madmiraal FYI, you can see the deprecation warning when compiling the Godot Android templates with the current version (4.2.1) of the Android gradle plugin:

WARNING:: The option setting 'android.enableResourceOptimizations=false' is deprecated.
The current default is 'true'.
It will be removed in version 7.0 of the Android Gradle plugin.

@madmiraal
Copy link
Contributor Author

This version of the Android gradle plugin may deprecate the enableResourceOptimizations flag which would reintroduce #50623.

Could you check that it's not the case.

I've confirmed that upgrading the AGP to 7.0.2 does not reintroduce #50623.

WARNING:: The option setting 'android.enableResourceOptimizations=false' is deprecated.
The current default is 'true'.
It will be removed in version 7.0 of the Android Gradle plugin.

Despite the warning message stating that "It will be removed in version 7.0 of the Android Gradle plugin.", the deprecation "has been reverted to being softly enforced": https://issuetracker.google.com/issues/184666005#comment4. It's still something that will ultimately need to be addressed. I suggest we open a separate issue for it.

@m4gr3d
Copy link
Contributor

m4gr3d commented Oct 12, 2021

@madmiraal Thanks for checking!

The PR is missing the update to the config.gradle file.
It looks like both the androidGradlePlugin and the javaVersion should be updated according to this section.

@akien-mga FYI, as the ci config may need to be updated as well.

@madmiraal
Copy link
Contributor Author

The PR is missing the update to the config.gradle file.

Oops! That will also explain why the CI test passed. Somehow that got missed when I recreated this commit after creating #53609. 😕

It looks like both the androidGradlePlugin and the javaVersion should be updated according to this section.

@akien-mga FYI, as the ci config may need to be updated as well.

This is why I created #53609 (and updated the documentation: godotengine/godot-docs#5312 and godotengine/godot-docs#5315).

@madmiraal
Copy link
Contributor Author

Updated the config.gradle file and also took the liberty of upgrading the AGP to 7.0.3; since that has been released now too.

I've also reconfirmed that the PR still does not reintroduce #50623.

Note: The warning has also been updated to say that android.enableResourceOptimizations=false will be removed in version 8:

WARNING:The option setting 'android.enableResourceOptimizations=false' is deprecated.
The current default is 'true'.
It will be removed in version 8.0 of the Android Gradle plugin.

@@ -1,5 +1,5 @@
ext.versions = [
androidGradlePlugin: '4.2.2',
androidGradlePlugin: '7.0.3',
Copy link
Contributor

Choose a reason for hiding this comment

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

The javaVersion property below should be updated as well to JavaVersion.VERSION_11.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I've used the simple 11 format[1] to keep it tidy and consistent with the other entries.

[1] https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/CompileOptions#sourcecompatibility_1

@m4gr3d
Copy link
Contributor

m4gr3d commented Oct 13, 2021

Updated the config.gradle file and also took the liberty of upgrading the AGP to 7.0.3; since that has been released now too.

I've also reconfirmed that the PR still does not reintroduce #50623.

Note: The warning has also been updated to say that android.enableResourceOptimizations=false will be removed in version 8:

WARNING:The option setting 'android.enableResourceOptimizations=false' is deprecated.
The current default is 'true'.
It will be removed in version 8.0 of the Android Gradle plugin.

Sounds good! There is one more missing update (added a comment) and it should be good to go!

Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@akien-mga akien-mga merged commit 9782bd3 into godotengine:master Oct 14, 2021
@akien-mga
Copy link
Member

Thanks!

@madmiraal madmiraal deleted the upgrade-gradle branch October 14, 2021 18:36
@akien-mga
Copy link
Member

Cherry-picked for 3.4.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Oct 15, 2021
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.

4 participants