Is there a simpler way to do the first thing, or d...
# community-support
t
Is there a simpler way to do the first thing, or do I have to configure it like that, at the task level? In contrast to the (different) thing below it
Copy code
tasks.withType<JavaCompile>().configureEach {
    options.release = 11
}

java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}
j
Afaik you have to do it on the task directly. IIRC, back in the day we had some controversial internal discussion about adding
release
as it is to the
java
extension. We ended up not doing it, because we wanted to do something "better" that fits well with toolchains and replaces
sourceCompatibility
/
targetCompatibility
as well. But I don't think this "better" solution was ever done. 😕 I always use
Copy code
tasks.withType<JavaCompile>().configureEach {
    options.release = 11
}
1
Yes: https://github.com/gradle/gradle/pull/12775 "will be introduced soon" - our most famous last words back then. 😬
😬 1
m
Shameless plug for tapmoc: https://gradleup.com/tapmoc/ It solves this and other things like setting
options.release
not working on Android (because Android has no
rt.jar
) and a bunch of other stuff
🤩 1
til 1
👆 1
t
I just discovered that plugin a couple of weeks ago and find it really interesting. I want to explore more to ensure I actually understand what it does 😄
dealing with Kotlin compat in gradle plugins is such a pain in the ass
m
It’s quite complex given the very small API surface ^^
But if it were simple, there would be no need for the plugin in the first place
I’m quite happy with the “flags” part. The
checkDependencies
part is a bit fragile because…. it’s hard to automatically get all outgoing variants in a random project.
I’m considering moving that complexity to the user
t
can I ask what the name means?
m
It's backward 'compat'
😃 2
‼️ 3
r
It's worth noting that there are some obscure gaps in
--release
like this one, plus the lack of coverage for JDK-internal classes. I almost always set
options.release
but sometimes I have to resort to toolchains