forked from randoop/randoop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckerframework.gradle
65 lines (60 loc) · 2.98 KB
/
checkerframework.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
///////////////////////////////////////////////////////////////////////////
/// Checker Framework pluggable type-checking
///
repositories {
mavenCentral()
}
configurations {
checkerFrameworkAnnotatedJDK {
description = 'a copy of JDK classes with Checker Framework type qualifers inserted'
}
}
// By default, use Checker Framework from Maven Central.
// Pass -PcfLocal to use a locally-built version of the Checker Framework.
dependencies {
if (!rootProject.hasProperty('cfLocal')) {
ext.checkerFrameworkVersion = '2.8.0'
checkerFrameworkAnnotatedJDK "org.checkerframework:jdk8:${checkerFrameworkVersion}"
annotationProcessor "org.checkerframework:checker:${checkerFrameworkVersion}"
implementation "org.checkerframework:checker-qual:${checkerFrameworkVersion}"
} else if (System.getenv("CHECKERFRAMEWORK") == null) {
throw new GradleException("Environment variable CHECKERFRAMEWORK is not set")
} else if (! file(System.getenv("CHECKERFRAMEWORK")).exists()) {
throw new GradleException("Environment variable CHECKERFRAMEWORK is set to non-existent directory " + System.getenv("CHECKERFRAMEWORK"));
} else {
ext.checkerframeworkdist = "$System.env.CHECKERFRAMEWORK/checker/dist"
checkerFrameworkAnnotatedJDK fileTree(dir: "${ext.checkerframeworkdist}", include: "jdk8.jar")
annotationProcessor fileTree(dir: "${ext.checkerframeworkdist}", include: 'checker.jar')
implementation fileTree(dir: "${ext.checkerframeworkdist}", include: 'checker-qual.jar')
}
}
// // To type-check all projects.
// allprojects {
// tasks.withType(JavaCompile).all { JavaCompile compile ->
// compile.doFirst {
// compile.options.compilerArgs = [
// '-processor', 'org.checkerframework.checker.formatter.FormatterChecker,org.checkerframework.checker.index.IndexChecker,org.checkerframework.checker.lock.LockChecker,org.checkerframework.checker.nullness.NullnessChecker,org.checkerframework.checker.signature.SignatureChecker',
// '-Xmaxerrs', '10000',
// '-Awarns', // -Awarns turns Checker Framework errors into warnings
// '-AcheckPurityAnnotations',
// "-Xbootclasspath/p:${configurations.checkerFrameworkAnnotatedJDK.asPath}",
// "-Astubs=$System.env.CHECKERFRAMEWORK/checker/resources/javadoc.astub" // TODO: does not work when downloading from Maven Central
// ]
// }
// }
// }
// To typecheck only the current project's main source set (in a multi-project
// build), use this instead:
compileJava {
doFirst {
options.compilerArgs = [
// '-processor', 'org.checkerframework.checker.nullness.NullnessChecker,org.checkerframework.checker.signature.SignatureChecker',
'-processor', 'org.checkerframework.checker.signature.SignatureChecker',
'-Xmaxerrs', '10000',
'-Xmaxwarns', '10000',
// '-Awarns', // -Awarns turns Checker Framework errors into warnings
// '-AcheckPurityAnnotations',
"-Xbootclasspath/p:${configurations.checkerFrameworkAnnotatedJDK.asPath}"
]
}
}