forked from kelloggm/div-by-zero-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
97 lines (83 loc) · 3.55 KB
/
build.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
plugins {
id 'java'
id 'maven-publish'
}
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
}
configurations {
// for putting Error Prone javac in bootclasspath for running tests
errorproneJavac
}
ext.versions = [
checkerFramework: "3.21.3",
]
sourceCompatibility = 1.8
def checkerframework_local = false // Set this variable to [true] while using local version of checker framework.
dependencies {
// This dependency is found on compile classpath of this component and consumers.
if (checkerframework_local) {
implementation files('${CHECKERFRAMEWORK}/checker/dist/checker-qual.jar')
implementation files('${CHECKERFRAMEWORK}/checker/dist/checker.jar')
}
else {
implementation "org.checkerframework:checker:${versions.checkerFramework}"
implementation "org.checkerframework:checker-qual:${versions.checkerFramework}"
}
compileOnly "com.google.errorprone:javac:9+181-r4173-1"
// Testing
testImplementation 'junit:junit:4.13.2'
testImplementation "org.checkerframework:framework-test:${versions.checkerFramework}"
errorproneJavac "com.google.errorprone:javac:9+181-r4173-1"
}
tasks.withType(JavaCompile).all {
options.compilerArgs.add("-Xlint:all")
}
// Add `mavenLocal()` in `repositories`, then run `./gradlew publishToMavenLocal`
// to publish your checker to your local Maven repository.
publishing {
publications {
maven(MavenPublication) {
groupId = 'org.checkerframework'
artifactId = 'dividebyzero-checker'
version = '0.1-SNAPSHOT'
from components.java
}
}
}
test {
inputs.files("tests/dividebyzero")
if (!JavaVersion.current().java9Compatible) {
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}"
} else {
// A list of add-export and add-open arguments to be used when running the Checker Framework.
// Keep this list in sync with the list in the Checker Framework manual.
var compilerArgsForRunningCF = [
// These are required in Java 16+ because the --illegal-access option is set to deny
// by default. None of these packages are accessed via reflection, so the module
// only needs to be exported, but not opened.
"--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.code=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.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",
// Required because the Checker Framework reflectively accesses private members in com.sun.tools.javac.comp.
"--add-opens", "jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
]
jvmArgs += compilerArgsForRunningCF
}
testLogging {
showStandardStreams = true
// Show the found unexpected diagnostics and expected diagnostics not found.
exceptionFormat "full"
events "failed"
}
}
clean.doFirst {
delete "${rootDir}/tests/build/"
}