generated from typetools/templatefora-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·175 lines (154 loc) · 6.82 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
* MIT License
*
* Copyright (c) 2024 University of California, Riverside
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
plugins {
id 'java'
id 'maven-publish'
id 'com.diffplug.spotless' version '6.14.0'
id 'com.github.sherter.google-java-format' version '0.9'
}
repositories {
// Use Maven Central for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
mavenLocal()
maven{
url "https://artifacts.alfresco.com/nexus/content/repositories/public/"
}
}
configurations {
// for putting Error Prone javac in bootclasspath for running tests
errorproneJavac
}
ext.versions = [
checkerFramework: "3.42.0",
]
sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9
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"
// Guava
implementation 'com.google.guava:guava:30.1.1-jre'
testImplementation 'com.google.guava:guava:30.1.1-jre'
// JSON
implementation 'org.json:json:20230227'
testImplementation 'org.json:json:20230227'
testImplementation 'commons-io:commons-io:2.13.0'
// Testing
testImplementation 'junit:junit:4.13.2'
testImplementation "org.checkerframework:framework-test:${versions.checkerFramework}"
testImplementation 'org.apache.commons:commons-text:1.9'
testImplementation 'javax.servlet:servlet-api:2.5'
testImplementation group: 'org.safehaus.jug', name: 'jug', version: '2.0.0', classifier: 'lgpl'
implementation 'com.vaadin:vaadin-shared:8.20.3'
testImplementation 'org.springframework:spring-websocket:5.3.29'
testImplementation 'com.opensymphony:xwork:2.1.2'
testImplementation 'commons-cli:commons-cli:1.4'
testImplementation 'org.apache.commons:commons-lang3:3.12.0'
testImplementation 'org.apache.commons:commons-digester3:3.2'
testImplementation 'com.baomidou:mybatis-plus-core:3.5.4.1'
testImplementation 'org.owasp.esapi:esapi:2.5.3.1'
testImplementation 'org.springframework.extensions.surf:spring-webscripts:5.9'
testImplementation 'xml-resolver:xml-resolver:1.2'
testImplementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2'
testImplementation project(':thirdparty')
// errorprone
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 = 'edu.ucr.cs.riple.taint'
artifactId = 'ucrtainting-checker'
version = '0.3-SNAPSHOT'
from components.java
}
}
}
test {
maxParallelForks = Runtime.getRuntime().availableProcessors()
inputs.files("tests/ucrtainting")
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/"
}
task printClasspath {
description 'Prints the runtime classpath of the checker. ' +
'When typechecking, put the output of this task on either the ' +
'processor path or the classpath of the project being type-checed.'
doLast {
println sourceSets.main.runtimeClasspath.asPath
}
}
sourceSets {
main {
resources {
// ensures that any .stub files present in the same directory as
// the checker source code are copied into the distributed jar
srcDirs += ['src/main/java']
}
}
}