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

[major] feat: Gradle 6.5 & Android Gradle plugin 4.0.0 updates #988

Merged

Conversation

brodycj
Copy link

@brodycj brodycj commented Jun 5, 2020

Platforms affected

Android

Motivation and Context

  • Android Studio 4.0 recommended updating to multiple build.gradle
  • Gradle 6.1.1 update seems to be required to build with Android Gradle plugin 4.0.0 update, may as well go with Gradle 6.5 update

I think it would be ideal if we could make this update before shipping the new major 9.0.0 release.

Description

  • update to use Gradle 6.5
  • update the following build.gradle files as suggested by Android Studio 4.0:
    • bin/templates/project/app/build.gradle
    • bin/templates/project/build.gradle
    • framework/build.gradle

Note that this proposal would effectively overwrite some or all changes from the following PRs:

/cc @erisu @breautek

Testing

  • tested with command-line build from Cordova CLI
  • tested with Android Studio 4.0

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2020

Codecov Report

Merging #988 into master will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #988   +/-   ##
=======================================
  Coverage   68.11%   68.11%           
=======================================
  Files          21       21           
  Lines        1866     1866           
=======================================
  Hits         1271     1271           
  Misses        595      595           
Impacted Files Coverage Δ
...n/templates/cordova/lib/builders/ProjectBuilder.js 73.21% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 287bfcb...766a09c. Read the comment docs.

@breautek
Copy link
Contributor

breautek commented Jun 5, 2020

Should also update the two gradle wrapper files in the tests at:

https://github.com/apache/cordova-android/blob/master/test/android/wrapper.gradle
https://github.com/apache/cordova-android/blob/master/test/androidx/wrapper.gradle

Also their respective build.gradle files for the android gradle plugin, which currently is still at version 3.6.0

@mosabab
Copy link
Contributor

mosabab commented Jun 6, 2020

Should also update the two gradle wrapper files in the tests at:

https://github.com/apache/cordova-android/blob/master/test/android/wrapper.gradle
https://github.com/apache/cordova-android/blob/master/test/androidx/wrapper.gradle

Also their respective build.gradle files for the android gradle plugin, which currently is still at version 3.6.0

@breautek
I build my android release version with cordova:
cordova build android --release

Could you please check this message when I build my app?

Untitled-2

Does this message normal ?
Because I can see some warnings for Gradle .....etc
The build success but i need to know if this normal or there may be some issues?

Please note that the following is insatlled in my pc:

  • The latest cordova cli v 9.0.0
  • Gradle v6.5
  • Android Studio Latest Version v4.0 with with sdk 29.
  • cordova-android.git#master version.
  • JDK 8 (jdk1.8.0_251)
  • Node.js v12.18.0

Thanks
Regards

@breautek
Copy link
Contributor

breautek commented Jun 6, 2020

Yes, that's normal. Gradle always appear to have deprecation warnings, but if you use gradle directly with the stacktrace flag, then you'll see that the faulting code comes from gradle itself.

@mosabab
Copy link
Contributor

mosabab commented Jun 6, 2020

Yes, that's normal. Gradle always appear to have deprecation warnings, but if you use gradle directly with the stacktrace flag, then you'll see that the faulting code comes from gradle itself.

Thanks for the clarification

@brodycj
Copy link
Author

brodycj commented Jun 7, 2020

Should also update the two gradle wrapper files in the tests at:

https://github.com/apache/cordova-android/blob/master/test/android/wrapper.gradle
https://github.com/apache/cordova-android/blob/master/test/androidx/wrapper.gradle

I was actually wondering why keep updating those 2 files while bin/templates/project/wrapper.gradle is kept blank with a comment.

Also their respective build.gradle files for the android gradle plugin, which currently is still at version 3.6.0

The following spec & test build.gradle files also seemed to be out-of-date with respect to the build.gradle files that I had updated.

From a search I did also find bin/templates/project/legacy/build.gradle, wonder if we really want to keep supporting it or not.

I would definitely be happy to update the test Gradle files if needed, just wanted to understand what we should be keeping up-to-date and if there is anything we should not be supporting any longer.

@breautek
Copy link
Contributor

breautek commented Jun 8, 2020

The project/legacy files is from beyond my time, I'm not sure the purpose, but it doesn't appear to be used.

I would definitely be happy to update the test Gradle files if needed, just wanted to understand what we should be keeping up-to-date and if there is anything we should not be supporting any longer.

The test gradle files should be kept in sync, otherwise the unit tests won't be ran under the same configuration as the runtime when the project is installed.

@brodycj
Copy link
Author

brodycj commented Jun 8, 2020

I tried copying the updated Gradle files, now leads to a build error. Any ideas?

@brodycj brodycj added this to the 9.0.0 milestone Jun 8, 2020
@brodycj brodycj force-pushed the gradle-6.5-and-android-gradle-4-updates branch from f212884 to ae3d873 Compare June 8, 2020 16:56
@brodycj brodycj marked this pull request as ready for review June 8, 2020 18:48
@brodycj
Copy link
Author

brodycj commented Jun 8, 2020

I have updated the test Gradle files as requested. There seems to be quite a major difference between the template Gradle files and test Gradle files, and I hope this can be fixed someday.

Copy link
Contributor

@breautek breautek left a comment

Choose a reason for hiding this comment

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

I think this needs to be updated to 6.5 as well

task wrapper(type: Wrapper) {
gradleVersion = '6.1'
}

(Eventually I want to create some sort of script that will change all these versions in different places automatically for us...)

@brodycj brodycj marked this pull request as draft June 9, 2020 00:14
@brodycj brodycj marked this pull request as ready for review June 9, 2020 00:37
@brodycj
Copy link
Author

brodycj commented Jun 9, 2020

  • build is still green
  • tested with my cordova-sqlite-storage test app with build & run from Cordova CLI
  • tested adding to my cordova-sqlite-storage test app but with build & run from Android Studio 4.0

Merging now, thanks to @breautek for the quick reviews!

@brodycj brodycj merged commit 305cb2c into apache:master Jun 9, 2020
@brodycj brodycj deleted the gradle-6.5-and-android-gradle-4-updates branch June 9, 2020 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants