-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Java/Scala build with no explicit toolchain: build fails with Gradle 8.0.1 / Scala 2.13 #23962
Comments
A note for a Gradle team: I changed issue description above (too) many times, I had to make few more changes (somehow I managed to lose build scan URLs, so I had to create them again) Feel free to review now 🎉 |
Thanks for the report. We decided that Gradle 8 would introduce potential breaking changes with regards to Scala compile options. However the way it was done in Gradle 8.0 was too much of a breakage. In your case, I believe that Gradle 8.0.1 strikes the right balance but it means your build needs a change. Gradle 8.0.1 fails because you have
|
Hello, the build also doesn't work for us, Gradle 8.0.1, Scala 2.13.10. Still getting The documentation mentions that if one of the parameters is spefied then the logic is disabled, but this doesn't seem to be working, because we tried the following and still getting the same message (so
We tried also |
So it looks like the logic of Gradle for detecting the options has gaps. We use the following: Lines 39 to 46 in 5704be9
But that accounts only for Can you confirm this works if you move from space separated to |
Few things to unpack:
I assume that according to https://docs.gradle.org/8.0.1/userguide/scala_plugin.html#sec:scala_target paragraph
and given a fact that no toolchains are used Gradle should just add appropriate target parameter. However, results are still the same (environment: JDK 8 / Gradle 8.0.1):
@ljacomet I opted to keep this comment as short as possible, let me know in case you need some more details, build scans, etc. Note: Apache Kafka for JDK 8 builds avoids to use
|
Hi @dejan2609, I was mistaken on blaming But I see that we might be in a bad position here if:
However looking at the code you linked for Scala 2.13.10, I am sorry this is such a mess. I don't think that changing this further in patch releases make sense however. We might need a longer time to come up with a proper integration that respects all of these exceptions while not breaking users more. And given how changes to these flags appear in patch versions of Scala, I am not even sure we can come up with a scheme that is future proof. |
@dejan2609 We can change the Kafka build to always set the release flag with Scala 2.13 and conditionally set it with Scala 2.12 & Java >= 9. And source//target should only be set if release is not set. Hopefully that works with Gradle 8.0.1. |
@ijuma Makes sense. I went the other way and just pushed (like, minutes ago 😃) different draft solution (suppresion for one specific Scala compiler warning). @ljacomet I understand you point: you have to support quite a big matrix of JDK versions / Scala versions / toolchan and no-toolchain situations and on top of that comes plethora of compiler options; really hectic situation, to put it mildly. Kudos for your help 👍 and feel free to navigate this situation in whatever way you see fit. |
Thanks for your understanding and happy to hear you have a solution. Will keep this issue open for now to track any improvement we can do on the Gradle side for this. |
Hi, I guess the problem is that |
Gradle 8 related links: * https://github.com/gradle/gradle/releases/tag/v8.0.0 * https://github.com/gradle/gradle/releases/tag/v8.0.1 * https://docs.gradle.org/8.0.1/userguide/upgrading_version_7.html#changes_8.0 notes: * Javac and Scalac options are reshuffled (workaround for Gradle 8.0.1 bug: gradle/gradle#23962 (comment)) * spotless plugin task reference is removed (newer plugin versions require Java 11, so we can't use them until Kafka 4.0); plugin configuration is kept * jacoco version is bumped: 0.8.7 -->> 0.8.8 https://docs.gradle.org/8.0.1/userguide/jacoco_plugin.html#sec:configuring_the_jacoco_plugin
…ady configured in parameters Fixes #23962 When deciding whether to supply Java target from toolchain during Scala compilation configuration, we now detect more cases. More specifically, new cases include specifying a parameter and its value as separate values: ```groovy tasks.withType(ScalaCompile).configureEach { it.scalaCompileOptions.additionalParameters.addAll(['-release', '8']) } ``` An additional target flag variant for Scala 3 (`--Xtarget`) is also detected. Support for these flags in different minor releases of Scala varies, but we need to detect as many variants as possible to avoid overriding the target or release. The sources for Scala flags: - [Scala 2.12.17](https://github.com/scala/scala/blob/v2.13.10/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala#L54-L75) - [Scala 2.13.10](https://github.com/scala/scala/blob/v2.12.17/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala#L59-L82) - [Scala 3.2.2](https://github.com/lampepfl/dotty/blob/3.2.2/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala#L112) Co-authored-by: Alex Semin <asemin@gradle.com>
Improvements will be released in 8.0.2 which makes Gradle detect better when a flag was passed by hand, short circuiting the logic of Gradle itself. |
Release flag had to be added manually, additional context gradle/gradle#23962
Expected Behavior
Build should work with Gradle 8.0.1 and Scala 2.13
Current Behavior
--release
compiler argument #2510 (comment))Context
We are trying to upgrade Apache Kafka Gradle build (from 7 to 8) and we are facing issues with Gradle 8.0.1/Scala 2.13:
Compatibility matrix (for a PR mentioned above):
Gradle version 8.0.1:
Gradle version 8.0: (just move PR head to a previous commit like this: git checkout HEAD~1)
Gradle patch 8.0.1 changed some things related to Scala compile options, see this changes/issues:
target
flag #21551Gradle documentation for Scala plugin 8.0 vs. 8.0.1:
FYI @ljacomet Given all facts mentioned above chances are that this is a regression, but I will still wait for a triage and review by your team.
Notes:
Steps to Reproduce
gradle-8
Environment
The text was updated successfully, but these errors were encountered: