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

Commit

Permalink
ci: Linkage Checker to examine linkage error at artifact level (#1032)
Browse files Browse the repository at this point in the history
* test: testing linkge checker with Gradle

* linkage checker

* Linkage Checker for gax, gax-grpc, gax-httpjson

* Added in kokoro shell script

* Removed unnecessary change

* Reverting unnecessary change

* Added comment for exclusion file

* Exclusion file only for gax-grpc
  • Loading branch information
suztomo committed May 26, 2020
1 parent a8d5ad0 commit 28ec963
Show file tree
Hide file tree
Showing 3 changed files with 612 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .kokoro/linkage-monitor.sh
Expand Up @@ -25,6 +25,7 @@ cd ${scriptDir}/..
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 @@ -34,3 +35,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
20 changes: 20 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,22 @@ 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'

def arguments = ['-a', "com.google.api:${project.name}:${project.version}"]
if (project.name == 'gax-grpc') {
// The exclusion file can be regenerated by '-o' option. See its Wiki for details:
// https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/LinkageCheckerMain#exclusion-files
arguments += ['--exclusion-file', 'linkage-checker-exclusion.xml']
}
args arguments
}
}

signing {
Expand Down

0 comments on commit 28ec963

Please sign in to comment.