Skip to content

Commit a11b3dd

Browse files
committed
Add CheckerFramework to GitHub Actions CI
CheckerFramework needs an annotated JDK, so it is not activated by default
1 parent 826c1cd commit a11b3dd

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

.github/workflows/main.yml

+15
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,18 @@ jobs:
106106
- name: 'Test'
107107
run: |
108108
./gradlew --no-parallel --no-daemon testSlow
109+
110+
linux-checkerframework:
111+
name: 'CheckerFramework (JDK 11)'
112+
runs-on: ubuntu-latest
113+
steps:
114+
- uses: actions/checkout@v2
115+
with:
116+
fetch-depth: 50
117+
- name: 'Set up JDK 11'
118+
uses: actions/setup-java@v1
119+
with:
120+
java-version: 11
121+
- name: 'Run CheckerFramework'
122+
run: |
123+
./gradlew --no-parallel --no-daemon -PenableCheckerframework classes

bom/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dependencies {
4646
// In other words, marking dependency as "runtime" would avoid accidental
4747
// dependency on it during compilation
4848
apiv("com.beust:jcommander")
49+
apiv("org.checkerframework:checker-qual", "checkerframework")
4950
apiv("com.datastax.cassandra:cassandra-driver-core")
5051
apiv("com.esri.geometry:esri-geometry-api")
5152
apiv("com.fasterxml.jackson.core:jackson-annotations", "jackson")

build.gradle.kts

+26
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ plugins {
3333
// Verification
3434
checkstyle
3535
calcite.buildext
36+
id("org.checkerframework") apply false
3637
id("com.github.autostyle")
3738
id("org.nosphere.apache.rat")
3839
id("com.github.spotbugs")
@@ -63,6 +64,7 @@ val enableSpotBugs = props.bool("spotbugs")
6364
val skipCheckstyle by props()
6465
val skipAutostyle by props()
6566
val skipJavadoc by props()
67+
val enableCheckerframework by props()
6668
val enableMavenLocal by props()
6769
val enableGradleMetadata by props()
6870
// Inherited from stage-vote-release-plugin: skipSign, useGpgCmd
@@ -495,6 +497,30 @@ allprojects {
495497
signaturesFiles = files("$rootDir/src/main/config/forbidden-apis/signatures.txt")
496498
}
497499

500+
if (enableCheckerframework) {
501+
apply(plugin = "org.checkerframework")
502+
dependencies {
503+
"checkerFramework"("org.checkerframework:checker:${"checkerframework".v}")
504+
// CheckerFramework annotations might be used in the code as follows:
505+
// dependencies {
506+
// "compileOnly"("org.checkerframework:checker-qual")
507+
// "testCompileOnly"("org.checkerframework:checker-qual")
508+
// }
509+
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
510+
// only needed for JDK 8
511+
"checkerFrameworkAnnotatedJDK"("org.checkerframework:jdk8")
512+
}
513+
}
514+
configure<org.checkerframework.gradle.plugin.CheckerFrameworkExtension> {
515+
applyToSubprojects = false
516+
skipVersionCheck = true
517+
// See https://checkerframework.org/manual/#introduction
518+
checkers.add("org.checkerframework.checker.nullness.NullnessChecker")
519+
checkers.add("org.checkerframework.checker.optional.OptionalChecker")
520+
checkers.add("org.checkerframework.checker.regex.RegexChecker")
521+
}
522+
}
523+
498524
tasks {
499525
configureEach<Jar> {
500526
manifest {

settings.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pluginManagement {
1919
fun String.v() = extra["$this.version"].toString()
2020
fun PluginDependenciesSpec.idv(id: String, key: String = id) = id(id) version key.v()
2121

22+
idv("org.checkerframework")
2223
idv("com.github.autostyle")
2324
idv("com.github.johnrengelman.shadow")
2425
idv("com.github.spotbugs")

0 commit comments

Comments
 (0)