nebula-release-plugin icon indicating copy to clipboard operation
nebula-release-plugin copied to clipboard

Using a relative git root breaks in java 1.14

Open shysteph opened this issue 4 years ago • 2 comments

If gralde.properties contains git.root=.. and the jvm running gradle then Grgit calculates the relative directory against the gradle daemon's working directory not the project. This doesn't happen when running java 1.8. If you run

./gradlew devSnapshot

in the child project of https://github.com/shysteph/nebula-release-plugin-bug on java 1.14 it will fail.
It will work on 1.8 or if a hack is applied by

./gradlew devSnapshot -Prelease.workCorrectly=true

shysteph avatar Nov 30 '20 19:11 shysteph

It appears that user.dir was never intended to be modified on either the command line or at runtime, so they cache the original working directory for use when resolving files:

  • https://bugs.openjdk.java.net/browse/JDK-8194154
  • https://github.com/openjdk/jdk/commit/4ea684bf31fc4e3cdee2ae51c0000a7b3e914151

It appears Gradle gets away with this for cases other than file system resolves by actually changing the process working directory:

  • https://github.com/gradle/gradle/blob/master/subprojects/native/src/main/java/org/gradle/internal/nativeintegration/processenvironment/AbstractProcessEnvironment.java#L79-L83
  • https://github.com/gradle/gradle/blob/master/subprojects/native/src/main/java/org/gradle/internal/nativeintegration/processenvironment/NativePlatformBackedProcessEnvironment.java#L41

But this will affect all uses of relative File or Path so I'll create a bug report on https://github.com/gradle/gradle/ so they're aware.

I added a comment to the pull request - the path should be resolved relative to the rootProject directory.

DanielThomas avatar Dec 01 '20 04:12 DanielThomas

Created https://github.com/gradle/gradle/issues/15380

DanielThomas avatar Dec 01 '20 04:12 DanielThomas