-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
48 lines (38 loc) · 1008 Bytes
/
build.gradle
File metadata and controls
48 lines (38 loc) · 1008 Bytes
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
apply plugin: 'java'
repositories {
mavenCentral()
}
configurations {
antlr4
}
dependencies {
compile 'org.antlr:antlr4-runtime:4.5'
antlr4 'org.antlr:antlr4:4.5'
}
ext.antlr4GeneratedSourceDir = new File(buildDir, 'generated-sources/antlr4')
sourceSets {
main {
java {
srcDir antlr4GeneratedSourceDir
}
}
}
task generateGrammarSource {
ext.grammarFile = new File(projectDir, 'src/main/antlr4/Java.g4')
ext.outputPackage = 'com.lemoulinstudio.sdiff.java.tree.parser'
ext.outputDir = new File(antlr4GeneratedSourceDir, outputPackage.replace('.' as char, File.separatorChar))
inputs.file grammarFile
inputs.property 'outputPackage', outputPackage
outputs.dir outputDir
doLast {
javaexec {
classpath configurations.antlr4
main 'org.antlr.v4.Tool'
args '-o', outputDir,
'-package', outputPackage,
grammarFile
}
}
}
compileJava.dependsOn(generateGrammarSource)
ext.mainClass = 'com.lemoulinstudio.sdiff.Main'