-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
97 lines (80 loc) · 2.21 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 'antlr'
id 'eclipse'
}
repositories {
mavenCentral()
//jcenter() deprecated
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
dependencies{
antlr "org.antlr:antlr4:4.9.3"
implementation "org.antlr:antlr4-runtime:4.9.3"
testImplementation(platform('org.junit:junit-bom:5.8.2'))
testImplementation('org.junit.jupiter:junit-jupiter:5.8.2')
testImplementation fileTree('build/generated-src/antlr/main')
//implementation files('lib/gpal.jar')
}
task copyDependencies(type: Copy) {
from configurations.runtimeClasspath
include 'antlr4*.jar'
into "gradle-libs"
}
generateGrammarSource {
maxHeapSize = "128m"
arguments += ['-package', 'e4sm.de.antlr4.petri.grammar', /*'-visitor', '-no-listener',*/ '-long-messages']
outputDirectory = new File(buildDir.toString() + "/gen-src/antlr/main/e4sm/de/antlr4/petri/grammar/")
doLast {
println "Copying generated grammar lexer/parser files to main directory."
copy {
from "${buildDir}/gen-src/antlr/main"
into "src-gen"
}
}
}
compileJava.dependsOn generateGrammarSource, copyDependencies
sourceSets{
main{
java.srcDir 'src/e4sm/de/antlr4/petri/model/'
}
generated {
java.srcDir 'src-gen'
}
test{
java.srcDir 'src/test'
}
}
compileJava.source sourceSets.generated.java, sourceSets.main.java
clean {
delete "gen-src"
delete "src-gen"
delete fileTree("gradle-libs/").matching {
include "*.jar"
}
delete fileTree("src/main/antlr").matching {
include "*.java", "*.interp", "*.tokens"
}
}
/*eclipse{
module{
sourceDirs += file("generated-src/antlr/main/")
}
}*/
test {
//From folder: EDITOR/plugins/e4sm.de.antlr4.petri.grammar/build/classes/java/main - run:
//grun e4sm.de.antlr4.petri.grammar.SCPN expressions -gui ..\..\..\..\examples\input.txt
useJUnitPlatform()
//include "e4sm.de.antlr4.petri.tests/*";
testLogging {
// Make sure output from
// standard out or error is shown
// in Gradle output.
showStandardStreams = true
events "passed", "skipped", "failed"
}
}