Skip to content

Commit

Permalink
jdkHome as internal and creating new jdkVersion input
Browse files Browse the repository at this point in the history
  • Loading branch information
cdsap authored and ting-yuan committed Feb 20, 2025
1 parent 004a917 commit b829009
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ abstract class KspAATask @Inject constructor(
// TODO: set proper jdk home
cfg.jdkHome.value(File(System.getProperty("java.home")))

val javaVersion = System.getProperty("java.version")?.split(".")?.let {
if (it[0] == "1") it.getOrNull(1) else it.getOrNull(0)
}
javaVersion?.let {
cfg.jdkVersion.value(it.toInt())
}

val jvmDefaultMode = compilerOptions.freeCompilerArgs
.map { args -> args.filter { it.startsWith("-Xjvm-default=") } }
.map { it.lastOrNull()?.substringAfter("=") ?: "disable" }
Expand Down Expand Up @@ -329,9 +336,12 @@ abstract class KspGradleConfig @Inject constructor() {
@get:Classpath
abstract val libraries: ConfigurableFileCollection

@get:Internal
abstract val jdkHome: Property<File>

@get:Input
@get:Optional
abstract val jdkHome: Property<File>
abstract val jdkVersion: Property<Int>

@get:Internal
abstract val projectBaseDir: Property<File>
Expand Down

0 comments on commit b829009

Please sign in to comment.