mirror of
https://github.com/apple/pkl.git
synced 2026-05-25 08:09:17 +02:00
98ab741c54
The current version of the kotlin-gradle plugin is not compatible with Gradle 9.1, causing error `java.lang.NoSuchMethodError: 'org.gradle.api.Project org.gradle.api.artifacts.ProjectDependency.getDependencyProject()'` Also, the Kotlin 2.0 language target is deprecated as of Kotlin 2.2.
52 lines
1.7 KiB
Kotlin
52 lines
1.7 KiB
Kotlin
/*
|
|
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
import org.gradle.accessors.dm.LibrariesForLibs
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
|
|
|
plugins {
|
|
id("pklJavaLibrary")
|
|
kotlin("jvm")
|
|
}
|
|
|
|
// Build configuration.
|
|
val buildInfo = project.extensions.getByType<BuildInfo>()
|
|
|
|
// Version Catalog library symbols.
|
|
val libs = the<LibrariesForLibs>()
|
|
|
|
dependencies {
|
|
// At least some of our kotlin APIs contain Kotlin stdlib types
|
|
// that aren't compiled away by kotlinc (e.g., `kotlin.Function`).
|
|
// So let's be conservative and default to `api` for now.
|
|
// For Kotlin APIs that only target Kotlin users (e.g., pkl-config-kotlin),
|
|
// it won't make a difference.
|
|
api(buildInfo.libs.findLibrary("kotlinStdLib").get())
|
|
}
|
|
|
|
tasks.compileKotlin {
|
|
enabled = true // disabled by pklJavaLibrary
|
|
}
|
|
|
|
tasks.withType<KotlinJvmCompile>().configureEach {
|
|
compilerOptions {
|
|
languageVersion = KotlinVersion.KOTLIN_2_1
|
|
jvmTarget = JvmTarget.fromTarget(buildInfo.jvmTarget.toString())
|
|
freeCompilerArgs.addAll("-Xjdk-release=${buildInfo.jvmTarget}")
|
|
}
|
|
}
|