Skip to content

Commit

Permalink
Add a task to compare public APIs for every stable module.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwatson committed Apr 27, 2021
1 parent 7e2c34a commit af5bcc1
Show file tree
Hide file tree
Showing 45 changed files with 201 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api/all/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions api/all/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
78 changes: 77 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,6 +25,7 @@ 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
}

if (!JavaVersion.current().isJava11Compatible()) {
Expand Down Expand Up @@ -422,9 +424,83 @@ subprojects {
}
}

plugins.withId("me.champeau.gradle.japicmp") {
afterEvaluate {
val temp: Configuration = project.configurations.create("tempConfig")
project.dependencies.add("tempConfig", "io.opentelemetry:opentelemetry-bom:latest.release")
val moduleVersion = project.configurations["tempConfig"].resolvedConfiguration.firstLevelModuleDependencies.elementAt(0).moduleVersion
project.configurations.remove(temp)

val userRequestedBase = project.properties["apiBaseVersion"]
val baselineVersion = userRequestedBase ?: moduleVersion
val newVersion : String? = project.properties["apiNewVersion"] as String?
val baselineArtifact: File?
var newArtifact: File? = null
val oldGroup = project.group
try {
//this dance is needed due to gradle not allowing more than one version of a dependency.
project.group = "virtual_baseline_for_japicmp"
val depModule = "io.opentelemetry:${base.archivesBaseName}:$baselineVersion@jar"
val depJar = "${base.archivesBaseName}-${baselineVersion}.jar"
val configuration: Configuration = configurations.detachedConfiguration(
dependencies.create(depModule)
)
baselineArtifact = files(configuration.files).filter {
it.name.equals(depJar)
}.singleFile
} finally {
project.group = oldGroup
}
if (newVersion != null) {
try {
project.group = "virtual_new_for_japicmp"
val depModule = "io.opentelemetry:${base.archivesBaseName}:$newVersion@jar"
val depJar = "${base.archivesBaseName}-${newVersion}.jar"
val configuration: Configuration = configurations.detachedConfiguration(
dependencies.create(depModule)
)
newArtifact = files(configuration.files).filter {
it.name.equals(depJar)
}.singleFile
} finally {
project.group = oldGroup
}
}

tasks {
val jar = getByName("jar") as Jar
if (newArtifact == null) {
newArtifact = file(jar.archiveFile)
}
create<JapicmpTask>("japicmp") {
oldClasspath = files(baselineArtifact)
newClasspath = files(newArtifact)
htmlOutputFile = file("$buildDir/reports/japi.html")
//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("$projectDir/docs/api_diff_current_vs_${baseVersionString}.txt")
} else {
txtOutputFile = file("$projectDir/docs/api_diff_${newVersion}_vs_${baselineVersion}.txt")
}

}
}
}
}

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.tasks.map { it.name }.contains("jar")) {
plugins.apply("me.champeau.gradle.japicmp")
}
plugins.apply("signing")

plugins.apply("de.marcphilipp.nexus-publish")

configure<PublishingExtension> {
Expand Down
5 changes: 5 additions & 0 deletions context/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions context/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
4 changes: 4 additions & 0 deletions context/src/main/java/io/opentelemetry/context/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ static Context root() {
* 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));
Expand All @@ -124,6 +126,8 @@ static Executor taskWrapping(Executor executor) {
* 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);
Expand Down
2 changes: 2 additions & 0 deletions exporters/jaeger-thrift/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/jaeger-thrift/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/jaeger/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/jaeger/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/logging-otlp/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/logging-otlp/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/logging/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/logging/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/otlp/all/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/otlp/all/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/otlp/common/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/otlp/common/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/otlp/trace/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions exporters/otlp/trace/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
4 changes: 4 additions & 0 deletions exporters/zipkin/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions exporters/zipkin/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions extensions/annotations/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions extensions/annotations/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions extensions/aws/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions extensions/aws/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions extensions/kotlin/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions extensions/kotlin/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions extensions/trace-propagators/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions sdk-extensions/aws/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions sdk-extensions/aws/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions sdk-extensions/resources/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
10 changes: 10 additions & 0 deletions sdk-extensions/resources/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions sdk/all/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions sdk/all/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
22 changes: 22 additions & 0 deletions sdk/common/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions sdk/common/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions sdk/testing/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
2 changes: 2 additions & 0 deletions sdk/testing/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
4 changes: 4 additions & 0 deletions sdk/trace/docs/api_diff_1.1.0_vs_1.0.0.txt
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 2 additions & 0 deletions sdk/trace/docs/api_diff_current_vs_latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comparing source compatibility of against
No changes.
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down

0 comments on commit af5bcc1

Please sign in to comment.