mirror of
https://github.com/apple/pkl.git
synced 2026-07-14 17:12:41 +02:00
Run spotless apply
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
/**
|
||||
* Copyright © 2024 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.
|
||||
*/
|
||||
plugins {
|
||||
pklAllProjects
|
||||
pklKotlinLibrary
|
||||
@@ -23,61 +38,61 @@ dependencies {
|
||||
pklCodegenKotlin(projects.pklCodegenKotlin)
|
||||
|
||||
implementation(libs.kotlinReflect)
|
||||
|
||||
|
||||
testImplementation(libs.geantyref)
|
||||
}
|
||||
|
||||
val generateTestConfigClasses by tasks.registering(JavaExec::class) {
|
||||
val outputDir = layout.buildDirectory.dir("testConfigClasses")
|
||||
outputs.dir(outputDir)
|
||||
inputs.dir("src/test/resources/codegenPkl")
|
||||
val generateTestConfigClasses by
|
||||
tasks.registering(JavaExec::class) {
|
||||
val outputDir = layout.buildDirectory.dir("testConfigClasses")
|
||||
outputs.dir(outputDir)
|
||||
inputs.dir("src/test/resources/codegenPkl")
|
||||
|
||||
classpath = pklCodegenKotlin
|
||||
mainClass.set("org.pkl.codegen.kotlin.Main")
|
||||
argumentProviders.add(CommandLineArgumentProvider {
|
||||
listOf("--output-dir", outputDir.get().asFile.absolutePath) +
|
||||
fileTree("src/test/resources/codegenPkl").map { it.absolutePath }
|
||||
})
|
||||
}
|
||||
classpath = pklCodegenKotlin
|
||||
mainClass.set("org.pkl.codegen.kotlin.Main")
|
||||
argumentProviders.add(
|
||||
CommandLineArgumentProvider {
|
||||
listOf("--output-dir", outputDir.get().asFile.absolutePath) +
|
||||
fileTree("src/test/resources/codegenPkl").map { it.absolutePath }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
sourceSets.getByName("test") {
|
||||
java.srcDir(layout.buildDirectory.dir("testConfigClasses/kotlin"))
|
||||
resources.srcDir(layout.buildDirectory.dir("testConfigClasses/resources"))
|
||||
}
|
||||
|
||||
tasks.processTestResources {
|
||||
dependsOn(generateTestConfigClasses)
|
||||
}
|
||||
tasks.processTestResources { dependsOn(generateTestConfigClasses) }
|
||||
|
||||
tasks.compileTestKotlin {
|
||||
dependsOn(generateTestConfigClasses)
|
||||
}
|
||||
tasks.compileTestKotlin { dependsOn(generateTestConfigClasses) }
|
||||
|
||||
// use pkl-config-java-all for testing (same as for publishing)
|
||||
tasks.test {
|
||||
classpath = classpath - pklConfigJava + pklConfigJavaAll
|
||||
}
|
||||
tasks.test { classpath = classpath - pklConfigJava + pklConfigJavaAll }
|
||||
|
||||
// disable publishing of .module until we find a way to manipulate it like POM (or ideally both together)
|
||||
tasks.withType<GenerateModuleMetadata> {
|
||||
enabled = false
|
||||
}
|
||||
// disable publishing of .module until we find a way to manipulate it like POM (or ideally both
|
||||
// together)
|
||||
tasks.withType<GenerateModuleMetadata> { enabled = false }
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
named<MavenPublication>("library") {
|
||||
pom {
|
||||
url.set("https://github.com/apple/pkl/tree/main/pkl-config-kotlin")
|
||||
description.set("Kotlin extensions for pkl-config-java, a Java config library based on the Pkl config language.")
|
||||
description.set(
|
||||
"Kotlin extensions for pkl-config-java, a Java config library based on the Pkl config language."
|
||||
)
|
||||
|
||||
// change dependency pkl-config-java to pkl-config-java-all
|
||||
withXml {
|
||||
val projectElement = asElement()
|
||||
val dependenciesElement = projectElement.getElementsByTagName("dependencies").item(0) as org.w3c.dom.Element
|
||||
val dependenciesElement =
|
||||
projectElement.getElementsByTagName("dependencies").item(0) as org.w3c.dom.Element
|
||||
val dependencyElements = dependenciesElement.getElementsByTagName("dependency")
|
||||
for (idx in 0 until dependencyElements.length) {
|
||||
val dependencyElement = dependencyElements.item(idx) as org.w3c.dom.Element
|
||||
val artifactIdElement = dependencyElement.getElementsByTagName("artifactId").item(0) as org.w3c.dom.Element
|
||||
val artifactIdElement =
|
||||
dependencyElement.getElementsByTagName("artifactId").item(0) as org.w3c.dom.Element
|
||||
if (artifactIdElement.textContent == "pkl-config-java") {
|
||||
artifactIdElement.textContent = "pkl-config-java-all"
|
||||
return@withXml
|
||||
|
||||
Reference in New Issue
Block a user