Skip to content

Conversation

@KengoTODA
Copy link
Contributor

Gradle 6.7+ provides the Toolchains for JVM projects, which makes it possible to specify which Java we use to compile the project. refs #187

Currently gradle-modules-plugin has two potential problems around this toolchain feature:

  1. By default the toolchain feature adds the --release option via javaCompile.options.release property, and it conflicts with the --release option set by this plugin. Fixed by the commit 6163723
* What went wrong:
Execution failed for task :greeter.toolchain:compileJava.
> Cannot specify --release via `CompileOptions.compilerArgs` when using `JavaCompile.release`.
  1. When a toolchain is enabled, the version of java compiler will be not the version of JVM running Gradle, but the version of JVM set via toolchain. So we should refer properties of the JavaToolchainSpec instead of JavaVersion.current(). Fixed by the commit 68ed16f
* What went wrong:
A problem occurred configuring project ':greeter.toolchain'.
> sourceCompatibility should not be set together with --release option

Based on the "Testing locally published plugin" guideline, I've confirmed that problems reproduced by the newly added test project have been resolved by these two commits.

Thanks for checking my PR! 🙌

KengoTODA and others added 6 commits March 2, 2022 10:40
> * What went wrong:
> Execution failed for task :greeter.toolchain:compileJava.
> > Cannot specify --release via `CompileOptions.compilerArgs` when using `JavaCompile.release`.
Gradle 6.6 has no toolchain support, but has javaCompile.options.release property.
using Java 17 breaks the build in GitHub Actions workflow, because
Java 17 has more strict control on the Java module.
@KengoTODA KengoTODA marked this pull request as draft March 2, 2022 04:34
@KengoTODA KengoTODA marked this pull request as ready for review March 2, 2022 05:32
@siordache siordache merged commit 2eda3ed into java9-modularity:master Aug 6, 2022
@siordache
Copy link
Collaborator

Thanks for this PR!

@KengoTODA KengoTODA deleted the support-toolchain branch August 6, 2022 22:44
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.

2 participants