11import java.nio.file.Paths
22import java.util.Properties
33import kotlin.io.path.exists
4+ import org.gradle.api.plugins.JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME
5+ import org.jetbrains.kotlin.gradle.dsl.JvmDefaultMode
6+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
7+ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
48
59plugins {
610 alias(libs.plugins.kotlin.jvm)
@@ -15,6 +19,20 @@ tasks.validatePlugins {
1519 enableStricterValidation = true
1620}
1721
22+ val jdkRelease = " 17"
23+
24+ kotlin {
25+ compilerOptions {
26+ allWarningsAsErrors = true
27+ // https://docs.gradle.org/current/userguide/compatibility.html#kotlin
28+ apiVersion = KotlinVersion .KOTLIN_2_2
29+ languageVersion = apiVersion
30+ jvmTarget = JvmTarget .fromTarget(jdkRelease)
31+ jvmDefault = JvmDefaultMode .NO_COMPATIBILITY
32+ freeCompilerArgs.add(" -Xjdk-release=$jdkRelease " )
33+ }
34+ }
35+
1836gradlePlugin {
1937 vcsUrl = " https://github.com/ComposeGears/Valkyrie"
2038 website = " https://github.com/ComposeGears/Valkyrie"
@@ -30,6 +48,14 @@ gradlePlugin {
3048 }
3149}
3250
51+ configurations.named(API_ELEMENTS_CONFIGURATION_NAME ) {
52+ attributes.attribute(
53+ // TODO: https://github.com/gradle/gradle/issues/24608
54+ GradlePluginApiVersion .GRADLE_PLUGIN_API_VERSION_ATTRIBUTE ,
55+ objects.named(" 9.0.0" ),
56+ )
57+ }
58+
3359val sharedTestResourcesDir: File =
3460 project(projects.components.test.path)
3561 .layout
@@ -63,6 +89,10 @@ tasks.pluginUnderTestMetadata {
6389 pluginClasspath.from(testPluginClasspath)
6490}
6591
92+ tasks.withType<JavaCompile >().configureEach {
93+ options.release = jdkRelease.toInt()
94+ }
95+
6696dependencies {
6797 compileOnly(libs.agp.api)
6898 compileOnly(libs.kotlin.gradle.plugin)
0 commit comments