@@ -417,31 +417,25 @@ subprojects {
417
417
def baselineGrpcVersion = ' 1.6.1'
418
418
419
419
// Get the baseline version's jar for this subproject
420
- File baselineArtifact = null
421
- // Use a detached configuration, otherwise the current version's jar will take precedence
422
- // over the baseline jar.
420
+ configurations {
421
+ baselineArtifact
422
+ }
423
423
// A necessary hack, the intuitive thing does NOT work:
424
424
// https://discuss.gradle.org/t/is-the-default-configuration-leaking-into-independent-configurations/2088/6
425
425
def oldGroup = project. group
426
426
try {
427
427
project. group = ' virtual_group_for_japicmp'
428
- String depModule = " io.grpc:${ project.name} :${ baselineGrpcVersion} @jar"
429
- String depJar = " ${ project.name} -${ baselineGrpcVersion} .jar"
430
- Configuration configuration = configurations. detachedConfiguration(
431
- dependencies. create(depModule)
432
- )
433
- baselineArtifact = files(configuration. files). filter {
434
- it. name. equals(depJar)
435
- }. singleFile
428
+ dependencies {
429
+ baselineArtifact " io.grpc:${ project.name} :${ baselineGrpcVersion} @jar"
430
+ }
436
431
} finally {
437
432
project. group = oldGroup
438
433
}
439
434
440
435
// Add a japicmp task that compares the current .jar with baseline .jar
441
436
tasks. register(" japicmp" , me.champeau.gradle.japicmp.JapicmpTask ) {
442
- dependsOn jar
443
- oldClasspath. from baselineArtifact
444
- newClasspath. from jar. archiveFile
437
+ oldClasspath. from configurations. baselineArtifact
438
+ newClasspath. from tasks. named(" jar" )
445
439
onlyBinaryIncompatibleModified = false
446
440
// Be quiet about things that did not change
447
441
onlyModified = true
@@ -454,12 +448,10 @@ subprojects {
454
448
455
449
// Also break on source incompatible changes, not just binary.
456
450
// Eg adding abstract method to public class.
457
- // TODO(zpencer): enable after japicmp-gradle-plugin/pull/14
458
- // breakOnSourceIncompatibility = true
451
+ failOnSourceIncompatibility = true
459
452
460
453
// Ignore any classes or methods marked @ExperimentalApi
461
- // TODO(zpencer): enable after japicmp-gradle-plugin/pull/15
462
- // annotationExcludes = ['@io.grpc.ExperimentalApi']
454
+ annotationExcludes = [' @io.grpc.ExperimentalApi' ]
463
455
}
464
456
}
465
457
}
0 commit comments