Skip to content

Commit 6028a2e

Browse files
committed
wip picocli
1 parent c093df6 commit 6028a2e

File tree

75 files changed

+2403
-2431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2403
-2431
lines changed

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/Constants.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,27 @@
55

66
import org.key_project.util.java.StringUtil;
77

8-
public interface Constants {
9-
8+
public class Constants {
109
/**
1110
* Constant for the line break which is used by the operating system.
1211
* <p>
1312
* <b>Do not use {@code \n}!</b>
1413
*/
15-
String NEW_LINE = StringUtil.NEW_LINE;
16-
String NULLABLE = "/*@ nullable */";
17-
String ALL_OBJECTS = "allObjects";
18-
String ALL_INTS = "allInts";
19-
String ALL_BOOLS = "allBools";
20-
String ALL_HEAPS = "allHeaps";
21-
String ALL_FIELDS = "allFields";
22-
String ALL_SEQ = "allSeq";
23-
String ALL_LOCSETS = "allLocSets";
24-
25-
String OBJENESIS_NAME = "objenesis-2.2.jar";
26-
27-
String OLDMap = "old";
14+
public static final String NEW_LINE = StringUtil.NEW_LINE;
15+
public static final String NULLABLE = "/*@ nullable */";
2816

29-
String TAB = " ";
17+
public static final String ALL_OBJECTS = "allObjects";
18+
public static final String ALL_INTS = "allInts";
19+
public static final String ALL_BOOLS = "allBools";
20+
public static final String ALL_HEAPS = "allHeaps";
21+
public static final String ALL_FIELDS = "allFields";
22+
public static final String ALL_SEQ = "allSeq";
23+
public static final String ALL_LOCSETS = "allLocSets";
24+
public static final String OBJENESIS_NAME = "objenesis-2.2.jar";
25+
public static final String OLD_MAP = "old";
26+
public static final String TAB = " ";
27+
public static final String DUMMY_POSTFIX = "DummyImpl";
3028

31-
String DUMMY_POSTFIX = "DummyImpl";
29+
private Constants() {
30+
}
3231
}

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/Format.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/ModelGenerator.java

Lines changed: 0 additions & 191 deletions
This file was deleted.
Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,97 @@
1+
/* This file is part of KeY - https://key-project.org
2+
* KeY is licensed under the GNU General Public License Version 2
3+
* SPDX-License-Identifier: GPL-2.0-only */
14
package de.uka.ilkd.key.testgen;
25

36
import java.io.IOException;
47
import java.nio.file.Files;
58
import java.nio.file.Path;
6-
import java.nio.file.StandardCopyOption;
79
import java.util.Objects;
810

911
/**
12+
* This class manages the different paths in the output folder.
13+
*
1014
* @author Alexander Weigl
1115
* @version 1 (02.02.24)
1216
*/
13-
public record OutputEnvironment(Path targetFolder) {
17+
public record OutputEnvironment(Path targetFolder, boolean onlyTestDir) {
18+
/**
19+
* Returns the source code folder
20+
*/
1421
public Path getSourceDir() {
15-
return targetFolder.resolve("src");
22+
return targetFolder.resolve("src/main/java");
1623
}
1724

25+
/**
26+
* Returns the test code folder
27+
*/
1828
public Path getTestSourceDir() {
19-
return targetFolder.resolve("test");
29+
if (onlyTestDir) {
30+
return targetFolder;
31+
}
32+
return targetFolder.resolve("src/test/java");
2033
}
2134

35+
/**
36+
* Returns the path to the ANT build.xml file
37+
*/
2238
public Path getAntFile() {
2339
return targetFolder.resolve("build.xml");
2440
}
2541

42+
/**
43+
* Returns the path to the ANT build.xml file
44+
*/
45+
public Path getGradleFile() {
46+
return targetFolder.resolve("build.gradle.kts");
47+
}
48+
49+
/**
50+
* Returns the path to the pom.xml for Maven file
51+
*/
52+
public Path getMavenFile() {
53+
return targetFolder.resolve("pom.xml");
54+
}
55+
56+
57+
/**
58+
* Returns the path to the README.md file
59+
*/
2660
public Path getReadmeFile() {
2761
return targetFolder.resolve("README.md");
2862
}
2963

64+
/**
65+
* Initialize/create the necessary directories.
66+
*
67+
* @throws IOException if the output folder is not write or the folders can not be created.
68+
*/
3069
public void init() throws IOException {
31-
Files.createDirectories(getSourceDir());
3270
Files.createDirectories(getTestSourceDir());
33-
34-
installAntFile();
71+
if (!onlyTestDir) {
72+
Files.createDirectories(getSourceDir());
73+
installProjectFile();
74+
}
3575
}
3676

37-
private void installAntFile() throws IOException {
38-
try (var buildXml = getClass().getResourceAsStream("/de/uka/ilkd/key/tcg/build.xml")) {
39-
Files.copy(Objects.requireNonNull(buildXml), getAntFile(), StandardCopyOption.REPLACE_EXISTING);
77+
private void installProjectFile() throws IOException {
78+
if (!Files.exists(getAntFile())) {
79+
try (var buildXml = getClass().getResourceAsStream("/de/uka/ilkd/key/tcg/build.xml")) {
80+
Files.copy(Objects.requireNonNull(buildXml), getAntFile());
81+
}
82+
}
83+
84+
if (!Files.exists(getMavenFile())) {
85+
try (var pomXml = getClass().getResourceAsStream("/de/uka/ilkd/key/tcg/pom.xml")) {
86+
Files.copy(Objects.requireNonNull(pomXml), getMavenFile());
87+
}
88+
}
89+
90+
if (!Files.exists(getGradleFile())) {
91+
try (var gradleKts =
92+
getClass().getResourceAsStream("/de/uka/ilkd/key/tcg/build.gradle.kts")) {
93+
Files.copy(Objects.requireNonNull(gradleKts), getGradleFile());
94+
}
4095
}
4196
}
4297
}

0 commit comments

Comments
 (0)