Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Linkage Checker to examine linkage error at artifact level #1032

Merged
merged 10 commits into from May 26, 2020
5 changes: 5 additions & 0 deletions .kokoro/linkage-monitor.sh
Expand Up @@ -23,6 +23,7 @@ cd github/gax-java/
java -version
echo ${JOB_TYPE}

# Linkage Monitor checks the compatibility of GAX BOM
# Using Gradle's maven-publish plugin. No need to sign the JAR.
./gradlew build publishToMavenLocal -x test -x signMavenJavaPublication

Expand All @@ -32,3 +33,7 @@ curl -v -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor

# Fails if there's new linkage errors compared with baseline
java -jar ${JAR} com.google.cloud:libraries-bom


# Linkage Checker looks for linkage errors at artifact level: gax, gax-grpc, and gax-httpjson
./gradlew checkJavaLinkage
16 changes: 16 additions & 0 deletions build.gradle
Expand Up @@ -141,6 +141,7 @@ subprojects {

configurations {
shadowNoGuava
linkageChecker
}

jacocoTestReport {
Expand Down Expand Up @@ -233,6 +234,9 @@ subprojects {
dependencies {
codeGeneration libraries['maven.com_google_auto_value_auto_value'],
libraries['maven.com_google_code_findbugs_jsr305']

// Separate configuration (class path) for Linkage Checker
linkageChecker "com.google.cloud.tools:dependencies:1.4.0"
}

compileJava.classpath += configurations.codeGeneration
Expand Down Expand Up @@ -336,6 +340,18 @@ subprojects {
}
}
}

task checkJavaLinkage(type: JavaExec) {
// Example invocation:
// ./gradlew gax-httpjson:checkJavaLinkage
dependsOn project.getTasksByName('publishMavenJavaPublicationToMavenLocal', true)
classpath = configurations.linkageChecker
main = 'com.google.cloud.tools.opensource.classpath.LinkageCheckerMain'
args '-a', "com.google.api:${project.name}:${project.version}",
'--exclusion-file', 'linkage-checker-exclusion.xml'
// The exclusion file above can be regenerated by '-o' option. See its Wiki for details:
// https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/LinkageCheckerMain#exclusion-files
}
}

signing {
Expand Down