-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
51 lines (41 loc) · 1.22 KB
/
build.gradle
File metadata and controls
51 lines (41 loc) · 1.22 KB
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
apply plugin: 'java'
apply plugin: 'antlr'
apply plugin: 'idea'
// Setting project to use JDK 12
sourceCompatibility = 1.12
targetCompatibility = 1.12
//Server where we get the plugins
repositories {
mavenCentral()
}
// Project dependencies, set antlr 4.7.1, and junit is for java 12.
dependencies {
antlr "org.antlr:antlr4:4.7.1"
compile "org.antlr:antlr4-runtime:4.7.1"
testCompile 'junit:junit:4.12'
}
//Task to generate source code with visitors from antlr grammars, and package them in the mylanguage package.
generateGrammarSource {
maxHeapSize = "64m"
arguments += ['-visitor','-package', 'mylanguage']
outputDirectory = new File("generated-src/antlr/main/mylanguage".toString())
}
compileJava.dependsOn generateGrammarSource
sourceSets {
generated {
java.srcDir 'generated-src/antlr/main/'
}
main.java.srcDirs += 'generated-src/antlr/main/'
}
compileGeneratedJava.source sourceSets.generated.java
compileJava.source sourceSets.generated.java, sourceSets.main.java
//Task to remove the generated files.
clean{
delete "generated-src"
}
//Task to create the IDEA project files, with the generated files.
idea {
module {
sourceDirs += file("generated-src/antlr/main")
}
}