@@ -16,6 +16,8 @@ buildscript {
1616 classpath ' io.spring.nohttp:nohttp-gradle:0.0.10'
1717 classpath ' org.gradle:test-retry-gradle-plugin:1.4.1'
1818 classpath ' io.github.gradle-nexus:publish-plugin:1.1.0'
19+ classpath ' me.champeau.gradle:japicmp-gradle-plugin:0.4.0'
20+ classpath ' de.undercouch:gradle-download-task:5.0.2'
1921 classpath ' io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.34'
2022
2123 constraints {
@@ -293,6 +295,80 @@ subprojects {
293295 from " $rootDir /NOTICE"
294296 }
295297 }
298+
299+ apply plugin : ' me.champeau.gradle.japicmp'
300+ apply plugin : ' de.undercouch.download'
301+
302+ task downloadBaseline(type : Download ) {
303+ onlyIf {
304+ if (project. gradle. startParameter. isOffline()) {
305+ println ' Offline: skipping downloading of baseline and JAPICMP'
306+ return false
307+ } else if (compatibleVersion == ' SKIP' ) {
308+ println ' SKIP: Instructed to skip the baseline comparison'
309+ return false
310+ } else {
311+ println " Will download and perform baseline comparison with ${ compatibleVersion} "
312+ return true
313+ }
314+ }
315+
316+ onlyIfNewer true
317+ compress true
318+ String rootUrl
319+ if (compatibleVersion. contains(' -M' ) || compatibleVersion. contains(' -RC' )) {
320+ rootUrl = ' https://repo.spring.io/milestone/'
321+ } else if (compatibleVersion. contains(' -SNAPSHOT' ) ) {
322+ rootUrl = ' https://repo.spring.io/snapshot/'
323+ } else {
324+ rootUrl = repositories. mavenCentral(). url
325+ }
326+
327+ src " ${ rootUrl} io/micrometer/${ project.name} /${ compatibleVersion} /${ project.name} -${ compatibleVersion} .jar"
328+ dest " ${ buildDir} /baselineLibs/${ project.name} -${ compatibleVersion} .jar"
329+ }
330+
331+ task japicmp(type : me.champeau.gradle.japicmp.JapicmpTask ) {
332+ oldClasspath. from(files(" ${ buildDir} /baselineLibs/${ project.name} -${ compatibleVersion} .jar" ))
333+ newClasspath. from(files(jar. archiveFile, project(" :${ project.name} " ). jar))
334+ onlyBinaryIncompatibleModified = true
335+ failOnModification = true
336+ failOnSourceIncompatibility = true
337+ txtOutputFile = file(" ${ project.buildDir} /reports/japi.txt" )
338+ ignoreMissingClasses = true
339+ includeSynthetic = true
340+
341+ packageExcludes = [' io.micrometer.shaded.*' , ' io.micrometer.statsd.internal' ]
342+
343+ // For 1.8.x branch only.
344+ classExcludes = [' io.micrometer.core.instrument.util.JsonUtils' ]
345+
346+ // TODO remove methodExcludes when gh-3181 is resolved
347+ methodExcludes = [' io.micrometer.stackdriver.StackdriverConfig#metricTypePrefix()' ,
348+ ' io.micrometer.core.instrument.Timer#record(java.util.function.BooleanSupplier)' ,
349+ ' io.micrometer.core.instrument.Timer#record(java.util.function.IntSupplier)' ,
350+ ' io.micrometer.core.instrument.Timer#record(java.util.function.LongSupplier)' ,
351+ ' io.micrometer.core.instrument.Timer#record(java.util.function.DoubleSupplier)' ,
352+ ' io.micrometer.core.instrument.LongTaskTimer#record(java.util.function.BooleanSupplier)' ,
353+ ' io.micrometer.core.instrument.LongTaskTimer#record(java.util.function.IntSupplier)' ,
354+ ' io.micrometer.core.instrument.LongTaskTimer#record(java.util.function.LongSupplier)' ,
355+ ' io.micrometer.core.instrument.LongTaskTimer#record(java.util.function.DoubleSupplier)' ,
356+ ' io.micrometer.signalfx.SignalFxConfig#publishDeltaHistogram()' ,
357+
358+ // For 1.8.x branch only.
359+ ' io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider#commandStarted(com.mongodb.event.CommandStartedEvent)' ,
360+ ' io.micrometer.dynatrace.DynatraceConfig#apiVersion()' ,
361+ ' io.micrometer.dynatrace.DynatraceConfig#defaultDimensions()' ,
362+ ' io.micrometer.dynatrace.DynatraceConfig#enrichWithDynatraceMetadata()' ,
363+ ' io.micrometer.dynatrace.DynatraceConfig#metricKeyPrefix()' ,
364+ ' io.micrometer.elastic.ElasticConfig#apiKeyCredentials()' ,
365+ ' io.micrometer.stackdriver.StackdriverConfig#useSemanticMetricTypes()'
366+ ]
367+ onlyIf { compatibleVersion != ' SKIP' }
368+ }
369+
370+ tasks. japicmp. dependsOn(downloadBaseline)
371+ tasks. check. dependsOn(japicmp)
296372 }
297373
298374 contacts {
0 commit comments