mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 12:06:41 +00:00
Add initial ANTLR setup + lex/parser
This commit is contained in:
@ -1,7 +1,10 @@
|
||||
import org.gradle.plugins.ide.idea.model.IdeaModel
|
||||
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("net.ltgt.apt-eclipse")
|
||||
id("net.ltgt.apt-idea")
|
||||
id("antlr")
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
@ -23,6 +26,10 @@ dependencies {
|
||||
"compile"("org.slf4j:slf4j-api:1.7.26")
|
||||
"compile"("it.unimi.dsi:fastutil:8.2.1")
|
||||
|
||||
val antlrVersion = "4.7.2"
|
||||
"antlr"("org.antlr:antlr4:$antlrVersion")
|
||||
"implementation"("org.antlr:antlr4-runtime:$antlrVersion")
|
||||
|
||||
"compileOnly"(project(":worldedit-libs:core:ap"))
|
||||
"annotationProcessor"(project(":worldedit-libs:core:ap"))
|
||||
// ensure this is on the classpath for the AP
|
||||
@ -36,6 +43,26 @@ tasks.withType<JavaCompile>().configureEach {
|
||||
options.compilerArgs.add("-Aarg.name.key.prefix=")
|
||||
}
|
||||
|
||||
tasks.named<AntlrTask>("generateGrammarSource").configure {
|
||||
val pkg = "com.sk89q.worldedit.antlr"
|
||||
outputDirectory = file("build/generated-src/antlr/main/${pkg.replace('.', '/')}")
|
||||
arguments = listOf(
|
||||
"-visitor", "-package", pkg,
|
||||
"-Xexact-output-dir"
|
||||
)
|
||||
}
|
||||
|
||||
// Give intellij info about where ANTLR code comes from
|
||||
plugins.withId("idea") {
|
||||
configure<IdeaModel> {
|
||||
afterEvaluate {
|
||||
module.sourceDirs.add(file("src/main/antlr"))
|
||||
module.sourceDirs.add(file("build/generated-src/antlr/main"))
|
||||
module.generatedSourceDirs.add(file("build/generated-src/antlr/main"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
|
Reference in New Issue
Block a user