-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
49 lines (42 loc) · 1.42 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
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'antlr'
dependencies {
compile 'org.ow2.asm:asm:5.0.4'
compile 'org.apache.commons:commons-lang3:3.4'
testCompile 'junit:junit:4.12'
antlr "org.antlr:antlr4:4.5" // use ANTLR version 4
}
generateGrammarSource {
arguments += ["-visitor", "-long-messages"]
}
// By default, Antlr generates the source files in a directory that does not
// match the package. This task will move the generated source files to a
// directory matching the package.
generateGrammarSource.doLast {
File generatedDir = file('build/generated-src/antlr/main')
File packageDir = new File(generatedDir, 'jacob/simpson/tinyscript/grammar')
packageDir.mkdirs()
generatedDir.listFiles().each {File file ->
file.renameTo(new File(packageDir, file.getName()))
}
}
task(run, dependsOn: 'classes', type: JavaExec) {
main = 'jacob.simpson.tinyscript.Main'
classpath = sourceSets.main.runtimeClasspath
args 'scripts/some-variables.ts'
}
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Tiny Script',
'Implementation-Version': '1.0',
'Main-Class': 'jacob.simpson.tinyscript.Main'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
defaultTasks 'run'