-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
68 lines (53 loc) · 1.6 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
apply plugin: 'java'
apply plugin: 'application'
apply from: file('gradle/idea.gradle')
apply from: 'gradle/javafx.plugin'
sourceCompatibility = 1.8
version = '0.1'
repositories {
mavenCentral()
}
ext.antlr = [
grammarpackage: "xanthic.parsers",
antlrSource: 'src/main/java/xanthic/grammars',
destinationDir: "src/generated-sources/java"
]
task wrapper(type: Wrapper) {
gradleVersion = '1.12'
}
configurations {
antlr4 {
description = "ANTLR4"
}
}
dependencies {
compile group: "org.antlr", name: "antlr4", version: "4.3"
compile group: 'org.fxmisc.richtext', name: 'richtextfx', version: '0.4.4'
antlr4 group: "org.antlr", name: "antlr4", version: "4.3"
testCompile group: 'junit', name: 'junit', version: '4.11'
}
task antlrOutputDir << {
mkdir(antlr.destinationDir)
}
task generateGrammarSource(dependsOn: antlrOutputDir, type: JavaExec) {
description = 'Generates Java sources from ANTLR4 grammars.'
inputs.dir file(antlr.antlrSource)
outputs.dir file(antlr.destinationDir)
def grammars = fileTree(antlr.antlrSource).include('**/*.g4')
main = 'org.antlr.v4.Tool'
classpath = configurations.antlr4
def pkg = antlr.grammarpackage.replaceAll("\\.", "/")
args = ["-o", "${antlr.destinationDir}/${pkg}"/*, "-atn"*/, "-listener", "-package", antlr.grammarpackage, grammars.files].flatten()
}
compileJava {
dependsOn generateGrammarSource
source antlr.destinationDir
}
clean {
delete antlr.destinationDir
}
javafx{
appID 'SyntaxArea'
appName 'SyntaxArea'
mainClass 'xanthic.examples.SyntaxAreaExample'
}