mirror of
https://github.com/apple/pkl.git
synced 2026-03-18 07:13:54 +01:00
* pkl-excutor tests: symlink 0.25.0 distribution into pkl-executable/build * Use `IoUtils.getPklHomeDir` in HttpClientBuilder * Simplify Exceptions.java * Enable testing for older pkl-executor distribution
83 lines
2.3 KiB
Kotlin
83 lines
2.3 KiB
Kotlin
import java.nio.file.Files
|
|
|
|
plugins {
|
|
pklAllProjects
|
|
pklJavaLibrary
|
|
pklPublishLibrary
|
|
pklKotlinTest
|
|
}
|
|
|
|
val pklDistributionCurrent: Configuration by configurations.creating
|
|
val pklHistoricalDistributions: Configuration by configurations.creating
|
|
|
|
// Because pkl-executor doesn't depend on other Pkl modules
|
|
// (nor has overlapping dependencies that could cause a version conflict),
|
|
// clients are free to use different versions of pkl-executor and (say) pkl-config-java-all.
|
|
// (Pkl distributions used by EmbeddedExecutor are isolated via class loaders.)
|
|
dependencies {
|
|
pklDistributionCurrent(project(":pkl-config-java", "fatJar"))
|
|
@Suppress("UnstableApiUsage")
|
|
pklHistoricalDistributions(libs.pklConfigJavaAll025)
|
|
|
|
implementation(libs.slf4jApi)
|
|
|
|
testImplementation(projects.pklCommonsTest)
|
|
testImplementation(projects.pklCore)
|
|
testImplementation(libs.slf4jSimple)
|
|
}
|
|
|
|
// TODO why is this needed? Without this, we get error:
|
|
// `Entry org/pkl/executor/EmbeddedExecutor.java is a duplicate but no duplicate handling strategy has been set.`
|
|
// However, we do not have multiple of these Java files.
|
|
tasks.named<Jar>("sourcesJar") {
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
named<MavenPublication>("library") {
|
|
pom {
|
|
url.set("https://github.com/apple/pkl/tree/main/pkl-executor")
|
|
description.set("""
|
|
Library for executing Pkl code in a sandboxed environment.
|
|
""".trimIndent())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir("src/main/java")
|
|
}
|
|
}
|
|
}
|
|
|
|
val prepareHistoricalDistributions by tasks.registering {
|
|
val outputDir = layout.buildDirectory.dir("pklHistoricalDistributions")
|
|
inputs.files(pklHistoricalDistributions.files())
|
|
outputs.dir(outputDir)
|
|
doLast {
|
|
val distributionDir = outputDir.get().asFile.toPath()
|
|
.also(Files::createDirectories)
|
|
for (file in pklHistoricalDistributions.files) {
|
|
val link = distributionDir.resolve(file.name)
|
|
if (!Files.isSymbolicLink(link)) {
|
|
if (Files.exists(link)) {
|
|
Files.delete(link)
|
|
}
|
|
Files.createSymbolicLink(link, file.toPath())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
val prepareTest by tasks.registering {
|
|
dependsOn(pklDistributionCurrent, prepareHistoricalDistributions)
|
|
}
|
|
|
|
tasks.test {
|
|
dependsOn(prepareTest)
|
|
}
|