-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathbuild.gradle
More file actions
261 lines (225 loc) · 8.76 KB
/
build.gradle
File metadata and controls
261 lines (225 loc) · 8.76 KB
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
plugins {
id 'ca.coglinc.javacc' version '2.4.0'
id 'antlr'
}
description "Core functionality (terms, rules, prover, ...) for deductive verification of Java programs"
configurations { antlr4 }
dependencies {
api project(':key.util')
//api group: group, name: 'recoderkey', version: '1.0'
api project(':recoder')
implementation group: 'net.java.dev.javacc', name: 'javacc', version: '4.0'
implementation group: 'org.antlr', name: 'antlr-runtime', version: '3.5.3'
implementation group: 'antlr', name: 'antlr', version: '2.7.7'
javacc group: 'net.java.dev.javacc', name: 'javacc', version: '4.0'
antlr group: 'org.antlr', name: 'antlr', version: '3.5.3' // use ANTLR version 3
antlr4 "org.antlr:antlr4:4.13.1"
api "org.antlr:antlr4-runtime:4.13.1"
//implementation group: 'com.google.guava', name: 'guava', version: '28.1-jre'
}
// The target directory for JavaCC (parser generation)
def javaCCOutputDir = file("${buildDir}/generated-src/javacc")
def javaCCOutputDirMain = file("$javaCCOutputDir/main")
sourceSets.main.java.srcDirs(javaCCOutputDirMain, "$projectDir/build/generated-src/antlr4/main/")
// Generate code from ANTLR grammars.
generateGrammarSource {
maxHeapSize = "64m"
arguments += ["-visitor", "-listener", "-long-messages"]
}
// Generate code from ANTLR grammars in testing.
generateTestGrammarSource {
maxHeapSize = "64m"
arguments += ["-visitor", "-listener", "-long-messages"]
}
// Generate code from JavaCC grammars.
compileJavacc {
outputDirectory = javaCCOutputDirMain
inputDirectory = file("src/main/javacc")
doLast {
// Some manual overwriting of Token files needed
copy {
from("src/main/javacc/de/uka/ilkd/key/parser/schemajava/Token.java")
into "$javaCCOutputDirMain/de/uka/ilkd/key/parser/schemajava/"
}
copy {
from("src/main/javacc/de/uka/ilkd/key/parser/proofjava/Token.java")
into "$javaCCOutputDirMain/de/uka/ilkd/key/parser/proofjava/"
}
copy {
from("src/main/javacc/de/uka/ilkd/key/parser/schemajava/JavaCharStream.java")
into "$javaCCOutputDirMain/de/uka/ilkd/key/parser/schemajava/"
}
copy {
from("src/main/javacc/de/uka/ilkd/key/parser/proofjava/JavaCharStream.java")
into "$javaCCOutputDirMain/de/uka/ilkd/key/parser/proofjava/"
}
}
}
task generateSMTListings {
def pack = "de/uka/ilkd/key/smt/newsmt2"
def resourcesDir = "${project.projectDir}/src/main/resources"
def outputDir = resourcesDir // in the future that should be "${project.buildDir}/resources/main"
// ${project.buildDir}
doLast {
new File("$outputDir/$pack/DefinedSymbolsHandler.preamble.xml").withWriter { list ->
list.writeLine '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
list.writeLine '<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">'
list.writeLine '<properties>'
new File("$resourcesDir/$pack").eachFile {
if (it.name.endsWith('.DefinedSymbolsHandler.preamble.xml')) {
// println it.name
it.eachLine { list.writeLine it }
}
}
list.writeLine '</properties>'
}
}
}
task generateSolverPropsList {
def pack = "de/uka/ilkd/key/smt/solvertypes"
def resourcesDir = "${project.projectDir}/src/main/resources"
def outputDir = resourcesDir // in the future that should be "${project.buildDir}/resources/main"
// ${project.buildDir}
doLast {
def list = []
def dir = new File("$outputDir/$pack/")
dir.eachFileRecurse({ file ->
if (file.name.endsWith(".props")) {
list.add(file.name)
}
})
list.sort()
if (!file("$outputDir/$pack/solvers.txt").exists()) {
String files = ''
for (String propsFile : list) {
files += propsFile + System.lineSeparator()
}
new File("$outputDir/$pack/solvers.txt").withWriter { listSolvers ->
listSolvers.write files
}
}
}
}
classes.dependsOn << generateSMTListings
classes.dependsOn << generateSolverPropsList
tasks.withType(Test) {
enableAssertions = true
}
task testProveRules(type: Test) {
description 'Proves KeY taclet rules tagged as lemma'
group "verification"
filter { includeTestsMatching "ProveRulesTest" }
//useJUnitPlatform() {includeTags "testProveRules" }
}
task testRunAllFunProofs(type: Test) {
description 'Prove/reload all keyfiles tagged for regression testing'
group "verification"
filter {
includeTestsMatching "RunAllProofsFunctional"
}
}
task testRunAllInfProofs(type: Test) {
description 'Prove/reload all keyfiles tagged for regression testing'
group "verification"
filter {
includeTestsMatching "RunAllProofsInfFlow"
}
}
task testProveSMTLemmas(type: Test) {
description 'Prove (or load proofs for) lemmas used in the SMT translation'
group "verification"
filter {
includeTestsMatching "ProveSMTLemmasTest"
}
}
// Run the tests for the new smt translation in strict mode
// where "unknown" is less accepted
task testStrictSMT(type: Test) {
description 'Run the tests for the new smt translation in strict mode'
group 'verification'
systemProperty("key.newsmt2.stricttests", "true")
filter {
includeTestsMatching "MasterHandlerTest"
}
}
//Generation of the three version files within the resources by executing `git'.
task generateVersionFiles() {
def outputFolder = file("build/resources/main/de/uka/ilkd/key/util")
def sha1 = new File(outputFolder, "sha1")
def branch = new File(outputFolder, "branch")
def versionf = new File(outputFolder, "version")
inputs.files "$project.rootDir/.git/HEAD"
outputs.files sha1, branch, versionf
def gitRevision = gitRevParse('HEAD')
def gitBranch = gitRevParse('--abbrev-ref HEAD')
doLast {
sha1.text = gitRevision
branch.text = gitBranch
versionf.text = rootProject.version
}
}
// Helper function that calls "git rev-parse" to
// find names/SHAs for commits
static def gitRevParse(String args) {
try {
return "git rev-parse $args".execute().text.trim()
} catch (Exception e) {
return ""
}
}
// @AW: Say something here. From POV this explain by itself.
processResources.dependsOn generateVersionFiles
def antlr4OutputKey = "$projectDir/build/generated-src/antlr4/main/de/uka/ilkd/key/nparser"
task runAntlr4Key(type: JavaExec) {
//see incremental task api, prevents rerun if nothing has changed.
inputs.files "src/main/antlr4/KeYLexer.g4", "src/main/antlr4/KeYParser.g4"
outputs.dir antlr4OutputKey
classpath = configurations.antlr4
mainClass.set("org.antlr.v4.Tool")
args = ["-visitor",
"-Xexact-output-dir", "-o", antlr4OutputKey,
"-package", "de.uka.ilkd.key.nparser",
"src/main/antlr4/KeYLexer.g4", "src/main/antlr4/KeYParser.g4"]
doFirst {
file(antlr4OutputKey).mkdirs()
println("create $antlr4OutputKey")
}
}
compileJava.dependsOn runAntlr4Key
task debugKeyLexer(type: JavaExec) {
mainClass.set("de.uka.ilkd.key.nparser.DebugKeyLexer")
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
// @AW: Say something here. From POV this explain by itself.
processResources.dependsOn generateVersionFiles
def antlr4OutputJml = "$projectDir/build/generated-src/antlr4/main/de/uka/ilkd/key/speclang/njml"
task runAntlr4Jml(type: JavaExec) {
//see incremental task api, prevents rerun if nothing has changed.
inputs.files "src/main/antlr4/JmlLexer.g4", "src/main/antlr4/JmlParser.g4"
outputs.dir antlr4OutputJml
classpath = configurations.antlr4
mainClass.set("org.antlr.v4.Tool")
args = ["-visitor",
"-Xexact-output-dir", "-o", antlr4OutputJml,
"-package", "de.uka.ilkd.key.speclang.njml",
"src/main/antlr4/JmlLexer.g4", "src/main/antlr4/JmlParser.g4"]
doFirst {
file(antlr4OutputJml).mkdirs()
println("create $antlr4OutputJml")
}
}
compileJava.dependsOn runAntlr4Jml
task debugJmlLexer(type: JavaExec) {
mainClass.set("de.uka.ilkd.key.speclang.njml.DebugJmlLexer")
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task ptest(type: Test) { group "verification" }
task generateRAPUnitTests(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
mainClass.set("de.uka.ilkd.key.proof.runallproofs.GenerateUnitTests")
args("$buildDir/generated-src/rap/")
}
sourceSets.test.java.srcDirs("$buildDir/generated-src/rap/")
sourcesJar.dependsOn(runAntlr4Jml, runAntlr4Key, compileJavacc, generateGrammarSource)