redmaster east
12/26/2024, 3:23 AM> Task :buildSrc:compileKotlin
Kotlin does not yet support 23 JDK target, falling back to Kotlin JVM_22 JVM target
w: Inconsistent JVM-target compatibility detected for tasks 'compileJava' (23) and 'compileKotlin' (22).
This will become an error in Gradle 8.0.
Scan: https://scans.gradle.com/s/amckdnzxgc3ni
What is the best way to handle this?
Setting kotlin.jvmToolchain(22)
fixes it on windows, but on arm mac it can't find a toolchain. Is there some specific java version recommended?
Scan from mac: https://scans.gradle.com/s/ritdchcfwbajy
I do have foojay toolchain plugin setup for this projectJavi
12/26/2024, 10:02 AMVampire
12/26/2024, 10:12 AMredmaster east
12/26/2024, 6:50 PMplugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
}
redmaster east
12/26/2024, 6:57 PMplugins {
id("org.gradle.toolchains.foojay-resolver-convention")
}
to buildSrc's settings.gradle.kts does not seem to download the toolchain https://scans.gradle.com/s/kkbgyzueqk7hyredmaster east
12/26/2024, 11:27 PMKotlin does not yet support 23 JDK target, falling back to Kotlin JVM_22 JVM target
also seems to appear when just running gradle, gradle is running on java 23, but the only kotlin in the project is the build scripts.
Is this something I need to worry about? Considering that the original deperacation warning said gradle 8.0 but I am on 8.12 is what is confusing me.Vampire
12/26/2024, 11:42 PMfoojay is setup and has been working, it is set in the root project's settings.gradle.ktsWell, I can just interpret what I see. And the Mac build said it is not configured for
buildSrc
which is also confirmed by the build scan which shows that the foojay convention plugin is not in the build dependencies of the buildSrc
build..
What you have in the root project is not so relevant.
If you want to use an auto-provisioned JVM toolchain in the buildSrc
build, you need to configure it there, it is a separate build.
to buildSrc's settings.gradle.kts does not seem to download the toolchain https://scans.gradle.com/s/kkbgyzueqk7hyThat scan also does not look like you applied the plugin in the
buildSrc
build.
And the error you get is a different one.
You have a dependency on something that needs at least Java 22 while you use Java 21 for building, which also suggests that you did not configure a Java 22 toolchain for the buildSrc
build, but use the JVM running Gradle which in this Scan is a Java 21.
the only kotlin in the project is the build scriptsThat's not really true. You have precompiled script plugins in Kotlin DSL and a Kotlin class in
buildSrc
.
And buildSrc
building is where the message comes from as there you use a Java version not compatible with the Kotlin version you use for that.
Considering that the original deperacation warning said gradle 8.0 but I am on 8.12 is what is confusing me.That probably means you are lucky and it was planned to become an error in Gradle 8 but was moved to a later point in time while not adjusting the message to mention a later version. This I'd recommend you report as bug to Gradle, because that makes no sense at all.
redmaster east
12/27/2024, 12:01 AMVampire
12/27/2024, 12:02 AMbuildSrc
is a completely standalone build that just "happens" to be built before your main build and the result put in a class loader that is the parent of the root project classpath class loaderredmaster east
12/27/2024, 12:06 AMVampire
12/27/2024, 12:08 AMredmaster east
12/27/2024, 12:10 AMredmaster east
12/27/2024, 12:10 AMVampire
12/27/2024, 12:11 AMbuildSrc
, then at least that issue you just linked to should not hit you 🙂redmaster east
12/27/2024, 12:12 AMVampire
12/27/2024, 12:18 AMbuildSrc
, an included build, or published somewhere.
If you talk about the ...gradle.kts
files, those are "precompiled script plugins" which is a popular way to write convention plugins.
But either way, whatever you can do in buildSrc
you can also do in an included build and I'd usually always would prefer those.
Actually, there are a few exceptions, like when you need to monkey-patch a 3rd party plugin class which you can only do from buildSrc
.
Well, no even that you can do from an included build if you add it to the settings script classpath.redmaster east
12/27/2024, 12:19 AMaij.*-convention
files)redmaster east
12/27/2024, 12:20 AMVampire
12/27/2024, 12:21 AMVampire
12/27/2024, 12:27 AMbuildSrc
to included build would probably already solve your problem I guess.
So if you consider switching anyway, I'd do it first 🙂Vampire
12/27/2024, 12:31 AMredmaster east
12/27/2024, 12:31 AMVampire
12/27/2024, 12:33 AMid("aij.java-conventions") apply false
.
But unfortunately the error persisted.Vampire
12/27/2024, 12:38 AMjvmToolchain
you build in buildSrc
classes for Java 22+.
The main build is the consumer of those buildSrc
classes so the JVM running Gradle is what has to be able to use it.
As on the mac machine this is Java 21, it cannot work with the buildSrc
classes that were built for Java 22+.Vampire
12/27/2024, 12:41 AMjvmToolchain
call only when on Java 23+,
or change your check that ensures Java 11+ is used to run Gradle to ensure Java 22+ is used,
or use the incubating daemon jvm criteria to ensure a specific JVM is used to run the Gradle build.
(For the latter you currently have to make sure the specified JVM is installed and found by lookup, auto-provisioning is not yet possible)redmaster east
12/27/2024, 12:42 AMVampire
12/27/2024, 12:45 AMbuildSrc
the lowest you want your build to support running with.
As you restricted this to Java 11+ because of JGit, Java 11 is probably a good choice for buildSrc
.
Otherwise Java 8 as that is the lowest version supported by Gradle currently.Vampire
12/27/2024, 12:46 AMredmaster east
12/27/2024, 12:51 AMredmaster east
12/27/2024, 12:52 AMVampire
12/27/2024, 12:59 AMredmaster east
12/27/2024, 1:00 AMVampire
12/27/2024, 1:00 AMVampire
12/27/2024, 1:01 AMVampire
12/27/2024, 1:01 AMVampire
12/27/2024, 1:05 AMredmaster east
12/27/2024, 1:07 AMredmaster east
12/27/2024, 1:07 AMVampire
12/27/2024, 1:12 AMredmaster east
12/27/2024, 1:13 AMpackageAij
redmaster east
12/27/2024, 1:13 AMtasks.named(packageTaskName) {
dependsOn(unzipTaskName, "commonFiles")
mustRunAfter("commonFiles", deleteTaskName)
}
tasks.named("packageAij") {
group = "AstroImageJ Development"
dependsOn(packageTaskName)
outputs.upToDateWhen { false }
}
Vampire
12/27/2024, 1:21 AMoutputs.upToDateWhen { false }
is pretty much non-sense as it is no-op.
The task does not have actions anyway.
And even if it would have, that would not be the right way to make it "always out-of-date".Vampire
12/27/2024, 1:22 AMonlyIf { false }
is better done as enabled = false
😄Vampire
12/27/2024, 1:23 AMpackageAij
task, the download tasks are run in parallelVampire
12/27/2024, 1:24 AMgw downloadJavaRuntimeForLinux_x86_64Bit downloadJavaRuntimeForMacos_arm_64Bit downloadJavaRuntimeForMacos_x86_64Bit downloadJavaRuntimeForWindows_x86_64Bit
Vampire
12/27/2024, 1:24 AMredmaster east
12/27/2024, 1:25 AMpackageAIj
for everythingVampire
12/27/2024, 1:26 AMredmaster east
12/27/2024, 1:28 AMVampire
12/27/2024, 1:31 AMredmaster east
12/27/2024, 1:34 AMVampire
12/27/2024, 1:37 AMredmaster east
12/27/2024, 1:41 AMVampire
12/27/2024, 1:52 AMredmaster east
12/27/2024, 1:55 AMVampire
12/27/2024, 1:58 AMtasks.register(packageTaskName)
the unzip tasks run in parallelredmaster east
12/27/2024, 2:00 AM.named
part where I added the deps?Vampire
12/27/2024, 2:01 AMVampire
12/27/2024, 2:02 AMnotCompatibleWithConfigurationCache
redmaster east
12/27/2024, 2:02 AMVampire
12/27/2024, 2:03 AMVampire
12/27/2024, 2:03 AMVampire
12/27/2024, 2:03 AMVampire
12/27/2024, 2:03 AMredmaster east
12/27/2024, 2:04 AMVampire
12/27/2024, 2:05 AMVampire
12/27/2024, 2:05 AMVampire
12/27/2024, 2:06 AMredmaster east
12/27/2024, 2:08 AMVampire
12/27/2024, 2:08 AMVampire
12/27/2024, 2:09 AMVampire
12/27/2024, 2:09 AMredmaster east
12/27/2024, 2:10 AMArchiveOperations
documentation being wrong. I don't want to go adding deps to his plugin without talking to him first
so a custom Sync
task with the worker API?Vampire
12/27/2024, 2:13 AMVampire
12/27/2024, 2:14 AMVampire
12/27/2024, 2:14 AMso a customMaybe, yes, never tried something like that. But that should enable the tasks to run in parallel even without CC.task with the worker API?Sync
redmaster east
12/27/2024, 2:22 AM