Add a task to compare public APIs for every stable module. (#3183)
* Add a task to compare public APIs for every stable module. * add a few comments and make the build task depend on the japicmp task * update the api diffs after rebasing. * task must depend on jar * a few script tweaks based on feedback * small tweak to make it a little more kotlin-idiomatic * refactoring to make the code more clear * some more refactoring. * make the latest released version a lazy val of the build script * have the task depend on check, rather than build * put all the API diffs into a central directory * run at --info to diagnose CI issues * try an older java 11 version * try another combo * remove the info logging
This commit is contained in:
parent
a8a85c6129
commit
bd6cfd85fb
|
|
@ -3,6 +3,7 @@ import com.google.protobuf.gradle.*
|
|||
import de.marcphilipp.gradle.nexus.NexusPublishExtension
|
||||
import io.morethan.jmhreport.gradle.JmhReportExtension
|
||||
import me.champeau.gradle.JMHPluginExtension
|
||||
import me.champeau.gradle.japicmp.JapicmpTask
|
||||
import nebula.plugin.release.git.opinion.Strategies
|
||||
import net.ltgt.gradle.errorprone.ErrorProneOptions
|
||||
import net.ltgt.gradle.errorprone.ErrorPronePlugin
|
||||
|
|
@ -24,6 +25,43 @@ plugins {
|
|||
id("me.champeau.gradle.jmh") apply false
|
||||
id("net.ltgt.errorprone") apply false
|
||||
id("ru.vyarus.animalsniffer") apply false
|
||||
id("me.champeau.gradle.japicmp") apply false
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Locate the project's artifact of a particular version.
|
||||
*/
|
||||
fun Project.findArtifact(version: String) : File {
|
||||
val existingGroup = this.group
|
||||
try {
|
||||
// Temporarily change the group name because we want to fetch an artifact with the same
|
||||
// Maven coordinates as the project, which Gradle would not allow otherwise.
|
||||
this.group = "virtual_group"
|
||||
val depModule = "io.opentelemetry:${base.archivesBaseName}:$version@jar"
|
||||
val depJar = "${base.archivesBaseName}-${version}.jar"
|
||||
val configuration: Configuration = configurations.detachedConfiguration(
|
||||
dependencies.create(depModule)
|
||||
)
|
||||
return files(configuration.files).filter {
|
||||
it.name.equals(depJar)
|
||||
}.singleFile
|
||||
} finally {
|
||||
this.group = existingGroup
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The latest *released* version of the project. Evaluated lazily so the work is only done if necessary.
|
||||
*/
|
||||
val latestReleasedVersion : String by lazy {
|
||||
// hack to find the current released version of the project
|
||||
val temp: Configuration = project.configurations.create("tempConfig")
|
||||
// pick the bom, since it's always there.
|
||||
dependencies.add("tempConfig", "io.opentelemetry:opentelemetry-bom:latest.release")
|
||||
val moduleVersion = project.configurations["tempConfig"].resolvedConfiguration.firstLevelModuleDependencies.elementAt(0).moduleVersion
|
||||
project.configurations.remove(temp)
|
||||
moduleVersion
|
||||
}
|
||||
|
||||
if (!JavaVersion.current().isJava11Compatible()) {
|
||||
|
|
@ -422,9 +460,54 @@ subprojects {
|
|||
}
|
||||
}
|
||||
|
||||
plugins.withId("maven-publish") {
|
||||
plugins.apply("signing")
|
||||
plugins.withId("me.champeau.gradle.japicmp") {
|
||||
afterEvaluate {
|
||||
tasks {
|
||||
val jApiCmp by registering(JapicmpTask::class) {
|
||||
dependsOn("jar")
|
||||
// the japicmp "old" version is either the user-specified one, or the latest release.
|
||||
val userRequestedBase = project.properties["apiBaseVersion"] as String?
|
||||
val baselineVersion: String = userRequestedBase ?: latestReleasedVersion
|
||||
val baselineArtifact: File = project.findArtifact(baselineVersion)
|
||||
oldClasspath = files(baselineArtifact)
|
||||
|
||||
// the japicmp "new" version is either the user-specified one, or the locally built jar.
|
||||
val newVersion : String? = project.properties["apiNewVersion"] as String?
|
||||
val newArtifact: File = if (newVersion == null) {
|
||||
val jar = getByName("jar") as Jar
|
||||
file(jar.archiveFile)
|
||||
} else {
|
||||
project.findArtifact(newVersion)
|
||||
}
|
||||
newClasspath = files(newArtifact)
|
||||
|
||||
//only output changes, not everything
|
||||
isOnlyModified = true
|
||||
//this is needed so that we only consider the current artifact, and not dependencies
|
||||
isIgnoreMissingClasses = true
|
||||
// double wildcards don't seem to work here (*.internal.*)
|
||||
packageExcludes = listOf("*.internal", "io.opentelemetry.internal.shaded.jctools.*")
|
||||
if (newVersion == null) {
|
||||
val baseVersionString = if (userRequestedBase == null) "latest" else baselineVersion
|
||||
txtOutputFile = file("$rootDir/docs/apidiffs/current_vs_${baseVersionString}/${project.base.archivesBaseName}.txt")
|
||||
} else {
|
||||
txtOutputFile = file("$rootDir/docs/apidiffs/${newVersion}_vs_${baselineVersion}/${project.base.archivesBaseName}.txt")
|
||||
}
|
||||
}
|
||||
// have the check task depend on the api comparison task, to make it more likely it will get used.
|
||||
named("check") {
|
||||
dependsOn(jApiCmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("maven-publish") {
|
||||
// generate the api diff report for any module that is stable and publishes a jar.
|
||||
if (!project.hasProperty("otel.release") && !project.name.startsWith("bom")) {
|
||||
plugins.apply("me.champeau.gradle.japicmp")
|
||||
}
|
||||
plugins.apply("signing")
|
||||
plugins.apply("de.marcphilipp.nexus-publish")
|
||||
|
||||
configure<PublishingExtension> {
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ public interface Context {
|
|||
* during an invocation to another thread. For example, you may use something like {@code Executor
|
||||
* dbExecutor = Context.wrapTasks(threadPool)} to ensure calls like {@code dbExecutor.execute(()
|
||||
* -> database.query())} have {@link Context} available on the thread executing database queries.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
static Executor taskWrapping(Executor executor) {
|
||||
return command -> executor.execute(Context.current().wrap(command));
|
||||
|
|
@ -124,6 +126,8 @@ public interface Context {
|
|||
* ExecutorService dbExecutor = Context.wrapTasks(threadPool)} to ensure calls like {@code
|
||||
* dbExecutor.execute(() -> database.query())} have {@link Context} available on the thread
|
||||
* executing database queries.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
static ExecutorService taskWrapping(ExecutorService executorService) {
|
||||
return new CurrentContextExecutorService(executorService);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Comparing source compatibility of against
|
||||
***! MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.context.Context (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++! NEW METHOD: PUBLIC(+) STATIC(+) java.util.concurrent.Executor taskWrapping(java.util.concurrent.Executor)
|
||||
+++! NEW METHOD: PUBLIC(+) STATIC(+) java.util.concurrent.ExecutorService taskWrapping(java.util.concurrent.ExecutorService)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Comparing source compatibility of against
|
||||
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.zipkin.ZipkinSpanExporter (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) java.util.logging.Logger baseLogger
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
Comparing source compatibility of against
|
||||
*** MODIFIED CLASS: PUBLIC ABSTRACT io.opentelemetry.sdk.resources.Resource (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.resources.ResourceBuilder builder()
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder toBuilder()
|
||||
+++ NEW CLASS: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder (not serializable)
|
||||
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
|
||||
+++ NEW SUPERCLASS: java.lang.Object
|
||||
+++ NEW CONSTRUCTOR: PUBLIC(+) ResourceBuilder()
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.Resource build()
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(java.lang.String, java.lang.String)
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(java.lang.String, long)
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(java.lang.String, double)
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(java.lang.String, boolean)
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(java.lang.String, java.lang.String[])
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(java.lang.String, long[])
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(java.lang.String, double[])
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(java.lang.String, boolean[])
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(io.opentelemetry.api.common.AttributeKey, java.lang.Object)
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder put(io.opentelemetry.api.common.AttributeKey, int)
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder putAll(io.opentelemetry.api.common.Attributes)
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.ResourceBuilder putAll(io.opentelemetry.sdk.resources.Resource)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Comparing source compatibility of against
|
||||
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.trace.export.SimpleSpanProcessor (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode forceFlush()
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
Comparing source compatibility of against
|
||||
***! MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.api.trace.Span (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++! NEW METHOD: PUBLIC(+) io.opentelemetry.api.trace.Span setAllAttributes(io.opentelemetry.api.common.Attributes)
|
||||
***! MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.api.trace.SpanBuilder (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++! NEW METHOD: PUBLIC(+) io.opentelemetry.api.trace.SpanBuilder setAllAttributes(io.opentelemetry.api.common.Attributes)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Comparing source compatibility of against
|
||||
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.zipkin.ZipkinSpanExporterBuilder (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.zipkin.ZipkinSpanExporterBuilder setReadTimeout(long, java.util.concurrent.TimeUnit)
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.zipkin.ZipkinSpanExporterBuilder setReadTimeout(java.time.Duration)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
Comparing source compatibility of against
|
||||
+++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.extension.resources.HostResource (not serializable)
|
||||
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
|
||||
+++ NEW SUPERCLASS: java.lang.Object
|
||||
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.resources.Resource get()
|
||||
+++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.extension.resources.HostResourceProvider (not serializable)
|
||||
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
|
||||
+++ NEW SUPERCLASS: java.lang.Object
|
||||
+++ NEW CONSTRUCTOR: PUBLIC(+) HostResourceProvider()
|
||||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.Resource createResource(io.opentelemetry.sdk.autoconfigure.ConfigProperties)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
|
|
@ -15,6 +15,7 @@ pluginManagement {
|
|||
id("org.jetbrains.kotlin.jvm") version "1.4.21"
|
||||
id("org.unbroken-dome.test-sets") version "3.0.1"
|
||||
id("ru.vyarus.animalsniffer") version "1.5.3"
|
||||
id("me.champeau.gradle.japicmp") version "0.2.9"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue