mirror of
https://github.com/apple/pkl.git
synced 2026-07-04 20:21:42 +02:00
Fix publication of pkl-config-kotlin (#1240)
This fixes a regression where the pkl-config-kotlin library would not publish after upgrading to Gradle 9.1
This commit is contained in:
@@ -25,7 +25,6 @@ com.github.ben-manes.caffeine:caffeine:2.9.3=swiftExportClasspathResolvable
|
|||||||
com.google.errorprone:error_prone_annotations:2.28.0=swiftExportClasspathResolvable
|
com.google.errorprone:error_prone_annotations:2.28.0=swiftExportClasspathResolvable
|
||||||
com.squareup:kotlinpoet:1.6.0=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
com.squareup:kotlinpoet:1.6.0=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||||
io.github.java-diff-utils:java-diff-utils:4.12=kotlinInternalAbiValidation
|
io.github.java-diff-utils:java-diff-utils:4.12=kotlinInternalAbiValidation
|
||||||
io.leangen.geantyref:geantyref:1.3.16=testRuntimeClasspath
|
|
||||||
io.opentelemetry:opentelemetry-api:1.41.0=swiftExportClasspathResolvable
|
io.opentelemetry:opentelemetry-api:1.41.0=swiftExportClasspathResolvable
|
||||||
io.opentelemetry:opentelemetry-context:1.41.0=swiftExportClasspathResolvable
|
io.opentelemetry:opentelemetry-context:1.41.0=swiftExportClasspathResolvable
|
||||||
net.bytebuddy:byte-buddy:1.17.7=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
net.bytebuddy:byte-buddy:1.17.7=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ com.github.ben-manes.caffeine:caffeine:2.9.3=swiftExportClasspathResolvable
|
|||||||
com.google.errorprone:error_prone_annotations:2.28.0=swiftExportClasspathResolvable
|
com.google.errorprone:error_prone_annotations:2.28.0=swiftExportClasspathResolvable
|
||||||
com.squareup:kotlinpoet:1.6.0=pklCodegenKotlin
|
com.squareup:kotlinpoet:1.6.0=pklCodegenKotlin
|
||||||
io.github.java-diff-utils:java-diff-utils:4.12=kotlinInternalAbiValidation
|
io.github.java-diff-utils:java-diff-utils:4.12=kotlinInternalAbiValidation
|
||||||
io.leangen.geantyref:geantyref:1.3.16=pklConfigJava,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
io.leangen.geantyref:geantyref:1.3.16=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||||
io.opentelemetry:opentelemetry-api:1.41.0=swiftExportClasspathResolvable
|
io.opentelemetry:opentelemetry-api:1.41.0=swiftExportClasspathResolvable
|
||||||
io.opentelemetry:opentelemetry-context:1.41.0=swiftExportClasspathResolvable
|
io.opentelemetry:opentelemetry-context:1.41.0=swiftExportClasspathResolvable
|
||||||
net.bytebuddy:byte-buddy:1.17.7=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
net.bytebuddy:byte-buddy:1.17.7=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||||
@@ -37,12 +37,12 @@ org.bouncycastle:bcpkix-jdk18on:1.80=kotlinBouncyCastleConfiguration
|
|||||||
org.bouncycastle:bcprov-jdk18on:1.80=kotlinBouncyCastleConfiguration
|
org.bouncycastle:bcprov-jdk18on:1.80=kotlinBouncyCastleConfiguration
|
||||||
org.bouncycastle:bcutil-jdk18on:1.80=kotlinBouncyCastleConfiguration
|
org.bouncycastle:bcutil-jdk18on:1.80=kotlinBouncyCastleConfiguration
|
||||||
org.checkerframework:checker-qual:3.43.0=swiftExportClasspathResolvable
|
org.checkerframework:checker-qual:3.43.0=swiftExportClasspathResolvable
|
||||||
org.graalvm.polyglot:polyglot:25.0.0=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
|
org.graalvm.polyglot:polyglot:25.0.0=pklCodegenKotlin,testRuntimeClasspath
|
||||||
org.graalvm.sdk:collections:25.0.0=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
|
org.graalvm.sdk:collections:25.0.0=pklCodegenKotlin,testRuntimeClasspath
|
||||||
org.graalvm.sdk:graal-sdk:25.0.0=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
|
org.graalvm.sdk:graal-sdk:25.0.0=pklCodegenKotlin,testRuntimeClasspath
|
||||||
org.graalvm.sdk:nativeimage:25.0.0=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
|
org.graalvm.sdk:nativeimage:25.0.0=pklCodegenKotlin,testRuntimeClasspath
|
||||||
org.graalvm.sdk:word:25.0.0=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
|
org.graalvm.sdk:word:25.0.0=pklCodegenKotlin,testRuntimeClasspath
|
||||||
org.graalvm.truffle:truffle-api:25.0.0=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
|
org.graalvm.truffle:truffle-api:25.0.0=pklCodegenKotlin,testRuntimeClasspath
|
||||||
org.jetbrains.kotlin:abi-tools-api:2.2.20=kotlinInternalAbiValidation
|
org.jetbrains.kotlin:abi-tools-api:2.2.20=kotlinInternalAbiValidation
|
||||||
org.jetbrains.kotlin:abi-tools:2.2.20=kotlinInternalAbiValidation
|
org.jetbrains.kotlin:abi-tools:2.2.20=kotlinInternalAbiValidation
|
||||||
org.jetbrains.kotlin:kotlin-build-tools-api:2.2.20=kotlinBuildToolsApiClasspath
|
org.jetbrains.kotlin:kotlin-build-tools-api:2.2.20=kotlinBuildToolsApiClasspath
|
||||||
@@ -78,8 +78,8 @@ org.junit.platform:junit-platform-commons:1.14.0=testCompileClasspath,testImplem
|
|||||||
org.junit.platform:junit-platform-engine:1.14.0=testRuntimeClasspath
|
org.junit.platform:junit-platform-engine:1.14.0=testRuntimeClasspath
|
||||||
org.junit.platform:junit-platform-launcher:1.14.0=testRuntimeClasspath
|
org.junit.platform:junit-platform-launcher:1.14.0=testRuntimeClasspath
|
||||||
org.junit:junit-bom:5.14.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
org.junit:junit-bom:5.14.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||||
org.msgpack:msgpack-core:0.9.8=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
|
org.msgpack:msgpack-core:0.9.8=pklCodegenKotlin,testRuntimeClasspath
|
||||||
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||||
org.organicdesign:Paguro:3.10.3=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
|
org.organicdesign:Paguro:3.10.3=pklCodegenKotlin,testRuntimeClasspath
|
||||||
org.snakeyaml:snakeyaml-engine:2.10=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
|
org.snakeyaml:snakeyaml-engine:2.10=pklCodegenKotlin,testRuntimeClasspath
|
||||||
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDefExtensions,pklConfigJavaAll,signatures,sourcesJar,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testKotlinScriptDefExtensions
|
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDefExtensions,pklConfigJava,pklConfigJavaAll,signatures,sourcesJar,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testKotlinScriptDefExtensions
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -25,20 +25,26 @@ val pklConfigJavaAll: Configuration by configurations.creating
|
|||||||
|
|
||||||
val pklCodegenKotlin: Configuration by configurations.creating
|
val pklCodegenKotlin: Configuration by configurations.creating
|
||||||
|
|
||||||
// Ideally, api would extend pklConfigJavaAll,
|
val buildInfo = project.extensions.getByType<BuildInfo>()
|
||||||
// instead of extending pklConfigJava and then patching test task and POM.
|
|
||||||
// However, this wouldn't work for IntelliJ.
|
|
||||||
configurations.api.get().extendsFrom(pklConfigJava)
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
pklConfigJava(projects.pklConfigJava)
|
|
||||||
|
|
||||||
pklConfigJavaAll(project(":pkl-config-java", "fatJar"))
|
|
||||||
|
|
||||||
pklCodegenKotlin(projects.pklCodegenKotlin)
|
pklCodegenKotlin(projects.pklCodegenKotlin)
|
||||||
|
|
||||||
implementation(libs.kotlinReflect)
|
implementation(libs.kotlinReflect)
|
||||||
|
|
||||||
|
// Don't declare a runtime dependency to pkl-config-java because Gradle cannot resolve
|
||||||
|
// the correct publication (library vs fatJar) when generating the POM.
|
||||||
|
// We add the dependency manually to the POM later.
|
||||||
|
//
|
||||||
|
// Avoids this error during publish:
|
||||||
|
//
|
||||||
|
// > Failed to query the value of property 'dependencies'.
|
||||||
|
// > Publishing is not able to resolve a dependency on a project with multiple publications that
|
||||||
|
// have different coordinates.
|
||||||
|
// Found the following publications in project ':pkl-config-java':
|
||||||
|
// - Maven publication 'fatJar' with coordinates org.pkl-lang:pkl-config-java-all:0.30.0-SNAPSHOT
|
||||||
|
// - Maven publication 'library' with coordinates org.pkl-lang:pkl-config-java:0.30.0-SNAPSHOT
|
||||||
|
compileOnly(projects.pklConfigJava)
|
||||||
|
testImplementation(projects.pklConfigJava)
|
||||||
testImplementation(libs.geantyref)
|
testImplementation(libs.geantyref)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,9 +73,6 @@ 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 }
|
|
||||||
|
|
||||||
// disable publishing of .module until we find a way to manipulate it like POM (or ideally both
|
// disable publishing of .module until we find a way to manipulate it like POM (or ideally both
|
||||||
// together)
|
// together)
|
||||||
tasks.withType<GenerateModuleMetadata> { enabled = false }
|
tasks.withType<GenerateModuleMetadata> { enabled = false }
|
||||||
@@ -83,22 +86,22 @@ publishing {
|
|||||||
"Kotlin extensions for pkl-config-java, a Java config library based on the Pkl config language."
|
"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
|
// Modify POM and add pkl-config-java-all dependency
|
||||||
withXml {
|
withXml {
|
||||||
val projectElement = asElement()
|
val dependenciesNode = asNode().get("dependencies") as groovy.util.NodeList
|
||||||
val dependenciesElement =
|
val dependencies =
|
||||||
projectElement.getElementsByTagName("dependencies").item(0) as org.w3c.dom.Element
|
if (dependenciesNode.isNotEmpty()) {
|
||||||
val dependencyElements = dependenciesElement.getElementsByTagName("dependency")
|
dependenciesNode[0] as groovy.util.Node
|
||||||
for (idx in 0 until dependencyElements.length) {
|
} else {
|
||||||
val dependencyElement = dependencyElements.item(idx) as org.w3c.dom.Element
|
asNode().appendNode("dependencies")
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies.appendNode("dependency").apply {
|
||||||
|
appendNode("groupId", "org.pkl-lang")
|
||||||
|
appendNode("artifactId", "pkl-config-java-all")
|
||||||
|
appendNode("version", project.version)
|
||||||
|
appendNode("scope", "runtime")
|
||||||
}
|
}
|
||||||
throw GradleException("Failed to edit POM of module `pkl-config-kotlin`.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user