Support inline true/false options

This commit is contained in:
Mikhael Bogdanov
2014-03-20 15:32:20 +04:00
parent 0b1470b5e5
commit ca4609dd2a
34 changed files with 357 additions and 46 deletions
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.gradle.plugin.*
import org.jetbrains.kotlin.doc.KDocConfig
import java.util.concurrent.Callable
import org.gradle.api.Project
import org.jetbrains.jet.cli.common.arguments.CompilerArgumentsUtil
public open class KotlinCompile(): AbstractCompile() {
@@ -114,7 +115,11 @@ public open class KotlinCompile(): AbstractCompile() {
args.noStdlib = true
args.noJdkAnnotations = true
args.enableInline = kotlinOptions.enableInline
args.inline = kotlinOptions.inline
if (!CompilerArgumentsUtil.checkInlineOption(args.inline)) {
throw GradleException(CompilerArgumentsUtil.getWrongOptionErrorMessage(args.inline))
}
val messageCollector = GradleMessageCollector(logger)
val exitCode = compiler.exec(messageCollector, args)
@@ -37,6 +37,12 @@ class BasicKotlinGradleIT : BaseGradleIT() {
}
}
Test fun testInlineDisabled() {
Project("inlineDisabled").build("build", "-Pkotlin.gradle.plugin.version=0.1-SNAPSHOT") {
assertSuccessful()
}
}
Test fun testSimpleKDoc() {
Project("delta").build("kdoc", "-Pkotlin.gradle.plugin.version=0.1-SNAPSHOT") {
assertSuccessful()
@@ -45,7 +45,6 @@ task show << {
compileKotlin {
kotlinOptions.annotations = "externalAnnotations"
kotlinOptions.enableInline = "off";
}
@@ -0,0 +1,50 @@
buildscript {
repositories {
mavenCentral()
maven {
url 'file://' + pathToKotlinPlugin
}
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin-core:0.1-SNAPSHOT'
}
}
import org.jetbrains.kotlin.gradle.plugin.KotlinPlugin
apply plugin: KotlinPlugin
sourceSets {
main {
kotlin {
srcDir 'src'
}
}
}
repositories {
maven {
url 'file://' + pathToKotlinPlugin
}
mavenCentral()
}
dependencies {
compile 'com.google.guava:guava:12.0'
testCompile 'org.testng:testng:6.8'
testRuntime 'org.jetbrains.kotlin:kotlin-stdlib:0.1-SNAPSHOT'
}
test {
useTestNG()
}
compileKotlin {
kotlinOptions.annotations = "externalAnnotations"
kotlinOptions.inline = false
}
task wrapper(type: Wrapper) {
gradleVersion="1.4"
}
@@ -0,0 +1,11 @@
<root>
<item name='com.google.common.base.Joiner com.google.common.base.Joiner on(java.lang.String)'>
<annotation name="org.jetbrains.annotations.NotNull" />
</item>
<item name='com.google.common.base.Joiner com.google.common.base.Joiner.MapJoiner withKeyValueSeparator(java.lang.String)'>
<annotation name="org.jetbrains.annotations.NotNull" />
</item>
<item name='com.google.common.base.Joiner com.google.common.base.Joiner skipNulls()'>
<annotation name="org.jetbrains.annotations.NotNull" />
</item>
</root>
@@ -0,0 +1,13 @@
package demo
import java.util.ArrayList
class KotlinGreetingJoiner() {
val names = ArrayList<String?>()
fun addName(name : String?): Unit{
names.add(name)
}
}