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-jdk7')
|
||||||
testArtifacts project(':kotlin-stdlib-jdk8')
|
testArtifacts project(':kotlin-stdlib-jdk8')
|
||||||
testArtifacts project(':kotlin-reflect')
|
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 {
|
pill {
|
||||||
|
|||||||
-34
@@ -35,40 +35,6 @@ class RuntimePublicAPITest {
|
|||||||
snapshotAPIAndCompare("../../reflect/api/build/libs", "kotlin-reflect-api(?!-[-a-z]+)", nonPublicPackages = listOf("kotlin.reflect.jvm.internal"))
|
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(
|
private fun snapshotAPIAndCompare(
|
||||||
basePath: String,
|
basePath: String,
|
||||||
jarPattern: String,
|
jarPattern: String,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
|
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||||
}
|
}
|
||||||
|
|
||||||
configureKotlinCompileTasksGradleCompatibility()
|
configureKotlinCompileTasksGradleCompatibility()
|
||||||
@@ -10,4 +11,14 @@ standardPublicJars()
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(kotlinStdlib())
|
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.
|
Lightweight module defining the API surface of the Kotlin Gradle Plugin.
|
||||||
|
|
||||||
### Binary Compatibility Validation
|
### 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
|
The public API surface of this module is checked for stability
|
||||||
`/Tests/Test: binary compatibility`
|
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
|
You can execute public API validation by running `apiCheck` task (also executed when `check` task runs).
|
||||||
`Test/Test: binary compatibility [overwrite]`
|
|
||||||
|
In order to overwrite the reference API snapshot, you can launch `apiDump` task.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("gradle-plugin-dependency-configuration")
|
id("gradle-plugin-dependency-configuration")
|
||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
|
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -21,3 +22,13 @@ dependencies {
|
|||||||
|
|
||||||
embedded(project(":kotlin-gradle-compiler-types")) { isTransitive = false }
|
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 {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
|
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
@@ -46,17 +47,21 @@ runtimeJar(tasks.register<ShadowJar>("embeddable")) {
|
|||||||
|
|
||||||
/* Setup configuration for binary compatibility tests */
|
/* Setup configuration for binary compatibility tests */
|
||||||
run {
|
run {
|
||||||
val binaryValidationApiElements by configurations.creating {
|
|
||||||
isCanBeResolved = false
|
|
||||||
isCanBeConsumed = true
|
|
||||||
}
|
|
||||||
|
|
||||||
val binaryValidationApiJar = tasks.register<Jar>("binaryValidationApiJar") {
|
val binaryValidationApiJar = tasks.register<Jar>("binaryValidationApiJar") {
|
||||||
this.archiveBaseName.set(project.name + "-api")
|
this.archiveBaseName.set(project.name + "-api")
|
||||||
from(mainSourceSet.output)
|
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 */
|
/* Setup protoc */
|
||||||
|
|||||||
@@ -3,11 +3,15 @@
|
|||||||
The classes defined in this module will be available inside the Kotlin Gradle Plugin (KGP)
|
The classes defined in this module will be available inside the Kotlin Gradle Plugin (KGP)
|
||||||
as well as in the IDE import (GradleProject).
|
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
|
Binary incompatible changes have to go through a proper deprecation cycle after releases
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ plugins {
|
|||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
`java-test-fixtures`
|
`java-test-fixtures`
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
|
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin.sourceSets.configureEach {
|
kotlin.sourceSets.configureEach {
|
||||||
@@ -61,6 +62,16 @@ publish(moduleMetadata = true) {
|
|||||||
javadocJar()
|
javadocJar()
|
||||||
sourcesJar()
|
sourcesJar()
|
||||||
|
|
||||||
|
apiValidation {
|
||||||
|
nonPublicMarkers += "org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
apiBuild {
|
||||||
|
inputJar.value(jar.flatMap { it.archiveFile })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//region Setup: Backwards compatibility tests
|
//region Setup: Backwards compatibility tests
|
||||||
|
|
||||||
run {
|
run {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
|
id("org.jetbrains.kotlinx.binary-compatibility-validator")
|
||||||
}
|
}
|
||||||
|
|
||||||
publish()
|
publish()
|
||||||
@@ -17,3 +18,9 @@ dependencies {
|
|||||||
compileOnly(kotlinStdlib())
|
compileOnly(kotlinStdlib())
|
||||||
testImplementation(project(":kotlin-test:kotlin-test-junit"))
|
testImplementation(project(":kotlin-test:kotlin-test-junit"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
apiBuild {
|
||||||
|
inputJar.value(jar.flatMap { it.archiveFile })
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user