Skip to content

Commit

Permalink
Merge branch 'master' into manu/tweak-cast-suppressions
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Aug 22, 2023
2 parents 9a4ac1a + 56d5ff1 commit 5b46f06
Show file tree
Hide file tree
Showing 28 changed files with 468 additions and 203 deletions.
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Releasing
3. Update the `README.md` with the new version.
4. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the new version)
5. `git tag -a vX.Y.Z -m "Version X.Y.Z"` (where X.Y.Z is the new version)
6. `./gradlew clean publish --no-daemon --no-parallel`
6. `./gradlew clean publish`
7. Update the `gradle.properties` to the next SNAPSHOT version.
8. `git commit -am "Prepare next development version."`
9. `git push && git push --tags`
Expand Down
36 changes: 18 additions & 18 deletions annotations/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@
import net.ltgt.gradle.errorprone.CheckSeverity

plugins {
id 'java-library'
id 'nullaway.jacoco-conventions'
id 'java-library'
id 'nullaway.jacoco-conventions'
}

dependencies {
}

test {
maxHeapSize = "1024m"
// to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
jvmArgs += [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
// Accessed by Lombok tests
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
]
maxHeapSize = "1024m"
// to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
jvmArgs += [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
// Accessed by Lombok tests
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
]
}

apply plugin: 'com.vanniktech.maven.publish'
50 changes: 30 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.21.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.25.3'
// This restriction is needed due to our mix of Android and Java modules;
// without it, the build fails with a weird error.
// See https://stackoverflow.com/questions/70217853/how-to-include-android-project-in-a-gradle-multi-project-build
Expand All @@ -35,18 +35,18 @@ buildscript {
}
}
plugins {
id "com.diffplug.spotless" version "6.20.0"
id "net.ltgt.errorprone" version "3.1.0" apply false
id "com.github.johnrengelman.shadow" version "8.1.1" apply false
id "com.github.kt3k.coveralls" version "2.12.0" apply false
id "me.champeau.jmh" version "0.7.1" apply false
id "com.github.ben-manes.versions" version "0.47.0"
id "com.felipefzdz.gradle.shellcheck" version "1.4.6"
id "com.diffplug.spotless" version "6.20.0"
id "net.ltgt.errorprone" version "3.1.0" apply false
id "com.github.johnrengelman.shadow" version "8.1.1" apply false
id "com.github.kt3k.coveralls" version "2.12.0" apply false
id "me.champeau.jmh" version "0.7.1" apply false
id "com.github.ben-manes.versions" version "0.47.0"
id "com.felipefzdz.gradle.shellcheck" version "1.4.6"
}

repositories {
// to get the google-java-format jar and dependencies
mavenCentral()
// to get the google-java-format jar and dependencies
mavenCentral()
}

apply from: "gradle/dependencies.gradle"
Expand All @@ -59,10 +59,10 @@ subprojects { project ->
project.tasks.withType(JavaCompile) {
dependsOn(installGitHooks)
options.compilerArgs += [
"-Xlint:deprecation",
"-Xlint:rawtypes",
"-Xlint:unchecked",
"-Werror"
"-Xlint:deprecation",
"-Xlint:rawtypes",
"-Xlint:unchecked",
"-Werror"
]
options.errorprone {
// disable warnings in generated code; AutoValue code fails UnnecessaryParentheses check
Expand All @@ -84,7 +84,7 @@ subprojects { project ->
// To enable auto-patching, uncomment the line below, replace [CheckerName] with
// the checker(s) you want to apply patches for (comma-separated), and above, disable
// "-Werror"
// errorproneArgs.addAll("-XepPatchChecks:[CheckerName]", "-XepPatchLocation:IN_PLACE")
// errorproneArgs.addAll("-XepPatchChecks:[CheckerName]", "-XepPatchLocation:IN_PLACE")
}
}

Expand Down Expand Up @@ -118,9 +118,19 @@ subprojects { project ->

spotless {
predeclareDeps()
groovyGradle {
target '**/*.gradle'
greclipse()
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
}
spotlessPredeclare {
java { googleJavaFormat('1.17.0') }
groovyGradle {
greclipse()
}
}

shellcheck {
Expand All @@ -138,9 +148,9 @@ shellcheck {
//

tasks.register('installGitHooks', Copy) {
from(file('config/hooks/pre-commit-stub')) {
rename 'pre-commit-stub', 'pre-commit'
}
into file('.git/hooks')
fileMode 0777
from(file('config/hooks/pre-commit-stub')) {
rename 'pre-commit-stub', 'pre-commit'
}
into file('.git/hooks')
fileMode 0777
}
17 changes: 11 additions & 6 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ if (project.hasProperty("epApiVersion")) {
}
if (epApiVNum.compareTo(VersionNumber.parse(oldestErrorProneVersion)) < 0) {
throw new IllegalArgumentException(
"Error Prone API version " + epApiVersion + " is too old; "
+ oldestErrorProneVersion + " is the oldest supported version")
"Error Prone API version " + epApiVersion + " is too old; "
+ oldestErrorProneVersion + " is the oldest supported version")
}
errorProneVersionToCompileAgainst = epApiVersion
}
Expand Down Expand Up @@ -77,9 +77,11 @@ def build = [
jspecify : "org.jspecify:jspecify:0.3.0",
jsr305Annotations : "com.google.code.findbugs:jsr305:3.0.2",
commonsIO : "commons-io:commons-io:2.11.0",
wala : ["com.ibm.wala:com.ibm.wala.util:${versions.wala}",
"com.ibm.wala:com.ibm.wala.shrike:${versions.wala}",
"com.ibm.wala:com.ibm.wala.core:${versions.wala}"],
wala : [
"com.ibm.wala:com.ibm.wala.util:${versions.wala}",
"com.ibm.wala:com.ibm.wala.shrike:${versions.wala}",
"com.ibm.wala:com.ibm.wala.core:${versions.wala}"
],
commonscli : "commons-cli:commons-cli:${versions.commonscli}",

// android stuff
Expand All @@ -96,7 +98,10 @@ def support = [

def test = [
junit4 : "junit:junit:4.13.2",
junit5Jupiter : ["org.junit.jupiter:junit-jupiter-api:5.0.2","org.apiguardian:apiguardian-api:1.0.0"],
junit5Jupiter : [
"org.junit.jupiter:junit-jupiter-api:5.0.2",
"org.apiguardian:apiguardian-api:1.0.0"
],
jetbrainsAnnotations : "org.jetbrains:annotations:13.0",
cfQual : "org.checkerframework:checker-qual:${versions.checkerFramework}",
// 2.5.5 is the last release to contain this artifact
Expand Down
24 changes: 12 additions & 12 deletions guava-recent-unit-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ test {
maxHeapSize = "1024m"
// to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
jvmArgs += [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
// Accessed by Lombok tests
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
// Accessed by Lombok tests
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
]
}

Expand Down
14 changes: 7 additions & 7 deletions jar-infer/jar-infer-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ java {

jar {
manifest {
attributes(
'Main-Class': 'com.uber.nullaway.jarinfer.JarInfer'
)
attributes('Main-Class': 'com.uber.nullaway.jarinfer.JarInfer')
}
// add this classifier so that the output file for the jar task differs from
// the output file for the shadowJar task (otherwise they overwrite each other's
Expand All @@ -46,7 +44,9 @@ jar {

shadowJar {
mergeServiceFiles()
configurations = [project.configurations.runtimeClasspath]
configurations = [
project.configurations.runtimeClasspath
]
archiveClassifier = ""
}
shadowJar.dependsOn jar
Expand Down Expand Up @@ -79,7 +79,7 @@ publishing {
// Since we are skipping the default maven publication, we append the `:sources` and
// `:javadoc` artifacts here. They are also required for Maven Central validation.
afterEvaluate {
artifact project.javaSourcesJar
artifact project.sourcesJar
artifact project.javadocJar
}
// The shadow publication does not auto-configure the pom.xml file for us, so we need to
Expand Down Expand Up @@ -110,15 +110,15 @@ publishing {
}
}
}
}
}

afterEvaluate {
// Below is a series of hacks needed to get publication to work with
// gradle-maven-publish-plugin >= 0.15.0 (itself needed after the upgrade to Gradle 8.0.2).
// Not sure why e.g. publishShadowPublicationToMavenCentralRepository must depend on signMavenPublication
// (rather than just signShadowPublication)
project.tasks.named('generateMetadataFileForMavenPublication').configure {
dependsOn 'javaSourcesJar'
dependsOn 'sourcesJar'
dependsOn 'simpleJavadocJar'
}
if (project.tasks.findByName('signShadowPublication')) {
Expand Down
24 changes: 12 additions & 12 deletions jar-infer/jar-infer-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ test {
maxHeapSize = "1024m"
// to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
jvmArgs += [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
// Accessed by Lombok tests
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
// Accessed by Lombok tests
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
]
dependsOn ':jar-infer:test-android-lib-jarinfer:bundleReleaseAar'
}
Expand Down
33 changes: 16 additions & 17 deletions jar-infer/nullaway-integration-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,33 @@
* limitations under the License.
*/
plugins {
id "java-library"
id "nullaway.jacoco-conventions"
id "java-library"
id "nullaway.jacoco-conventions"
}

dependencies {
testImplementation deps.test.junit4
testImplementation(deps.build.errorProneTestHelpers) {
testImplementation deps.test.junit4
testImplementation(deps.build.errorProneTestHelpers) {
exclude group: "junit", module: "junit"
}
testImplementation project(":nullaway")
testImplementation project(":jar-infer:test-java-lib-jarinfer")

testImplementation project(":nullaway")
testImplementation project(":jar-infer:test-java-lib-jarinfer")
}


test {
maxHeapSize = "1024m"
// to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
jvmArgs += [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
]
}
13 changes: 9 additions & 4 deletions jar-infer/test-java-lib-jarinfer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

plugins {
id "java-library"
id "java-library"
}

evaluationDependsOn(":jar-infer:jar-infer-cli")
Expand All @@ -28,15 +28,20 @@ jar {
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
)
)
}
}

jar.doLast {
javaexec {
classpath = files("${rootProject.projectDir}/jar-infer/jar-infer-cli/build/libs/jar-infer-cli-${VERSION_NAME}.jar")
classpath = files("${rootProject.projectDir}/jar-infer/jar-infer-cli/build/libs/jar-infer-cli.jar")
main = "com.uber.nullaway.jarinfer.JarInfer"
args = ["-i", jar.archiveFile.get(), "-o", "${jar.destinationDirectory.get()}/${astubxPath}"]
args = [
"-i",
jar.archiveFile.get(),
"-o",
"${jar.destinationDirectory.get()}/${astubxPath}"
]
}
exec {
workingDir "./build/libs"
Expand Down
Loading

0 comments on commit 5b46f06

Please sign in to comment.