Skip to content

Commit fe3f417

Browse files
committed
update gradle
1 parent 4e9f80a commit fe3f417

9 files changed

Lines changed: 53 additions & 115 deletions

File tree

build.gradle

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ plugins {
3030
}
3131

3232
sonar {
33-
properties {
34-
property "sonar.projectKey", "KeYProject_key"
35-
property "sonar.organization", "keyproject"
36-
property "sonar.host.url", "https://sonarcloud.io"
37-
}
33+
properties {
34+
property "sonar.projectKey", "KeYProject_key"
35+
property "sonar.organization", "keyproject"
36+
property "sonar.host.url", "https://sonarcloud.io"
37+
}
3838
}
3939

4040

@@ -85,50 +85,38 @@ subprojects {
8585
}
8686

8787
dependencies {
88-
implementation("org.slf4j:slf4j-api:2.0.16")
89-
implementation("org.slf4j:slf4j-api:2.0.16")
90-
91-
92-
compileOnly("org.jspecify:jspecify:1.0.0")
93-
testCompileOnly("org.jspecify:jspecify:1.0.0")
94-
def eisop_version = "3.42.0-eisop5"
95-
compileOnly "io.github.eisop:checker-qual:$eisop_version"
96-
compileOnly "io.github.eisop:checker-util:$eisop_version"
97-
testCompileOnly "io.github.eisop:checker-qual:$eisop_version"
98-
checkerFramework "io.github.eisop:checker-qual:$eisop_version"
99-
checkerFramework "io.github.eisop:checker:$eisop_version"
100-
101-
testImplementation("org.assertj:assertj-core:3.27.3")
102-
testImplementation("ch.qos.logback:logback-classic:1.5.15")
103-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4'
104-
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.4'
105-
testImplementation project(':key.util')
88+
implementation(libs.slf4j)
10689

107-
// test fixtures
108-
testImplementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2")
109-
testImplementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2")
90+
compileOnly(libs.jspecify)
91+
testCompileOnly(libs.jspecify)
11092

93+
compileOnly(libs.eisopCheckerQual)
94+
compileOnly(libs.eisopUtil)
95+
testCompileOnly(libs.eisopCheckerQual)
96+
checkerFramework(libs.eisopCheckerQual)
97+
checkerFramework(libs.eisopChecker)
11198

112-
113-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.4'
99+
testImplementation(libs.bundles.testing)
100+
testImplementation project(':key.util')
101+
testRuntimeOnly(libs.junitEngine)
114102
}
115103

116-
tasks.withType(JavaCompile) {
104+
tasks.withType(JavaCompile).configureEach {
117105
// Setting UTF-8 as the java source encoding.
118106
options.encoding = "UTF-8"
119107
// Setting the release to Java 21
120108
options.release = 21
121109
}
122110

123-
tasks.withType(Javadoc) {
111+
tasks.withType(Javadoc).configureEach {
124112
failOnError = false
125113
options.addBooleanOption 'Xdoclint:none', true
126114
//options.verbose()
127115
options.encoding = 'UTF-8'
128116
options.addBooleanOption('html5', true)
129117
}
130118

131-
tasks.withType(Test) {//Configure all tests
119+
tasks.withType(Test).configureEach {//Configure all tests
132120
systemProperty "test-resources", "src/test/resources"
133121
systemProperty "testcases", "src/test/resources/testcase"
134122
systemProperty "TACLET_PROOFS", "tacletProofs"
@@ -142,7 +130,7 @@ subprojects {
142130
maxParallelForks = 1 // weigl: test on master
143131
}
144132

145-
tasks.withType(Test) {
133+
tasks.withType(Test).configureEach {
146134
useJUnitPlatform {
147135
includeEngines 'junit-jupiter'
148136
}
@@ -169,7 +157,7 @@ subprojects {
169157
}
170158
}
171159

172-
task testFast(type: Test) {
160+
tasks.register('testFast', Test) {
173161
group "verification"
174162
useJUnitPlatform {
175163
excludeTags "slow", "performance", "interactive"
@@ -195,14 +183,14 @@ subprojects {
195183
// The following two tasks can be used to execute main methods from the project
196184
// The main class is set via "gradle -DmainClass=... execute --args ..."
197185
// see https://stackoverflow.com/questions/21358466/gradle-to-execute-java-class-without-modifying-build-gradle
198-
task execute(type: JavaExec) {
186+
tasks.register('execute', JavaExec) {
199187
description 'Execute main method from the project. Set main class via "gradle -DmainClass=... execute --args ..."'
200188
group "application"
201189
mainClass.set(System.getProperty('mainClass'))
202190
classpath = sourceSets.main.runtimeClasspath
203191
}
204192

205-
task executeInTests(type: JavaExec) {
193+
tasks.register('executeInTests', JavaExec) {
206194
description 'Execute main method from the project (tests loaded). Set main class via "gradle -DmainClass=... execute --args ..."'
207195
group "application"
208196
mainClass.set(System.getProperty('mainClass'))
@@ -219,7 +207,7 @@ subprojects {
219207
ruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"]
220208
}
221209

222-
task pmdMainChanged(type: Pmd) {
210+
tasks.register('pmdMainChanged', Pmd) {
223211
// Specify all files that should be checked
224212
def changedFiles = getChangedFiles()
225213
source pmdMain.source.filter { f -> f.getAbsoluteFile().toString() in changedFiles }
@@ -245,7 +233,7 @@ subprojects {
245233
}
246234

247235

248-
task checkstyleMainChanged(type: Checkstyle) {
236+
tasks.register('checkstyleMainChanged', Checkstyle) {
249237
// Specify all files that should be checked
250238
def changedFiles = getChangedFiles()
251239
source checkstyleMain.source.filter { f -> f.getAbsoluteFile().toString() in changedFiles }
@@ -273,20 +261,20 @@ subprojects {
273261
// html.enabled = true
274262
// }
275263
// }
276-
tasks.withType(Pmd) {
264+
tasks.withType(Pmd).configureEach {
277265
reports {
278266
xml.getRequired().set(true)
279267
html.getRequired().set(true)
280268
}
281269
}
282270

283-
task sourcesJar(type: Jar) {
271+
tasks.register('sourcesJar', Jar) {
284272
description = 'Create a jar file with the sources from this project'
285273
from sourceSets.main.allJava
286274
archiveClassifier = 'sources'
287275
}
288276

289-
task javadocJar(type: Jar) {
277+
tasks.register('javadocJar', Jar) {
290278
description = 'Create a jar file with the javadocs from this project'
291279
from javadoc
292280
archiveClassifier = 'javadoc'
@@ -491,15 +479,15 @@ subprojects {
491479
}
492480
}
493481

494-
task start {
482+
tasks.register('start'){
495483
description "Use :key.ui:run instead"
496484
doFirst {
497485
println "Use :key.ui:run instead"
498486
}
499487
}
500488

501489
// Generation of a JavaDoc across sub projects.
502-
task alldoc(type: Javadoc) {
490+
tasks.register('alldoc', Javadoc){
503491
group "documentation"
504492
description "Generate a JavaDoc across sub projects"
505493
def projects = subprojects
@@ -531,7 +519,7 @@ task alldoc(type: Javadoc) {
531519
}
532520

533521
// Creates a jar file with the javadoc over all sub projects.
534-
task alldocJar(type: Zip) {
522+
tasks.register('alldocJar', Zip){
535523
dependsOn alldoc
536524
description 'Create a jar file with the javadoc over all sub projects'
537525
from alldoc

key.core/build.gradle

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,11 @@ dependencies {
1212
api project(':key.ncore')
1313
//api group: group, name: 'recoderkey', version: '1.0'
1414
api project(':recoder')
15-
implementation group: 'net.java.dev.javacc', name: 'javacc', version: '4.0'
16-
implementation group: 'org.antlr', name: 'antlr-runtime', version: '3.5.3'
17-
implementation group: 'antlr', name: 'antlr', version: '2.7.7'
1815

19-
javacc group: 'net.java.dev.javacc', name: 'javacc', version: '4.0'
20-
antlr group: 'org.antlr', name: 'antlr', version: '3.5.3' // use ANTLR version 3
21-
22-
antlr4 "org.antlr:antlr4:4.13.2"
23-
api "org.antlr:antlr4-runtime:4.13.2"
24-
//implementation group: 'com.google.guava', name: 'guava', version: '28.1-jre'
16+
implementation(libs.javacc)
17+
javacc(libs.javacc)
18+
antlr4(libs.antlr)
19+
api(libs.antlrRuntime)
2520
}
2621

2722
// The target directory for JavaCC (parser generation)

key.core/src/main/java/de/uka/ilkd/key/proof/io/AbstractProblemLoader.java

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import java.nio.file.*;
1010
import java.util.*;
1111
import java.util.function.Consumer;
12-
import java.util.stream.Collectors;
1312
import java.util.stream.Stream;
1413
import java.util.zip.ZipFile;
1514

@@ -33,12 +32,10 @@
3332
import de.uka.ilkd.key.speclang.SLEnvInput;
3433
import de.uka.ilkd.key.strategy.Strategy;
3534
import de.uka.ilkd.key.strategy.StrategyProperties;
36-
import de.uka.ilkd.key.util.ExceptionHandlerException;
3735

3836
import org.key_project.util.collection.Pair;
3937
import org.key_project.util.java.IOUtil;
4038

41-
import org.antlr.runtime.MismatchedTokenException;
4239
import org.jspecify.annotations.Nullable;
4340
import org.slf4j.Logger;
4441
import org.slf4j.LoggerFactory;
@@ -348,51 +345,6 @@ protected void loadSelectedProof(LoadedPOContainer poContainer, ProofAggregate p
348345
}
349346
}
350347

351-
/**
352-
* Find first 'non-wrapper' exception type in cause chain.
353-
*/
354-
private Throwable unwrap(Throwable e) {
355-
while (e instanceof ExceptionHandlerException || e instanceof ProblemLoaderException) {
356-
e = e.getCause();
357-
}
358-
return e;
359-
}
360-
361-
/**
362-
* Tries to recover parser errors and make them human-readable, rewrap them into
363-
* ProblemLoaderExceptions.
364-
*/
365-
protected ProblemLoaderException recoverParserErrorMessage(Exception e) {
366-
// try to resolve error message
367-
final Throwable c0 = unwrap(e);
368-
if (c0 instanceof org.antlr.runtime.RecognitionException re) {
369-
final org.antlr.runtime.Token occurrence = re.token; // may be null
370-
if (c0 instanceof org.antlr.runtime.MismatchedTokenException) {
371-
if (c0 instanceof org.antlr.runtime.MissingTokenException mte) {
372-
// TODO: other commonly missed tokens
373-
final String readable = missedErrors.get(mte.expecting);
374-
final String token = readable == null ? "token id " + mte.expecting : readable;
375-
final String msg = "Syntax error: missing " + token
376-
+ (occurrence == null ? "" : " at " + occurrence.getText()) + " statement ("
377-
+ mte.input.getSourceName() + ":" + mte.line + ")";
378-
return new ProblemLoaderException(this, msg, mte);
379-
// TODO other ANTLR exceptions
380-
} else {
381-
final org.antlr.runtime.MismatchedTokenException mte =
382-
(MismatchedTokenException) c0;
383-
final String genericMsg = "expected " + mte.expecting + ", but found " + mte.c;
384-
final String readable =
385-
mismatchErrors.get(new Pair<>(mte.expecting, mte.c));
386-
final String msg = "Syntax error: " + (readable == null ? genericMsg : readable)
387-
+ " (" + mte.input.getSourceName() + ":" + mte.line + ")";
388-
return new ProblemLoaderException(this, msg, mte);
389-
}
390-
}
391-
}
392-
// default
393-
return new ProblemLoaderException(this, "Loading proof input failed", e);
394-
}
395-
396348
/**
397349
* Creates a new FileRepo (with or without consistency) based on the settings.
398350
*
@@ -428,7 +380,7 @@ protected EnvInput createEnvInput(FileRepo fileRepo) throws IOException {
428380

429381
if (filename.endsWith(".java")) {
430382
// java file, probably enriched by specifications
431-
SLEnvInput ret = null;
383+
SLEnvInput ret;
432384
if (file.getParentFile() == null) {
433385
ret = new SLEnvInput(".", classPath, bootClassPath, profileOfNewProofs, includes);
434386
} else {
@@ -453,11 +405,11 @@ protected EnvInput createEnvInput(FileRepo fileRepo) throws IOException {
453405
try (ZipFile bundle = new ZipFile(file)) {
454406
proofs = bundle.stream().filter(e -> !e.isDirectory())
455407
.filter(e -> e.getName().endsWith(".proof"))
456-
.map(e -> Paths.get(e.getName())).collect(Collectors.toList());
408+
.map(e -> Paths.get(e.getName())).toList();
457409
}
458410
if (!proofs.isEmpty()) {
459411
// load first proof found in file
460-
proofFilename = proofs.get(0).toFile();
412+
proofFilename = proofs.getFirst().toFile();
461413
} else {
462414
// no proof found in bundle!
463415
throw new IOException("The bundle contains no proof to load!");

key.core/src/main/java/de/uka/ilkd/key/speclang/njml/JmlTermFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.key_project.util.collection.ImmutableSLList;
3737
import org.key_project.util.collection.Pair;
3838

39-
import org.antlr.runtime.Token;
39+
import org.antlr.v4.runtime.Token;
4040
import org.jspecify.annotations.NonNull;
4141
import org.jspecify.annotations.Nullable;
4242
import org.slf4j.Logger;

key.ncore/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
plugins {
22
}
33

4-
description "Generic data strutures for terms and formulas without dependencies to a specific target programming language"
4+
description "Generic data structures for terms and formulas without " +
5+
"dependencies to a specific target programming language"
56

67
configurations { }
78

89
dependencies {
910
api project(':key.util')
10-
implementation 'org.jspecify:jspecify:1.0.0'
11+
implementation(libs.jspecify)
1112
}
1213

13-
tasks.withType(Test) {
14+
tasks.withType(Test).configureEach {
1415
enableAssertions = true
1516
}
1617

key.ui/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ dependencies {
2020
implementation project(":key.core.symbolic_execution")
2121
implementation project(":key.removegenerics")
2222

23-
api 'com.miglayout:miglayout-swing:11.4.2'
23+
api(libs.miglayout)
2424

2525
//logging implementation used by the slf4j
26-
implementation 'ch.qos.logback:logback-classic:1.5.15'
26+
implementation(libs.logback)
2727

28-
api 'org.key-project:docking-frames-common:1.1.3p1'
29-
api 'org.key-project:docking-frames-core:1.1.3p1'
28+
api(libs.dockingFramesCommon)
29+
api(libs.dockingFramesCore)
3030

3131
runtimeOnly project(":keyext.ui.testgen")
3232
runtimeOnly project(":keyext.caching")
@@ -35,7 +35,7 @@ dependencies {
3535
runtimeOnly project(":keyext.proofmanagement")
3636
}
3737

38-
task createExamplesZip(type: Zip) {
38+
tasks.register('createExamplesZip', Zip) {
3939
description 'Create "examples.zip" containing all KeY examples'
4040
destinationDirectory = file("$buildDir/resources/main/")
4141
archiveFileName = "examples.zip"
@@ -71,7 +71,7 @@ run {
7171
jvmArgs += "-Dsun.awt.disablegrab=true"
7272
}
7373

74-
task runWithProfiler(type: JavaExec) {
74+
tasks.register('runWithProfiler', JavaExec) {
7575
group("application")
7676
description("""Run key.ui with flight recoder enabled.
7777
See https://www.baeldung.com/java-flight-recorder-monitoring for a how to.""")

key.util/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
description "Utility library of the key-project"
22

33
dependencies {
4-
implementation("org.jspecify:jspecify:1.0.0")
4+
implementation(libs.jspecify)
55
}
66

77
checkerFramework {

keyext.proofmanagement/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies {
99
implementation project(':key.core')
1010
implementation project(':key.ui')
1111

12-
implementation group: 'org.antlr', name: 'ST4', version: '4.3.4'
12+
implementation(libs.stringtemplate)
1313
}
1414

1515
application {

settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// https://docs.gradle.org/current/userguide/version_catalogs.html#sec:importing-catalog-from-file
2+
13
include "key.util"
24
include "key.ui"
35
include "key.ncore"

0 commit comments

Comments
 (0)