Use BCV plugin to dump and check public API of Kotlin Gradle plugin-related artifacts
This commit is contained in:
committed by
Space Team
parent
49bd4e672b
commit
59131f8138
@@ -15,11 +15,6 @@ dependencies {
|
||||
testArtifacts project(':kotlin-stdlib-jdk7')
|
||||
testArtifacts project(':kotlin-stdlib-jdk8')
|
||||
testArtifacts project(':kotlin-reflect')
|
||||
testArtifacts project(':kotlin-gradle-plugin-idea')
|
||||
testArtifacts project(path: ":kotlin-gradle-plugin-idea-proto", configuration: "binaryValidationApiElements")
|
||||
testArtifacts project(':kotlin-tooling-core')
|
||||
testArtifacts project(':kotlin-gradle-plugin-api')
|
||||
testArtifacts project(':kotlin-gradle-plugin-annotations')
|
||||
}
|
||||
|
||||
pill {
|
||||
|
||||
-34
@@ -35,40 +35,6 @@ class RuntimePublicAPITest {
|
||||
snapshotAPIAndCompare("../../reflect/api/build/libs", "kotlin-reflect-api(?!-[-a-z]+)", nonPublicPackages = listOf("kotlin.reflect.jvm.internal"))
|
||||
}
|
||||
|
||||
@Test fun kotlinGradlePluginAnnotations() {
|
||||
snapshotAPIAndCompare(
|
||||
"../kotlin-gradle-plugin-annotations/build/libs", "kotlin-gradle-plugin-annotations(?!-[-a-z]+)",
|
||||
nonPublicAnnotations = listOf("org/jetbrains/kotlin/gradle/InternalKotlinGradlePluginApi")
|
||||
)
|
||||
}
|
||||
|
||||
@Test fun kotlinGradlePluginApi() {
|
||||
snapshotAPIAndCompare(
|
||||
"../kotlin-gradle-plugin-api/build/libs", "kotlin-gradle-plugin-api(?!-[-a-z]+)",
|
||||
nonPublicAnnotations = listOf("org/jetbrains/kotlin/gradle/InternalKotlinGradlePluginApi")
|
||||
)
|
||||
}
|
||||
|
||||
@Test fun kotlinGradlePluginIdea() {
|
||||
snapshotAPIAndCompare(
|
||||
"../kotlin-gradle-plugin-idea/build/libs", "kotlin-gradle-plugin-idea(?!-[-a-z]+)",
|
||||
nonPublicAnnotations = listOf("org/jetbrains/kotlin/gradle/InternalKotlinGradlePluginApi")
|
||||
)
|
||||
}
|
||||
|
||||
@Test fun kotlinGradlePluginIdeaProto() {
|
||||
snapshotAPIAndCompare(
|
||||
basePath = "../kotlin-gradle-plugin-idea-proto/build/libs",
|
||||
jarPattern = "kotlin-gradle-plugin-idea-proto-api(?!-[-a-z]+)",
|
||||
nonPublicPackages = listOf("org/jetbrains/kotlin/gradle/idea/proto/generated"),
|
||||
nonPublicAnnotations = listOf("org/jetbrains/kotlin/gradle/InternalKotlinGradlePluginApi")
|
||||
)
|
||||
}
|
||||
|
||||
@Test fun kotlinToolingCore() {
|
||||
snapshotAPIAndCompare("../kotlin-tooling-core/build/libs", "kotlin-tooling-core(?!-[-a-z]+)")
|
||||
}
|
||||
|
||||
private fun snapshotAPIAndCompare(
|
||||
basePath: String,
|
||||
jarPattern: String,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||
}
|
||||
|
||||
configureKotlinCompileTasksGradleCompatibility()
|
||||
@@ -10,4 +11,14 @@ standardPublicJars()
|
||||
|
||||
dependencies {
|
||||
compileOnly(kotlinStdlib())
|
||||
}
|
||||
|
||||
apiValidation {
|
||||
nonPublicMarkers += "org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi"
|
||||
}
|
||||
|
||||
tasks {
|
||||
apiBuild {
|
||||
inputJar.value(jar.flatMap { it.archiveFile })
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,11 @@
|
||||
Lightweight module defining the API surface of the Kotlin Gradle Plugin.
|
||||
|
||||
### Binary Compatibility Validation
|
||||
This module is tested for Binary Compatibility Validation by the :tools:binary-compatibility-validator module.
|
||||
Please see [ReadMe.md](../binary-compatibility-validator/ReadMe.md)
|
||||
|
||||
You can execute binary compatibility validation by a shared run-configuration in the IDE
|
||||
`/Tests/Test: binary compatibility`
|
||||
The public API surface of this module is checked for stability
|
||||
using the [binary compatibility validator](https://github.com/Kotlin/binary-compatibility-validator/) plugin
|
||||
to prevent accidental public API changes.
|
||||
|
||||
In order to check in changes you can launch
|
||||
`Test/Test: binary compatibility [overwrite]`
|
||||
You can execute public API validation by running `apiCheck` task (also executed when `check` task runs).
|
||||
|
||||
In order to overwrite the reference API snapshot, you can launch `apiDump` task.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
plugins {
|
||||
id("gradle-plugin-dependency-configuration")
|
||||
id("jps-compatible")
|
||||
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -21,3 +22,13 @@ dependencies {
|
||||
|
||||
embedded(project(":kotlin-gradle-compiler-types")) { isTransitive = false }
|
||||
}
|
||||
|
||||
apiValidation {
|
||||
nonPublicMarkers += "org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi"
|
||||
}
|
||||
|
||||
tasks {
|
||||
apiBuild {
|
||||
inputJar.value(jar.flatMap { it.archiveFile })
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@@ -46,17 +47,21 @@ runtimeJar(tasks.register<ShadowJar>("embeddable")) {
|
||||
|
||||
/* 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)
|
||||
apiValidation {
|
||||
ignoredPackages += "org.jetbrains.kotlin.gradle.idea.proto.generated"
|
||||
nonPublicMarkers += "org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi"
|
||||
}
|
||||
|
||||
tasks {
|
||||
apiBuild {
|
||||
inputJar.value(binaryValidationApiJar.flatMap { it.archiveFile })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Setup protoc */
|
||||
|
||||
@@ -3,11 +3,15 @@
|
||||
The classes defined in this module will be available inside the Kotlin Gradle Plugin (KGP)
|
||||
as well as in the IDE import (GradleProject).
|
||||
|
||||
## Binary Compatibility:
|
||||
## Binary Compatibility
|
||||
|
||||
Binary compatibility can be tested by
|
||||
The public API surface of this module is checked for stability
|
||||
using the [binary compatibility validator](https://github.com/Kotlin/binary-compatibility-validator/) plugin
|
||||
to prevent accidental public API changes.
|
||||
|
||||
`./gradlew :tools:binary-compatibility-validator:clean :tools:binary-compatibility-validator:test`
|
||||
You can execute public API validation by running `apiCheck` task (also executed when `check` task runs).
|
||||
|
||||
In order to overwrite the reference API snapshot, you can launch `apiDump` task.
|
||||
|
||||
Binary incompatible changes have to go through a proper deprecation cycle after releases
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ plugins {
|
||||
kotlin("jvm")
|
||||
`java-test-fixtures`
|
||||
`maven-publish`
|
||||
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||
}
|
||||
|
||||
kotlin.sourceSets.configureEach {
|
||||
@@ -61,6 +62,16 @@ publish(moduleMetadata = true) {
|
||||
javadocJar()
|
||||
sourcesJar()
|
||||
|
||||
apiValidation {
|
||||
nonPublicMarkers += "org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi"
|
||||
}
|
||||
|
||||
tasks {
|
||||
apiBuild {
|
||||
inputJar.value(jar.flatMap { it.archiveFile })
|
||||
}
|
||||
}
|
||||
|
||||
//region Setup: Backwards compatibility tests
|
||||
|
||||
run {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||
}
|
||||
|
||||
publish()
|
||||
@@ -17,3 +18,9 @@ dependencies {
|
||||
compileOnly(kotlinStdlib())
|
||||
testImplementation(project(":kotlin-test:kotlin-test-junit"))
|
||||
}
|
||||
|
||||
tasks {
|
||||
apiBuild {
|
||||
inputJar.value(jar.flatMap { it.archiveFile })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user