Codebase list jd-gui / b925383 services / build.gradle
b925383

Tree @b925383 (Download .tar.gz)

build.gradle @b925383raw · history · blame

apply plugin: 'java'

dependencies {
    compile 'com.fifesoft:rsyntaxtextarea:3.0.4'
    compile 'org.ow2.asm:asm:7.1'
    compile 'org.jd:jd-core:' + parent.jdCoreVersion
    compile project(':api')
    testCompile 'junit:junit:4.12'
}

version = parent.version

// ANTLR //
ext.antlr4 = [
        antlrSource: 'src/main/antlr',
        destinationDir: 'src-generated/antlr/java',
        grammarPackage: 'org.jd.gui.util.parser.antlr'
]

configurations {
    antlr4 {
        description = "ANTLR4"
    }
}

dependencies {
    compile 'org.antlr:antlr4-runtime:4.5'
    antlr4 'org.antlr:antlr4:4.5'
}

task antlr4OutputDir() {
    mkdir antlr4.destinationDir
}

task antlr4GenerateGrammarSource(dependsOn: antlr4OutputDir, type: JavaExec) {
    description = 'Generates Java sources from ANTLR4 grammars.'

    inputs.dir file(antlr4.antlrSource)
    outputs.dir file(antlr4.destinationDir)

    def grammars = fileTree(antlr4.antlrSource).include('**/*.g4')
    def pkg = antlr4.grammarPackage.replaceAll("\\.", "/")

    main = 'org.antlr.v4.Tool'
    classpath = configurations.antlr4
    args = ['-o', "${antlr4.destinationDir}/${pkg}", '-package', antlr4.grammarPackage, grammars.files].flatten()
}

compileJava {
    dependsOn antlr4GenerateGrammarSource
    source antlr4.destinationDir
}

clean {
    delete 'src-generated'
}

idea.module {
    sourceDirs += file(antlr4.destinationDir)
}
ideaModule.dependsOn antlr4GenerateGrammarSource

eclipse.classpath.file.withXml { xml ->
    def node = xml.asNode()
    node.appendNode( 'classpathentry', [ kind: 'src', path: antlr4.destinationDir])
}
eclipseClasspath.dependsOn antlr4GenerateGrammarSource