Skip to content

Commit

Permalink
Move to official Antlr Gradle plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
daemontus committed Oct 10, 2015
1 parent b3daf65 commit fff41a8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'me.champeau.gradle.antlr4'
apply plugin: 'antlr'

//include antlr and kotlin plugin
buildscript {
ext.kotlin_version = '0.14.451'

repositories {
maven {
name 'JFrog OSS snapshot repo'
url 'https://oss.jfrog.org/oss-snapshot-local/'
}
jcenter()
mavenCentral()
}

dependencies {
classpath 'me.champeau.gradle:antlr4-gradle-plugin:0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,23 +21,22 @@ archivesBaseName = "ctlParser"
version = '1.0.0'

//antlr config
antlr4 {
extraArgs=['-package', 'cz.muni.fi.ctl.antlr']
output=new File('src/main/gen/cz/muni/fi/ctl/antlr')
visitor=false
listener=true
generateGrammarSource {
maxHeapSize = "64m"
arguments += [
"-no-visitor",
"-listener",
"-package", "cz.muni.fi.ctl.antlr"
]
outputDirectory = new File('src/main/gen/cz/muni/fi/ctl/antlr')
}

// make the Java compile task depend on the antlr4 task
compileJava.dependsOn antlr4
compileKotlin.dependsOn generateGrammarSource

// add the generated source files to the list of java sources
sourceSets.main.java.srcDirs += new File('src/main/gen')

// add antlr4 to classpath
configurations {
compile.extendsFrom antlr4
}

repositories {
mavenCentral()
Expand All @@ -51,6 +45,7 @@ repositories {
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'com.intellij:annotations:5.1'
antlr "org.antlr:antlr4:4.5.1-1"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

Expand All @@ -64,7 +59,22 @@ task fullJar(type: Jar) {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives javadocJar, sourcesJar
}
File renamed without changes.

0 comments on commit fff41a8

Please sign in to comment.