Slackbot
08/16/2022, 11:43 PMChris Lee
08/17/2022, 12:45 AMtasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
}
}
Eli Graber
08/17/2022, 12:53 AMChris Lee
08/17/2022, 12:55 AMtasks.named<KotlinCompile>("compileKotlin") {
kotlinOptions {
jvmTarget = "17"
}
}
Chris Lee
08/17/2022, 12:55 AMkotlin-dsl
and a different setting, one sec…Chris Lee
08/17/2022, 12:56 AMconfigure<KotlinDslPluginOptions> {
jvmTarget.set(kotlinPluginJvmVersion.toString())
}
Eli Graber
08/17/2022, 12:56 AMkotlin-dsl
plugin though.Chris Lee
08/17/2022, 1:00 AMkotlin-dsl
. Definitely don’t want to mix kotlin-dsl
into a Kotlin app/lib, that causes all manner of problems.Eli Graber
08/17/2022, 1:00 AMcompileOnly
dependency on gradleKotlinDsl()
is enough? That's what kotlin-dsl
doesChris Lee
08/17/2022, 1:01 AMChris Lee
08/17/2022, 1:03 AMkotlin-dsl
) AND a Kotlin app/lib (kotlin("jvm")
) at the same time.Chris Lee
08/17/2022, 1:04 AMplugins {
`kotlin-dsl`
kotlin("jvm") version "1.5.30-M1"
}
Eli Graber
08/17/2022, 1:08 AMChris Lee
08/17/2022, 1:09 AMconfigure<KotlinDslPluginOptions> {
jvmTarget.set("17")
}
Chris Lee
08/17/2022, 1:10 AMkotlin-dsl
, however best practices are to factor out imperative code into plugins, tasks, etc - place those in a build-logic composite project (or the older, less ideal buildSrc) with kotlin-dsl
.Eli Graber
08/17/2022, 1:25 AMkotlin-dsl
applied?Vampire
08/17/2022, 1:47 AMkotlin-dsl
sets by default, you have to be aware that you are effectively raising the minimum Java version needed to run the Gradle build to that version which usually is highly undesireable.Eli Graber
08/17/2022, 1:50 AMkotlin-dsl
.
usually is highly undesirable
So it would be fine if it were an internal app that is already committed to using that version of Java?
Vampire
08/17/2022, 1:55 AMI'm assuming it's about gradle logic because they specifically asked about not applyingI'm assuming it is not about Gralde logic because they specifically asked about nto applying.kotlin-dsl
kotlin-dsl
.
What should be the problem to apply if it is for Gradle logic?
For me it makes more sense that it is for non-Gradle logic bug by googling OP just found solutions involving kotlin-dsl
which he does not want to use as it is not for Gradle logic.Vampire
08/17/2022, 1:55 AMDaniel Singer
08/17/2022, 7:32 PMA project can’t be both a Gradle Kotlin DSL/plugin (So this is pretty much what I was trying to do but that doesn't work) AND a Kotlin app/lib (kotlin-dsl
) at the same time.kotlin("jvm")
I'm assuming it is not about Gralde logic because they specifically asked about nto applying.kotlin-dsl
What should be the problem to apply if it is for Gradle logic?It is for Gradle logic but is a problem because of the above But this is for internal use only anyway so I'll try the solution posted while keeping your warning in mind 🙂 Thanks for your help
Chris Lee
08/17/2022, 7:34 PMkotlin("jvm")
and use kotlin-dsl
. Doable?Daniel Singer
08/17/2022, 7:35 PMChris Lee
08/17/2022, 7:36 PM