Skip to content

Commit

Permalink
Add CheckerFramework to GitHub Actions CI
Browse files Browse the repository at this point in the history
CheckerFramework needs an annotated JDK, so it is not activated by default
  • Loading branch information
vlsi committed Apr 20, 2020
1 parent 826c1cd commit a11b3dd
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,18 @@ jobs:
- name: 'Test'
run: |
./gradlew --no-parallel --no-daemon testSlow
linux-checkerframework:
name: 'CheckerFramework (JDK 11)'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: 'Set up JDK 11'
uses: actions/setup-java@v1
with:
java-version: 11
- name: 'Run CheckerFramework'
run: |
./gradlew --no-parallel --no-daemon -PenableCheckerframework classes
1 change: 1 addition & 0 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies {
// In other words, marking dependency as "runtime" would avoid accidental
// dependency on it during compilation
apiv("com.beust:jcommander")
apiv("org.checkerframework:checker-qual", "checkerframework")
apiv("com.datastax.cassandra:cassandra-driver-core")
apiv("com.esri.geometry:esri-geometry-api")
apiv("com.fasterxml.jackson.core:jackson-annotations", "jackson")
Expand Down
26 changes: 26 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ plugins {
// Verification
checkstyle
calcite.buildext
id("org.checkerframework") apply false
id("com.github.autostyle")
id("org.nosphere.apache.rat")
id("com.github.spotbugs")
Expand Down Expand Up @@ -63,6 +64,7 @@ val enableSpotBugs = props.bool("spotbugs")
val skipCheckstyle by props()
val skipAutostyle by props()
val skipJavadoc by props()
val enableCheckerframework by props()
val enableMavenLocal by props()
val enableGradleMetadata by props()
// Inherited from stage-vote-release-plugin: skipSign, useGpgCmd
Expand Down Expand Up @@ -495,6 +497,30 @@ allprojects {
signaturesFiles = files("$rootDir/src/main/config/forbidden-apis/signatures.txt")
}

if (enableCheckerframework) {
apply(plugin = "org.checkerframework")
dependencies {
"checkerFramework"("org.checkerframework:checker:${"checkerframework".v}")
// CheckerFramework annotations might be used in the code as follows:
// dependencies {
// "compileOnly"("org.checkerframework:checker-qual")
// "testCompileOnly"("org.checkerframework:checker-qual")
// }
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
// only needed for JDK 8
"checkerFrameworkAnnotatedJDK"("org.checkerframework:jdk8")
}
}
configure<org.checkerframework.gradle.plugin.CheckerFrameworkExtension> {
applyToSubprojects = false
skipVersionCheck = true
// See https://checkerframework.org/manual/#introduction
checkers.add("org.checkerframework.checker.nullness.NullnessChecker")
checkers.add("org.checkerframework.checker.optional.OptionalChecker")
checkers.add("org.checkerframework.checker.regex.RegexChecker")
}
}

tasks {
configureEach<Jar> {
manifest {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pluginManagement {
fun String.v() = extra["$this.version"].toString()
fun PluginDependenciesSpec.idv(id: String, key: String = id) = id(id) version key.v()

idv("org.checkerframework")
idv("com.github.autostyle")
idv("com.github.johnrengelman.shadow")
idv("com.github.spotbugs")
Expand Down

0 comments on commit a11b3dd

Please sign in to comment.