Skip to content

Commit

Permalink
Remove shadow config from nullaway module (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar authored Feb 22, 2021
1 parent 5bfb130 commit 35fa696
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 50 deletions.
43 changes: 1 addition & 42 deletions nullaway/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.ltgt.gradle.errorprone.CheckSeverity

plugins {
id "com.github.johnrengelman.shadow"
id "java"
// For code coverage:
id 'jacoco'
Expand All @@ -34,7 +33,7 @@ dependencies {

compileOnly deps.build.errorProneCheckApi
compile deps.build.checkerDataflow
shadow deps.build.guava
compile deps.build.guava

testCompile deps.test.junit4
testCompile(deps.build.errorProneTestHelpers) {
Expand All @@ -55,26 +54,6 @@ dependencies {
testCompile deps.test.lombok
}

// We include and shade the checker framework jars into the NullAway jar, as we may have custom
// changes.
shadowJar {
// set classifier to null since we want the artifact uploaded to Maven Central to be the
// shadow jar. Without this, the shadow jar is built with a '-all' suffix in the name.
classifier = null
relocate "org.checkerframework", "shadow.checkerframework"
}
// Since we set classifier to null above, both the normal jar artifact and the shadow jar have
// the same name, which can cause races if we are not careful. We force shadowJar to depend on
// jar, so we know that the shadow jar will always overwrite the normal one. We also force
// assemble to depend on shadowJar, to avoid races between running tests / signing archives
// and building the shadow jar.
//
// We also require that any other sub-projects only depend on the shadow configuration of this
// project; otherwise weird races can occur. Eventually, we should fix this by only renaming the
// shadow jar artifact before the uploadArchives task runs.
shadowJar.dependsOn jar
assemble.dependsOn shadowJar

javadoc {
failOnError = false
}
Expand All @@ -89,26 +68,6 @@ test {

apply from: rootProject.file("gradle/gradle-mvn-push.gradle")

def configurePomForShadow(pom) {
pom.scopeMappings.mappings.remove(project.configurations.compile)
pom.scopeMappings.mappings.remove(project.configurations.runtime)
pom.scopeMappings.addMapping(MavenPlugin.COMPILE_PRIORITY, project.configurations.shadow, Conf2ScopeMappingContainer.COMPILE)
}

install {
repositories.mavenInstaller {
configurePomForShadow(pom)
}
}
install.dependsOn shadowJar

uploadArchives {
repositories.mavenDeployer {
configurePomForShadow(pom)
}
}
uploadArchives.dependsOn shadowJar

jacoco {
toolVersion = "0.8.2"
}
Expand Down
2 changes: 1 addition & 1 deletion sample-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ android {

dependencies {
implementation deps.support.appcompat
annotationProcessor project(path: ":nullaway", configuration: "shadow")
annotationProcessor project(":nullaway")
annotationProcessor project(path: ":sample-library-model")

testImplementation deps.test.junit4
Expand Down
4 changes: 2 additions & 2 deletions sample-library-model/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ targetCompatibility = "1.8"
dependencies {
compileOnly deps.apt.autoService
annotationProcessor deps.apt.autoService
compileOnly project(path: ":nullaway", configuration: "shadow")
annotationProcessor project(path: ":nullaway", configuration: "shadow")
compileOnly project(":nullaway")
annotationProcessor project(":nullaway")
compileOnly deps.build.guava
}

Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sourceCompatibility = "1.8"
targetCompatibility = "1.8"

dependencies {
annotationProcessor project(path: ":nullaway", configuration: "shadow")
annotationProcessor project(":nullaway")
annotationProcessor project(path: ":sample-library-model")

compileOnly deps.build.jsr305Annotations
Expand Down
2 changes: 1 addition & 1 deletion test-java-lib-lombok/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sourceCompatibility = "1.8"
targetCompatibility = "1.8"

dependencies {
annotationProcessor project(path: ":nullaway", configuration: "shadow")
annotationProcessor project(":nullaway")
annotationProcessor deps.test.lombok

compileOnly deps.build.jsr305Annotations
Expand Down
2 changes: 1 addition & 1 deletion test-java-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sourceCompatibility = "1.8"
targetCompatibility = "1.8"

dependencies {
annotationProcessor project(path: ":nullaway", configuration: "shadow")
annotationProcessor project(":nullaway")

compileOnly deps.build.jsr305Annotations
compileOnly deps.build.javaxValidation
Expand Down
4 changes: 2 additions & 2 deletions test-library-models/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ targetCompatibility = "1.8"
dependencies {
compileOnly deps.apt.autoService
annotationProcessor deps.apt.autoService
compileOnly project(path: ":nullaway", configuration: "shadow")
annotationProcessor project(path: ":nullaway", configuration: "shadow")
compileOnly project(":nullaway")
annotationProcessor project(":nullaway")
compileOnly deps.build.guava
}

Expand Down

0 comments on commit 35fa696

Please sign in to comment.