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

Gradle updates #507

Merged
merged 2 commits into from
Nov 21, 2018
Merged

Gradle updates #507

merged 2 commits into from
Nov 21, 2018

Conversation

dpogue
Copy link
Member

@dpogue dpogue commented Sep 26, 2018

Platforms affected

Android

What does this PR do?

  • Updates to latest version of the Android gradle plugin (3.2.0)
  • Updates gradle to the minimum version required by that plugin (4.6)
  • Fixes a gradle warning about LeftShift Closure being deprecated
  • Fixes a gradle warning about publishNonDefault being deprecated
  • Uses the google() repo syntax to reference the Google maven repository
  • Updates the Github/project URLs for maven artifacts
  • Fixes a handful of deprecation warnings happening inside the CordovaLib classes

In theory, this should fix the NDK issues reported in #504 due to outdated gradle versions.

What testing has been done on this change?

Nothing yet 🙃

Checklist

  • Reported an issue: NDK 18 toolchains #504
  • Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
  • Added automated test coverage as appropriate for this change.

@project-bot project-bot bot added this to new/unassigned/reopened prs in Apache Cordova: project-bot automation testing Sep 26, 2018
@@ -5,7 +5,7 @@ environment:
GRADLE_OPTS: -Dorg.gradle.daemon=false

# URL for SDK Tools, Revision 26.1.1 (September 2017)
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the version here is no longer correct with this change

Copy link
Member Author

Choose a reason for hiding this comment

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

Supposedly 26.1.1 is still the latest, but the download link doesn't match what was here before 😕

appveyor.yml Outdated

- choco install gradle --version 3.4.1
- choco install gradle --version 4.6.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, this should install the minimum version of Gradle needed to generate the wrapper with our actually required version. At least that was true before this change.

@codecov-io
Copy link

codecov-io commented Sep 26, 2018

Codecov Report

Merging #507 into master will decrease coverage by 0.24%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #507      +/-   ##
==========================================
- Coverage   62.11%   61.87%   -0.25%     
==========================================
  Files          17       17              
  Lines        1985     1975      -10     
  Branches      371      366       -5     
==========================================
- Hits         1233     1222      -11     
- Misses        752      753       +1
Impacted Files Coverage Δ
...n/templates/cordova/lib/builders/ProjectBuilder.js 44.55% <0%> (ø) ⬆️
bin/templates/cordova/lib/pluginHandlers.js 85.71% <0%> (-1.43%) ⬇️

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 f1396c7...47bb518. Read the comment docs.

@oliversalzburg
Copy link

oliversalzburg commented Sep 26, 2018

I think you missed to replace one location with google(): https://github.com/apache/cordova-android/blob/master/bin/templates/cordova/lib/plugin-build.gradle#L23

Apps builds, deploys and runs fine with that piece adjusted.

@oliversalzburg
Copy link

I'm also seeing this in the sync log:

Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.

https://stackoverflow.com/questions/47300679/configuration-compile-in-is-deprecated-but-all-configurations-are-implementa says to upgrade gradle to 3.2.0, which resolves the warning for me.

@oliversalzburg
Copy link

oliversalzburg commented Sep 26, 2018

I'm also seeing

publishNonDefault is deprecated and has no effect anymore. All variants are now published.

Removing https://github.com/apache/cordova-android/blob/master/bin/templates/cordova/lib/plugin-build.gradle#L49 resolves the warning.

@dpogue
Copy link
Member Author

dpogue commented Nov 1, 2018

The SDK version should be moved from https://github.com/apache/cordova-android/blob/master/bin/templates/project/AndroidManifest.xml#L48 to https://github.com/apache/cordova-android/blob/master/bin/templates/project/app/build.gradle#L165

See #508 for additional discussion around that point.
Short answer is that you're right, longer answer is that it's complicated.

@dpogue dpogue force-pushed the gradle-updates branch 2 times, most recently from 07574ac to 8286353 Compare November 1, 2018 05:08
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

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

Other then the one question I posted below, I feel that the changes are OK.

test/wrapper.gradle Show resolved Hide resolved
Apache Cordova: Platform Pull Requests automation moved this from ⏳ Ready for Review to ✅ Approved, waiting for Merge Nov 5, 2018
@project-bot project-bot bot moved this from new/unassigned/reopened prs to accepted prs in Apache Cordova: project-bot automation testing Nov 5, 2018
@dpogue dpogue force-pushed the gradle-updates branch 2 times, most recently from 58f46de to baf09c0 Compare November 6, 2018 04:36
@dpogue dpogue closed this Nov 6, 2018
Apache Cordova: Platform Pull Requests automation moved this from ✅ Approved, waiting for Merge to ☠️ Closed/Abandoned Nov 6, 2018
@dpogue dpogue reopened this Nov 6, 2018
@project-bot project-bot bot moved this from accepted prs to closed prs in Apache Cordova: project-bot automation testing Nov 6, 2018
Apache Cordova: Platform Pull Requests automation moved this from ☠️ Closed/Abandoned to 🐣 New PR / Untriaged Nov 6, 2018
@project-bot project-bot bot moved this from closed prs to new/unassigned/reopened prs in Apache Cordova: project-bot automation testing Nov 6, 2018
}

// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
// Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html
ext {
apply from: '../CordovaLib/cordova.gradle'

// The value for android.compileSdkVersion.
if (!project.hasProperty('cdvCompileSdkVersion')) {
cdvCompileSdkVersion = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove semicolon here (as proposed in PR #441)?

Copy link
Member

Choose a reason for hiding this comment

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

What does this have to do with this PR?

@project-bot project-bot bot moved this from new/unassigned/reopened prs to accepted prs in Apache Cordova: project-bot automation testing Nov 12, 2018
}
}

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
repositories {
mavenCentral();
mavenCentral()
Copy link
Contributor

Choose a reason for hiding this comment

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

Add google() or replace mavenCentral() with google() here, as suggested in https://github.com/apache/cordova-android/pull/441/files/478450fe4fe6a7b06e15d2b68facf0aecd63a27e#r228693626?

Copy link
Member

Choose a reason for hiding this comment

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

What has #441 to do with this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Updates and suggestions in #441 may be relevant here. This PR is to update Gradle in general. #441 was raised to introduce Kotlin support but it did include some general updates that I think we should consider outside of adding the Kotlin support.

@brodybits
Copy link
Contributor

I raised a few comments based on PR #441. Should we address these?

Is this ready to be merged?

@dpogue
Copy link
Member Author

dpogue commented Nov 12, 2018

I believe this is ready to be merged, but I'm not sure what you think it has to do with #441, which is proposing the addition of an entirely different feature.

This PR is updating gradle versions for compatibility with the latest Android SDK.
Kotlin support is out of scope here.

@brodybits
Copy link
Contributor

I understand that Kotlin is out of scope. But I think some suggestions in #441 should be considered since they seem to be outside the scope of adding Kotlin.

@brodybits
Copy link
Contributor

Or should some of the suggestions be considered in yet another PR?

jcenter()
}
}

task wrapper(type: Wrapper) {
gradleVersion = '4.4.0'
gradleVersion = '4.6.0'

Choose a reason for hiding this comment

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

Any reason for not using the latest 4.10.2? It should deliver better build speeds and other benefits.

Copy link
Member Author

Choose a reason for hiding this comment

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

Historically we've targeted the minimum required version of gradle

Choose a reason for hiding this comment

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

Is there some specific reason for targeting the minimum version? I don't think that targeting older versions has benefits over targeting newer versions. Also, Gradle development between 4.6 and 4.10 greatly focused on speed

Copy link
Member

Choose a reason for hiding this comment

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

(Might be worth opening a whole new issue about this thing so it doesn't get buried here)

Choose a reason for hiding this comment

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

Also, as I mentioned in #596 - Since Gradle 4.9 it is possible to build App Bundle - a better way to publish apps to the Play Store.
Currently, Cordova doesn't support this and I have to manually change the app manifests after each build.

@erisu erisu merged commit 2163c8a into apache:master Nov 21, 2018
Apache Cordova: Platform Pull Requests automation moved this from 🐣 New PR / Untriaged to 🏆 Merged, waiting for Release Nov 21, 2018
@project-bot project-bot bot moved this from accepted prs to merged prs in Apache Cordova: project-bot automation testing Nov 21, 2018
@project-bot project-bot bot moved this from merged prs to accepted prs in Apache Cordova: project-bot automation testing Nov 21, 2018
@dpogue dpogue deleted the gradle-updates branch November 21, 2018 06:27
@dpogue dpogue mentioned this pull request Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Apache Cordova: Platform Pull Requests
🏆 Merged, waiting for Release
Development

Successfully merging this pull request may close these issues.

None yet

10 participants