-
Notifications
You must be signed in to change notification settings - Fork 848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a task to compare public APIs for every stable module. #3183
Changes from all commits
c8a7890
cf6ebee
76a2df1
75f3031
400e4e1
93663e4
af69414
d8d5b64
bbc4d51
7fa8f30
5f2d723
ef5def0
85fdca7
75a3c54
a741131
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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("me.champeau.gradle.japicmp") { | ||
afterEvaluate { | ||
jkwatson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've never seen this lazy pattern in any other language so far - that's pretty sweet |
||
val baselineArtifact: File = project.findArtifact(baselineVersion) | ||
oldClasspath = files(baselineArtifact) | ||
jkwatson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// 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> { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! Shows that the tool can be very useful also for documentation purposes. |
||
*/ | ||
static Executor taskWrapping(Executor executor) { | ||
return command -> executor.execute(Context.current().wrap(command)); | ||
|
@@ -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); | ||
|
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,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) |
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. |
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. |
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,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 |
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. |
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,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) |
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. |
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,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() |
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,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) |
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. |
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. |
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,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) |
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. |
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. |
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,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) |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun with kotlin? :P