2020-05-28 05:55:48 +02:00
|
|
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
|
|
|
|
|
|
|
sourceSets.main.java.srcDirs = [ "src/", "build/generated-src" ]
|
|
|
|
sourceSets.main.antlr.srcDirs = [ "antlr-src/" ]
|
|
|
|
|
|
|
|
project.ext.mainClassName = "com.etheller.warsmash.jassparser.Main"
|
|
|
|
|
|
|
|
task run(dependsOn: classes, type: JavaExec) {
|
|
|
|
main = project.mainClassName
|
|
|
|
classpath = sourceSets.main.runtimeClasspath
|
|
|
|
standardInput = System.in
|
|
|
|
ignoreExitValue = true
|
2022-01-30 17:02:48 +01:00
|
|
|
|
|
|
|
if (org.gradle.internal.os.OperatingSystem.current() == org.gradle.internal.os.OperatingSystem.MAC_OS) {
|
|
|
|
// Required to run on macOS
|
|
|
|
jvmArgs += "-XstartOnFirstThread"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task debug(dependsOn: classes, type: JavaExec) {
|
|
|
|
main = project.mainClassName
|
|
|
|
classpath = sourceSets.main.runtimeClasspath
|
|
|
|
standardInput = System.in
|
|
|
|
ignoreExitValue = true
|
|
|
|
debug = true
|
2020-05-28 05:55:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
task dist(type: Jar) {
|
2022-01-30 17:02:48 +01:00
|
|
|
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
2020-05-28 05:55:48 +02:00
|
|
|
manifest {
|
|
|
|
attributes 'Main-Class': project.mainClassName
|
|
|
|
}
|
2022-01-30 17:02:48 +01:00
|
|
|
dependsOn configurations.runtimeClasspath
|
|
|
|
|
|
|
|
from files(sourceSets.main.output.classesDirs)
|
|
|
|
from files(sourceSets.main.output.resourcesDir)
|
|
|
|
from {configurations.runtimeClasspath.collect {zipTree(it)}}
|
|
|
|
|
|
|
|
with jar
|
2020-05-28 05:55:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
dist.dependsOn classes
|
|
|
|
|
|
|
|
eclipse.project {
|
|
|
|
name = appName + "-jassparser"
|
|
|
|
}
|
|
|
|
|
|
|
|
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
|
|
|
|
doLast {
|
|
|
|
def classpath = new XmlParser().parse(file(".classpath"))
|
|
|
|
def writer = new FileWriter(file(".classpath"))
|
|
|
|
def printer = new XmlNodePrinter(new PrintWriter(writer))
|
|
|
|
printer.setPreserveWhitespace(true)
|
|
|
|
printer.print(classpath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
generateGrammarSource {
|
|
|
|
maxHeapSize = "64m"
|
|
|
|
arguments += ["-visitor", "-no-listener"]
|
|
|
|
outputDirectory = file("build/generated-src/com/etheller/warsmash/jassparser")
|
|
|
|
}
|