This repository was archived by the owner on Oct 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
79 lines (64 loc) · 1.81 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
plugins {
id 'com.github.johnrengelman.shadow' version '4.0.3'
}
group 'blockproject.bpsl'
version 'PREVIEW_1'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
apply plugin: 'antlr'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
/**
* Without the next section Gradle will add a 'compile' dependency on Antlr3:
* https://github.com/gradle/gradle/issues/820
*/
configurations {
compile {
extendsFrom = extendsFrom.findAll { it != configurations.antlr }
}
}
dependencies {
antlr "org.antlr:antlr4:4.7.1"
compile "org.antlr:antlr4-runtime:4.7.1"
}
generateGrammarSource {
maxHeapSize = "64m"
// Keep a copy of generated sources
doLast {
println "Copying generated grammar lexer/parser files to main directory."
copy {
from "${buildDir}/generated-src/antlr/main"
into "generated-src/main/java"
}
file("${buildDir}/generated-src/antlr/main").deleteDir()
}
arguments += ["-visitor", "-long-messages"]
}
sourceSets.main.java.srcDirs += "generated-src/main/java"
clean.doLast {
file('generated-src').deleteDir()
file('bin').deleteDir()
}
jar.enabled = false
shadowJar {
manifest {
attributes 'Main-Class': 'blockproject.bpsl.Main'
}
configurations = [project.configurations.compile, project.configurations.runtime]
baseName = 'bpslcl'
version = version
archiveName = "${baseName}-${version}.${extension}"
}
assemble.dependsOn shadowJar
task grun {
doLast {
javaexec {
classpath = project.getConfigurations().getByName(AntlrPlugin.ANTLR_CONFIGURATION_NAME) + sourceSets.main.runtimeClasspath
main = 'org.antlr.v4.gui.TestRig'
args = ['blockproject.bpsl.BPSL', 'bpsl', '-gui', file]
}
}
}