Maven and Gradle tests for jvmTarget parameter.

This commit is contained in:
Ilya Gorbunov
2016-06-20 23:22:16 +03:00
parent 3f3a3820b8
commit 848599e940
7 changed files with 106 additions and 0 deletions
@@ -99,6 +99,13 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
assertContains("This type is sealed")
}
}
@Test
fun testJvmTarget() {
Project("jvmTarget", "1.6").build("build") {
assertFailed()
assertContains("Unknown JVM target version: 1.7")
}
}
@Test
fun testGradleSubplugin() {
@@ -0,0 +1,40 @@
buildscript {
repositories {
mavenCentral()
maven {
url 'file://' + pathToKotlinPlugin
}
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1-SNAPSHOT'
}
}
apply plugin: "kotlin"
sourceSets {
main {
kotlin {
srcDir 'src'
}
}
}
repositories {
maven {
url 'file://' + pathToKotlinPlugin
}
mavenCentral()
}
dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1-SNAPSHOT'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.7"
}
task wrapper(type: Wrapper) {
gradleVersion = "1.4"
}
@@ -0,0 +1,3 @@
interface A {
fun foo(): Int = 1
}
@@ -0,0 +1 @@
invoker.buildResult = failure
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-jvmTarget</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-runtime</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<properties>
<kotlin.compiler.jvmTarget>1.4</kotlin.compiler.jvmTarget>
</properties>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,3 @@
interface A {
fun foo(): Int = 1
}
@@ -0,0 +1,4 @@
source(new File(basedir, "../../../verify-common.bsh").getAbsolutePath());
assertBuildLogHasLine("[INFO] BUILD FAILURE");
assertBuildLogHasLineThatContains("Unknown JVM target version: 1.4");