[kpm] kgp-idea-proto: Create special binaryValidationApiElements configuration

This will be a 'lean' jar file (un-shadowed), which can later
be used by the binary-compatibility-validator to test the
API surface against.

^KT-52568 Verification Pending
This commit is contained in:
sebastian.sellmair
2022-06-17 11:37:57 +02:00
committed by Space
parent 514ea01175
commit 443faec30d
3 changed files with 17 additions and 2 deletions
@@ -15,7 +15,7 @@ dependencies {
testArtifacts project(':kotlin-stdlib-jdk8')
testArtifacts project(':kotlin-reflect')
testArtifacts project(':kotlin-gradle-plugin-idea')
testArtifacts project(':kotlin-gradle-plugin-idea-proto')
testArtifacts project(path: ":kotlin-gradle-plugin-idea-proto", configuration: "binaryValidationApiElements")
testArtifacts project(':kotlin-tooling-core')
testCompileOnly("org.ow2.asm:asm-tree:9.0") {
@@ -42,7 +42,7 @@ class RuntimePublicAPITest {
@Test fun kotlinGradlePluginIdeaProto() {
snapshotAPIAndCompare(
"../kotlin-gradle-plugin-idea-proto/build/libs", "kotlin-gradle-plugin-idea-proto(?!-[-a-z]+)",
"../kotlin-gradle-plugin-idea-proto/build/libs", "kotlin-gradle-plugin-idea-proto-api(?!-[-a-z]+)",
nonPublicAnnotations = listOf("org/jetbrains/kotlin/gradle/kpm/idea/InternalKotlinGradlePluginApi")
)
}
@@ -56,6 +56,21 @@ runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
publish()
/* Setup configuration for binary compatibility tests */
run {
val binaryValidationApiElements by configurations.creating {
isCanBeResolved = false
isCanBeConsumed = true
}
val binaryValidationApiJar = tasks.register<Jar>("binaryValidationApiJar") {
this.archiveBaseName.set(project.name + "-api")
from(mainSourceSet.output)
}
artifacts.add(binaryValidationApiElements.name, binaryValidationApiJar)
}
tasks.register<Exec>("protoc") {
val protoSources = file("src/main/proto")
val javaOutput = file("src/generated/java/")