diff --git a/build.gradle b/build.gradle index c93133a..878fa02 100644 --- a/build.gradle +++ b/build.gradle @@ -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" } } @@ -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() @@ -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" } @@ -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 +} \ No newline at end of file diff --git a/src/main/antlr4/CTL.g4 b/src/main/antlr/CTL.g4 similarity index 100% rename from src/main/antlr4/CTL.g4 rename to src/main/antlr/CTL.g4