mirror of
https://github.com/apple/pkl.git
synced 2026-03-22 09:09:15 +01:00
* Remove unnecessary strictfp modifier * Add annotations to address Truffle DSL warnings (@Idempotent, @Exclusive) * Adjust build logic to allow building cross-arch on macOS * Add warning suppression for specialization limit (left this one as a TODO)
68 lines
2.0 KiB
Kotlin
68 lines
2.0 KiB
Kotlin
@file:Suppress("HttpUrlsUsage")
|
|
|
|
import org.gradle.accessors.dm.LibrariesForLibs
|
|
|
|
plugins {
|
|
`java-library`
|
|
id("pklKotlinTest")
|
|
id("com.diffplug.spotless")
|
|
}
|
|
|
|
// make sources Jar available to other subprojects
|
|
val sourcesJarConfiguration = configurations.register("sourcesJar")
|
|
|
|
// Version Catalog library symbols.
|
|
val libs = the<LibrariesForLibs>()
|
|
|
|
java {
|
|
withSourcesJar() // creates `sourcesJar` task
|
|
withJavadocJar()
|
|
}
|
|
|
|
artifacts {
|
|
// make sources Jar available to other subprojects
|
|
add("sourcesJar", tasks["sourcesJar"])
|
|
}
|
|
|
|
spotless {
|
|
java {
|
|
googleJavaFormat(libs.versions.googleJavaFormat.get())
|
|
targetExclude("**/generated/**", "**/build/**")
|
|
licenseHeaderFile(rootProject.file("buildSrc/src/main/resources/license-header.star-block.txt"))
|
|
}
|
|
}
|
|
|
|
tasks.compileKotlin {
|
|
enabled = false
|
|
}
|
|
|
|
tasks.jar {
|
|
manifest {
|
|
attributes += mapOf("Automatic-Module-Name" to "org.${project.name.replace("-", ".")}")
|
|
}
|
|
}
|
|
|
|
tasks.javadoc {
|
|
classpath = sourceSets.main.get().output + sourceSets.main.get().compileClasspath
|
|
source = sourceSets.main.get().allJava
|
|
title = "${project.name} ${project.version} API"
|
|
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
|
|
}
|
|
|
|
val workAroundKotlinGradlePluginBug by tasks.registering {
|
|
doLast {
|
|
// Works around this problem, which sporadically appears and disappears in different subprojects:
|
|
// A problem was found with the configuration of task ':pkl-executor:compileJava' (type 'JavaCompile').
|
|
// > Directory '[...]/pkl/pkl-executor/build/classes/kotlin/main'
|
|
// specified for property 'compileKotlinOutputClasses' does not exist.
|
|
layout.buildDirectory.dir("classes/kotlin/main").get().asFile.mkdirs()
|
|
}
|
|
}
|
|
|
|
tasks.compileJava {
|
|
dependsOn(workAroundKotlinGradlePluginBug)
|
|
// TODO: determine correct limits for Truffle specializations
|
|
// (see https://graalvm.slack.com/archives/CNQSB2DHD/p1712380902746829)
|
|
options.compilerArgs.add("-Atruffle.dsl.SuppressWarnings=truffle-limit")
|
|
}
|