Skip to content

Conversation

@dreis2211
Copy link
Contributor

Hi,

this PR updates the project to Gradle 6.2 and updates the Gradle Plugin accordingly to test against 6.1.1 in addition to the new default.

Cheers,
Christoph

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 18, 2020
@wilkinsona wilkinsona added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 18, 2020
@wilkinsona wilkinsona added this to the 2.3.0.M3 milestone Feb 18, 2020
@wilkinsona wilkinsona self-assigned this Feb 18, 2020
@wilkinsona
Copy link
Member

Thanks very much.

wilkinsona pushed a commit that referenced this pull request Feb 18, 2020
@dreis2211
Copy link
Contributor Author

@wilkinsona How do we deal with 2.2.x? Should I open a separate PR for addressing the Gradle Plugin compatibility?

@wilkinsona
Copy link
Member

If you have the time to do that, that'd be great. Thanks!

@vpavic
Copy link
Contributor

vpavic commented Feb 18, 2020

Minor note regarding the upgrade of Gradle - it's generally advisable to execute the wrapper task using the target Gradle version as there might be changes to wrapper scripts and/or binary.

In the particular case of Gradle 6.2, the gradlew.bat was updated.

@dreis2211
Copy link
Contributor Author

@vpavic It only showed line ending changes, so I felt this wasn't necessary. Do you see other changes?

@vpavic
Copy link
Contributor

vpavic commented Feb 18, 2020

$ git diff gradlew.bat
warning: CRLF will be replaced by LF in gradlew.bat.
The file will have its original line endings in your working directory
diff --git a/gradlew.bat b/gradlew.bat
index 9618d8d960..62bd9b9cce 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
 set APP_BASE_NAME=%~n0
 set APP_HOME=%DIRNAME%
 
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
 set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@dreis2211
Copy link
Contributor Author

dreis2211 commented Feb 18, 2020

Interesting....I only got this:

git diff gradlew.bat
warning: CRLF wird in gradlew.bat durch LF ersetzt.

So essentially the same warning as you but without any changes. Are you running on Windows or on Mac? I'm myself on a Mac.

@wilkinsona
Copy link
Member

Good catch, @vpavic. Thank you. I've pushed the updates to gradlew.bat in d8c309a.

@dreis2211
Copy link
Contributor Author

@wilkinsona Aren't you on a Mac as well? Really sorry for that, but it feels I had no chance here given that the update didn't make the necessary changes. 😞

Did you execute something else than ./gradlew wrapper --gradle-version=6.2?

@wilkinsona
Copy link
Member

Yeah, I'm on a Mac. I ran ./gradlew wrapper --no-scan.

@dreis2211
Copy link
Contributor Author

I always followed the official docs: https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:upgrading_wrapper . Seems like I should not do that again. Sorry guys

@dreis2211
Copy link
Contributor Author

I will report this to Gradle, if you don't mind.

@wilkinsona
Copy link
Member

FWIW, I think what you did to upgrade from 6.1 to 6.2 is right, @dreis2211. What I did (not specifying the version number) only worked because you'd already done the upgrade. Running ./gradlew wrapper --gradle-version=6.2 on 16111f1 (the commit immediately before the upgrade to 6.2) should update gradlew.bat, AFAIK.

@dreis2211
Copy link
Contributor Author

Nope, when I run this on a branch where the update wasn't done yet, the same thing happens. Only line ending changes

@wilkinsona
Copy link
Member

I just tried it and gradlew.bat wasn't updated:

$ git reset --hard 16111f126e707fb5064bab6150df7a77f54850ee
HEAD is now at 16111f126e Use query-less datasource validation by default
$ ./gradlew --no-scan --version

------------------------------------------------------------
Gradle 6.1.1
------------------------------------------------------------

Build time:   2020-01-24 22:30:24 UTC
Revision:     a8c3750babb99d1894378073499d6716a1a1fa5d

Kotlin:       1.3.61
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_202 (Oracle Corporation 25.202-b08)
OS:           Mac OS X 10.13.6 x86_64

$ ./gradlew wrapper --gradle-version=6.2 --no-scan
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

BUILD SUCCESSFUL in 38s
1 actionable task: 1 executed

$ git diff HEAD
warning: CRLF will be replaced by LF in gradlew.bat.
The file will have its original line endings in your working directory
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 1b16c34a71..b7c8c5dbf5 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists

If I run the wrapper task again, it updates gradlew.bat:

$ ./gradlew wrapper --gradle-version=6.2 --no-scan

BUILD SUCCESSFUL in 4s
1 actionable task: 1 executed
$ git diff HEAD
warning: CRLF will be replaced by LF in gradlew.bat.
The file will have its original line endings in your working directory
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 1b16c34a71..b7c8c5dbf5 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
diff --git a/gradlew.bat b/gradlew.bat
index 9618d8d960..62bd9b9cce 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
 set APP_BASE_NAME=%~n0
 set APP_HOME=%DIRNAME%
 
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
 set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Looks like you've found a bug.

@dreis2211
Copy link
Contributor Author

At least I'm not crazy. I will report this. And sorry for the inconvenience again.

@wilkinsona
Copy link
Member

No apology is necessary. You are still approximately 12323549783489723 in credit.

@vpavic
Copy link
Contributor

vpavic commented Feb 18, 2020

IMO there's nothing to report to Gradle. The wrapper task should preferably be executed using the newer Gradle version. It's technically not required to bump the Gradle version used by the project but IMO it is a good practice to ensure you pick up any updates to wrapper scripts/binary.

When you do ./gradlew wrapper --gradle-version=6.2 the wrapper task will be executed using Gradle version that's currently associated with the project. Subsequent invocation of ./gradlew wrapper (no --gradle-version) will then be executed using 6.2.

FWIW my preferred approach to upgradle Gradle is to execute wrapper task using SDKMAN managed local installation of Gradle. That way I upgrade Gradle via SDKMAN first, and then simply use gradle wrapper (notice no wrapper) to upgrade across different projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task A general task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants