mirror of
https://github.com/apple/pkl.git
synced 2026-07-17 10:31:17 +02:00
Migrate Gradle delegated properties (#1782)
There were some more that we missed last time around
This commit is contained in:
@@ -22,11 +22,11 @@ plugins {
|
|||||||
signing
|
signing
|
||||||
}
|
}
|
||||||
|
|
||||||
val pklCodegenJava: Configuration by configurations.creating
|
val pklCodegenJava: Configuration = configurations.create("pklCodegenJava")
|
||||||
val firstPartySourcesJars by configurations.existing
|
val firstPartySourcesJars = configurations.named("firstPartySourcesJars")
|
||||||
|
|
||||||
val generateTestConfigClasses by
|
val generateTestConfigClasses =
|
||||||
tasks.registering(JavaExec::class) {
|
tasks.register<JavaExec>("generateTestConfigClasses") {
|
||||||
val outputDir = layout.buildDirectory.dir("testConfigClasses")
|
val outputDir = layout.buildDirectory.dir("testConfigClasses")
|
||||||
outputs.dir(outputDir)
|
outputs.dir(outputDir)
|
||||||
inputs.dir("src/test/resources/codegenPkl")
|
inputs.dir("src/test/resources/codegenPkl")
|
||||||
@@ -45,13 +45,13 @@ tasks.processTestResources { dependsOn(generateTestConfigClasses) }
|
|||||||
|
|
||||||
tasks.compileTestKotlin { dependsOn(generateTestConfigClasses) }
|
tasks.compileTestKotlin { dependsOn(generateTestConfigClasses) }
|
||||||
|
|
||||||
val bundleTests by tasks.registering(Jar::class) { from(sourceSets.test.get().output) }
|
val bundleTests = tasks.register<Jar>("bundleTests") { from(sourceSets.test.get().output) }
|
||||||
|
|
||||||
// Runs unit tests using jar'd class files as a source.
|
// Runs unit tests using jar'd class files as a source.
|
||||||
// This is to test loading the ClassRegistry from within a jar, as opposed to directly from the file
|
// This is to test loading the ClassRegistry from within a jar, as opposed to directly from the file
|
||||||
// system.
|
// system.
|
||||||
val testFromJar by
|
val testFromJar =
|
||||||
tasks.registering(Test::class) {
|
tasks.register<Test>("testFromJar") {
|
||||||
dependsOn(bundleTests)
|
dependsOn(bundleTests)
|
||||||
|
|
||||||
testClassesDirs = files(tasks.test.get().testClassesDirs)
|
testClassesDirs = files(tasks.test.get().testClassesDirs)
|
||||||
|
|||||||
@@ -138,36 +138,37 @@ tasks.withType<JavaCompile>().configureEach {
|
|||||||
|
|
||||||
tasks.compileKotlin { enabled = false }
|
tasks.compileKotlin { enabled = false }
|
||||||
|
|
||||||
val externalReaderFixture by tasks.registering {
|
val externalReaderFixture =
|
||||||
group = "build"
|
tasks.register("externalReaderFixture") {
|
||||||
dependsOn(tasks.named("compileExternalReaderFixtureJava"))
|
group = "build"
|
||||||
inputs.files(externalReaderFixtureSourceSet.map { it.output })
|
dependsOn(tasks.named("compileExternalReaderFixtureJava"))
|
||||||
val fileName = if (buildInfo.os.isWindows) "externalreader.bat" else "externalreader"
|
inputs.files(externalReaderFixtureSourceSet.map { it.output })
|
||||||
val outputFile = layout.buildDirectory.file("fixtures/$fileName")
|
val fileName = if (buildInfo.os.isWindows) "externalreader.bat" else "externalreader"
|
||||||
outputs.file(outputFile)
|
val outputFile = layout.buildDirectory.file("fixtures/$fileName")
|
||||||
doLast {
|
outputs.file(outputFile)
|
||||||
val classpath = externalReaderFixtureSourceSet.get().runtimeClasspath.asPath
|
doLast {
|
||||||
val scriptContent =
|
val classpath = externalReaderFixtureSourceSet.get().runtimeClasspath.asPath
|
||||||
if (buildInfo.os.isWindows) {
|
val scriptContent =
|
||||||
"""
|
if (buildInfo.os.isWindows) {
|
||||||
|
"""
|
||||||
@echo off
|
@echo off
|
||||||
java -cp $classpath org.pkl.core.externalreaderfixture.Main
|
java -cp $classpath org.pkl.core.externalreaderfixture.Main
|
||||||
"""
|
"""
|
||||||
.trimIndent()
|
.trimIndent()
|
||||||
} else {
|
} else {
|
||||||
"""
|
"""
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
java -cp $classpath org.pkl.core.externalreaderfixture.Main
|
java -cp $classpath org.pkl.core.externalreaderfixture.Main
|
||||||
"""
|
"""
|
||||||
.trimIndent()
|
.trimIndent()
|
||||||
}
|
}
|
||||||
|
|
||||||
outputFile.get().asFile.writeText(scriptContent)
|
outputFile.get().asFile.writeText(scriptContent)
|
||||||
outputFile.get().asFile.setExecutable(true)
|
outputFile.get().asFile.setExecutable(true)
|
||||||
println("Created external reader ${outputFile.get().asFile.absolutePath}")
|
println("Created external reader ${outputFile.get().asFile.absolutePath}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
configureTest()
|
configureTest()
|
||||||
@@ -195,8 +196,8 @@ tasks.test {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val generateBaseModuleMembers by
|
val generateBaseModuleMembers =
|
||||||
tasks.registering(JavaExec::class) {
|
tasks.register<JavaExec>("generateBaseModuleMembers") {
|
||||||
group = "build"
|
group = "build"
|
||||||
|
|
||||||
val outputDir = layout.buildDirectory.dir("generated/sources/baseModuleMembers")
|
val outputDir = layout.buildDirectory.dir("generated/sources/baseModuleMembers")
|
||||||
@@ -227,8 +228,8 @@ tasks.compileJava { dependsOn(generateBaseModuleMembers) }
|
|||||||
|
|
||||||
tasks.sourcesJar { dependsOn(generateBaseModuleMembers) }
|
tasks.sourcesJar { dependsOn(generateBaseModuleMembers) }
|
||||||
|
|
||||||
val testJavaExecutable by
|
val testJavaExecutable =
|
||||||
tasks.registering(Test::class) {
|
tasks.register<Test>("testJavaExecutable") {
|
||||||
configureExecutableTest("LanguageSnippetTestsEngine")
|
configureExecutableTest("LanguageSnippetTestsEngine")
|
||||||
classpath =
|
classpath =
|
||||||
// compiled test classes
|
// compiled test classes
|
||||||
@@ -247,38 +248,38 @@ val testJavaExecutable by
|
|||||||
|
|
||||||
tasks.check { dependsOn(testJavaExecutable) }
|
tasks.check { dependsOn(testJavaExecutable) }
|
||||||
|
|
||||||
val testMacExecutableAmd64 by
|
val testMacExecutableAmd64 =
|
||||||
tasks.registering(Test::class) {
|
tasks.register<Test>("testMacExecutableAmd64") {
|
||||||
dependsOn(":pkl-cli:macExecutableAmd64")
|
dependsOn(":pkl-cli:macExecutableAmd64")
|
||||||
configureExecutableTest("MacAmd64LanguageSnippetTestsEngine")
|
configureExecutableTest("MacAmd64LanguageSnippetTestsEngine")
|
||||||
}
|
}
|
||||||
|
|
||||||
val testMacExecutableAarch64 by
|
val testMacExecutableAarch64 =
|
||||||
tasks.registering(Test::class) {
|
tasks.register<Test>("testMacExecutableAarch64") {
|
||||||
dependsOn(":pkl-cli:macExecutableAarch64")
|
dependsOn(":pkl-cli:macExecutableAarch64")
|
||||||
configureExecutableTest("MacAarch64LanguageSnippetTestsEngine")
|
configureExecutableTest("MacAarch64LanguageSnippetTestsEngine")
|
||||||
}
|
}
|
||||||
|
|
||||||
val testLinuxExecutableAmd64 by
|
val testLinuxExecutableAmd64 =
|
||||||
tasks.registering(Test::class) {
|
tasks.register<Test>("testLinuxExecutableAmd64") {
|
||||||
dependsOn(":pkl-cli:linuxExecutableAmd64")
|
dependsOn(":pkl-cli:linuxExecutableAmd64")
|
||||||
configureExecutableTest("LinuxAmd64LanguageSnippetTestsEngine")
|
configureExecutableTest("LinuxAmd64LanguageSnippetTestsEngine")
|
||||||
}
|
}
|
||||||
|
|
||||||
val testLinuxExecutableAarch64 by
|
val testLinuxExecutableAarch64 =
|
||||||
tasks.registering(Test::class) {
|
tasks.register<Test>("testLinuxExecutableAarch64") {
|
||||||
dependsOn(":pkl-cli:linuxExecutableAarch64")
|
dependsOn(":pkl-cli:linuxExecutableAarch64")
|
||||||
configureExecutableTest("LinuxAarch64LanguageSnippetTestsEngine")
|
configureExecutableTest("LinuxAarch64LanguageSnippetTestsEngine")
|
||||||
}
|
}
|
||||||
|
|
||||||
val testAlpineExecutableAmd64 by
|
val testAlpineExecutableAmd64 =
|
||||||
tasks.registering(Test::class) {
|
tasks.register<Test>("testAlpineExecutableAmd64") {
|
||||||
dependsOn(":pkl-cli:alpineExecutableAmd64")
|
dependsOn(":pkl-cli:alpineExecutableAmd64")
|
||||||
configureExecutableTest("AlpineLanguageSnippetTestsEngine")
|
configureExecutableTest("AlpineLanguageSnippetTestsEngine")
|
||||||
}
|
}
|
||||||
|
|
||||||
val testWindowsExecutableAmd64 by
|
val testWindowsExecutableAmd64 =
|
||||||
tasks.registering(Test::class) {
|
tasks.register<Test>("testWindowsExecutableAmd64") {
|
||||||
dependsOn(":pkl-cli:windowsExecutableAmd64")
|
dependsOn(":pkl-cli:windowsExecutableAmd64")
|
||||||
configureExecutableTest("WindowsLanguageSnippetTestsEngine")
|
configureExecutableTest("WindowsLanguageSnippetTestsEngine")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user