Skip to content

Commit

Permalink
Merge a9d6f37 into 18b6ab3
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Jul 1, 2023
2 parents 18b6ab3 + a9d6f37 commit 44471c8
Show file tree
Hide file tree
Showing 19 changed files with 216 additions and 246 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
java: 8
epVersion: 2.4.0
- os: ubuntu-latest
java: 11
epVersion: 2.4.0
Expand Down Expand Up @@ -47,13 +44,6 @@ jobs:
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: Build and test using Java 8 and Error Prone ${{ matrix.epVersion }}
env:
ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
uses: gradle/gradle-build-action@v2
with:
arguments: build
if: matrix.java == '8'
- name: Build and test using Java 11 and Error Prone ${{ matrix.epVersion }}
env:
ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
Expand All @@ -66,7 +56,7 @@ jobs:
ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
uses: gradle/gradle-build-action@v2
with:
arguments: build -x :jar-infer:jar-infer-lib:build -x :jar-infer:nullaway-integration-test:build -x :jar-infer:test-java-lib-jarinfer:build
arguments: build
if: matrix.java == '17'
- name: Report jacoco coverage
uses: gradle/gradle-build-action@v2
Expand All @@ -84,7 +74,7 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: publishToMavenLocal -x signMavenPublication -x signShadowPublication
if: matrix.java == '8'
if: matrix.java == '11'
- name: Check that Git tree is clean after build and test
run: ./.buildscript/check_git_clean.sh
publish_snapshot:
Expand All @@ -95,10 +85,10 @@ jobs:
steps:
- name: 'Check out repository'
uses: actions/checkout@v3
- name: 'Set up JDK 8'
- name: 'Set up JDK 11'
uses: actions/setup-java@v3
with:
java-version: 8
java-version: 11
distribution: 'temurin'
- name: 'Publish'
uses: gradle/gradle-build-action@v2
Expand Down
36 changes: 15 additions & 21 deletions annotations/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,26 @@ plugins {
id 'nullaway.jacoco-conventions'
}

sourceCompatibility = 1.8

dependencies {
}

test {
maxHeapSize = "1024m"
if (!JavaVersion.current().java9Compatible) {
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}"
} else {
// 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",
]
}
// 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'
85 changes: 31 additions & 54 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,64 +57,41 @@ subprojects { project ->
}
project.tasks.withType(JavaCompile) {
dependsOn(installGitHooks)
if (JavaVersion.current().isJava9Compatible()) {
options.compilerArgs += [
"-Xlint:deprecation",
"-Xlint:rawtypes",
"-Xlint:unchecked",
"-Werror"
]
options.errorprone {
// disable warnings in generated code; AutoValue code fails UnnecessaryParentheses check
disableWarningsInGeneratedCode = true
// this check is too noisy
check("StringSplitter", CheckSeverity.OFF)
// https://github.com/google/error-prone/issues/3366
check("CanIgnoreReturnValueSuggester", CheckSeverity.OFF)
// turn up various checks
check("WildcardImport", CheckSeverity.ERROR)
check("MissingBraces", CheckSeverity.ERROR)
check("TypeToString", CheckSeverity.ERROR)
check("SymbolToString", CheckSeverity.ERROR)
check("MultipleTopLevelClasses", CheckSeverity.ERROR)
check("ClassName", CheckSeverity.ERROR)
check("PackageLocation", CheckSeverity.ERROR)
check("UnnecessaryAnonymousClass", CheckSeverity.ERROR)
check("UnusedException", CheckSeverity.ERROR)
// 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"
options.compilerArgs += [
"-Xlint:deprecation",
"-Xlint:rawtypes",
"-Xlint:unchecked",
"-Werror"
]
options.errorprone {
// disable warnings in generated code; AutoValue code fails UnnecessaryParentheses check
disableWarningsInGeneratedCode = true
// this check is too noisy
check("StringSplitter", CheckSeverity.OFF)
// https://github.com/google/error-prone/issues/3366
check("CanIgnoreReturnValueSuggester", CheckSeverity.OFF)
// turn up various checks
check("WildcardImport", CheckSeverity.ERROR)
check("MissingBraces", CheckSeverity.ERROR)
check("TypeToString", CheckSeverity.ERROR)
check("SymbolToString", CheckSeverity.ERROR)
check("MultipleTopLevelClasses", CheckSeverity.ERROR)
check("ClassName", CheckSeverity.ERROR)
check("PackageLocation", CheckSeverity.ERROR)
check("UnnecessaryAnonymousClass", CheckSeverity.ERROR)
check("UnusedException", CheckSeverity.ERROR)
// 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")
}
} else {
// Disable Error Prone checks on JDK 8, as more recent Error Prone versions don't run on JDK 8
// NOTE: we use disableAllChecks rather than the enabled flag because we still want to use the
// JDK 9 javac packaged with Error Prone, to work around the following bug with JDK 8 javac
// and use of the @NullMarked / @NullUnmarked annotations from jspecify:
// https://github.com/jspecify/jspecify/issues/302
options.errorprone.disableAllChecks = true
}
}

// We target Java 11 when building on JDK 11+, but Java 8 when building on JDK 8, since
// EP 2.11.0+ requires Java 11
if (JavaVersion.current() >= JavaVersion.VERSION_11) {
tasks.withType(JavaCompile) {
java.sourceCompatibility = "11"
java.targetCompatibility = "11"
}
} else {
tasks.withType(JavaCompile) {
java.sourceCompatibility = "1.8"
java.targetCompatibility = "1.8"
}
}

// Ensure we are running on Java 8 whenever publishing to remote repos
tasks.withType(PublishToMavenRepository) {
doFirst {
assert JavaVersion.current() == JavaVersion.VERSION_1_8 : "Only publish to remote repos on JDK 1.8"
}
// Target JDK 8. We need to use the older sourceCompatibility / targetCompatibility settings to get
// the build to work on JDK 11+. Once we stop supporting JDK 8, switch to using the javac "release" option
tasks.withType(JavaCompile) {
java.sourceCompatibility = "1.8"
java.targetCompatibility = "1.8"
}

tasks.withType(Test).configureEach {
Expand Down
7 changes: 3 additions & 4 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import org.gradle.util.VersionNumber
def oldestErrorProneVersion = "2.4.0"
// Latest released Error Prone version that we've tested with
def latestErrorProneVersion = "2.20.0"
// Default to using latest tested Error Prone version, except on Java 8, where 2.10.0 is the last version
// that works
def defaultErrorProneVersion = JavaVersion.current() >= JavaVersion.VERSION_11 ? latestErrorProneVersion : "2.10.0"
// Default to using latest tested Error Prone version
def defaultErrorProneVersion = latestErrorProneVersion
def errorProneVersionToCompileAgainst = defaultErrorProneVersion

// If the epApiVersion project property is set, compile and test against that version of Error Prone
Expand All @@ -49,7 +48,7 @@ def versions = [
// The version of Error Prone that NullAway is compiled and tested against
errorProneApi : errorProneVersionToCompileAgainst,
support : "27.1.1",
wala : "1.5.8",
wala : "1.6.1",
commonscli : "1.4",
autoValue : "1.9",
autoService : "1.0.1",
Expand Down
57 changes: 39 additions & 18 deletions guava-recent-unit-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,44 @@ dependencies {

test {
maxHeapSize = "1024m"
if (!JavaVersion.current().java9Compatible) {
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}"
} else {
// 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",
]
// 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",
]
}

// Create a task to test on JDK 8
def jdk8Test = tasks.register("testJdk8", Test) {
onlyIf {
// Only if we are using a version of Error Prone compatible with JDK 8
deps.versions.errorProneApi == "2.4.0"
}

javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
}

description = "Runs the test suite on JDK 8"
group = LifecycleBasePlugin.VERIFICATION_GROUP

// Copy inputs from normal Test task.
def testTask = tasks.getByName("test")
classpath = testTask.classpath
testClassesDirs = testTask.testClassesDirs
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}"
}

tasks.named('check').configure {
dependsOn(jdk8Test)
}
2 changes: 0 additions & 2 deletions jar-infer/android-jarinfer-models-sdk28/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ plugins {
id "java-library"
}

sourceCompatibility = 1.8

repositories {
mavenCentral()
}
Expand Down
2 changes: 0 additions & 2 deletions jar-infer/android-jarinfer-models-sdk29/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ plugins {
id "java-library"
}

sourceCompatibility = 1.8

repositories {
mavenCentral()
}
Expand Down
2 changes: 0 additions & 2 deletions jar-infer/android-jarinfer-models-sdk30/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ plugins {
id "java-library"
}

sourceCompatibility = 1.8

repositories {
mavenCentral()
}
Expand Down
2 changes: 0 additions & 2 deletions jar-infer/android-jarinfer-models-sdk31/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ plugins {
id "java-library"
}

sourceCompatibility = 1.8

repositories {
mavenCentral()
}
Expand Down
4 changes: 4 additions & 0 deletions jar-infer/jar-infer-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ plugins {
id "com.github.johnrengelman.shadow"
}

sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11

repositories {
mavenCentral()
}
Expand Down Expand Up @@ -125,6 +128,7 @@ publishing {
project.tasks.named('publishShadowPublicationToMavenLocal').configure {
dependsOn 'sourcesJar'
dependsOn 'simpleJavadocJar'
dependsOn 'signMavenPublication'
}
}
}
45 changes: 22 additions & 23 deletions jar-infer/jar-infer-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ plugins {
id 'nullaway.jacoco-conventions'
}

sourceCompatibility = 1.8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11

repositories {
mavenCentral()
Expand All @@ -45,28 +46,26 @@ dependencies {

test {
maxHeapSize = "1024m"
if (!JavaVersion.current().java9Compatible) {
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}"
} else {
// 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",
]
}
if (JavaVersion.current() >= JavaVersion.VERSION_11) {
dependsOn ':jar-infer:test-android-lib-jarinfer:bundleReleaseAar'
}
// 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",
]
dependsOn ':jar-infer:test-android-lib-jarinfer:bundleReleaseAar'
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs += "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"
}

apply plugin: 'com.vanniktech.maven.publish'
Loading

0 comments on commit 44471c8

Please sign in to comment.