Move existing multiplatform tests to separate class; add options test.
This commit is contained in:
-41
@@ -385,47 +385,6 @@ class KotlinGradleIT: BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testMultiplatformCompile() {
|
||||
val project = Project("multiplatformProject", GRADLE_VERSION)
|
||||
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
assertContains(":lib:compileKotlinCommon",
|
||||
":lib:compileTestKotlinCommon",
|
||||
":libJvm:compileKotlin",
|
||||
":libJvm:compileTestKotlin",
|
||||
":libJs:compileKotlin2Js",
|
||||
":libJs:compileTestKotlin2Js")
|
||||
assertFileExists("lib/build/classes/main/foo/PlatformClass.kotlin_metadata")
|
||||
assertFileExists("lib/build/classes/test/foo/PlatformTest.kotlin_metadata")
|
||||
assertFileExists("libJvm/build/classes/main/foo/PlatformClass.class")
|
||||
assertFileExists("libJvm/build/classes/test/foo/PlatformTest.class")
|
||||
assertFileExists("libJs/build/classes/main/libJs.js")
|
||||
assertFileExists("libJs/build/classes/test/libJs_test.js")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDeprecatedImplementWarning() {
|
||||
val project = Project("multiplatformProject", GRADLE_VERSION)
|
||||
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
assertNotContains(IMPLEMENT_DEPRECATION_WARNING)
|
||||
}
|
||||
|
||||
project.projectDir.walk().filter { it.name == "build.gradle" }.forEach { buildGradle ->
|
||||
buildGradle.modify { it.replace(EXPECTED_BY_CONFIG_NAME, IMPLEMENT_CONFIG_NAME) }
|
||||
}
|
||||
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
assertContains(IMPLEMENT_DEPRECATION_WARNING)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFreeCompilerArgs() {
|
||||
val project = Project("kotlinProject", GRADLE_VERSION)
|
||||
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.gradle.plugin.EXPECTED_BY_CONFIG_NAME
|
||||
import org.jetbrains.kotlin.gradle.plugin.IMPLEMENT_CONFIG_NAME
|
||||
import org.jetbrains.kotlin.gradle.plugin.IMPLEMENT_DEPRECATION_WARNING
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class MultiplatformGradleIT : BaseGradleIT() {
|
||||
companion object {
|
||||
private const val GRADLE_VERSION = "4.2"
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testMultiplatformCompile() {
|
||||
val project = Project("multiplatformProject", GRADLE_VERSION)
|
||||
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
assertContains(":lib:compileKotlinCommon",
|
||||
":lib:compileTestKotlinCommon",
|
||||
":libJvm:compileKotlin",
|
||||
":libJvm:compileTestKotlin",
|
||||
":libJs:compileKotlin2Js",
|
||||
":libJs:compileTestKotlin2Js")
|
||||
assertFileExists("lib/build/classes/main/foo/PlatformClass.kotlin_metadata")
|
||||
assertFileExists("lib/build/classes/test/foo/PlatformTest.kotlin_metadata")
|
||||
assertFileExists("libJvm/build/classes/main/foo/PlatformClass.class")
|
||||
assertFileExists("libJvm/build/classes/test/foo/PlatformTest.class")
|
||||
assertFileExists("libJs/build/classes/main/libJs.js")
|
||||
assertFileExists("libJs/build/classes/test/libJs_test.js")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDeprecatedImplementWarning() {
|
||||
val project = Project("multiplatformProject", GRADLE_VERSION)
|
||||
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
assertNotContains(IMPLEMENT_DEPRECATION_WARNING)
|
||||
}
|
||||
|
||||
project.projectDir.walk().filter { it.name == "build.gradle" }.forEach { buildGradle ->
|
||||
buildGradle.modify { it.replace(EXPECTED_BY_CONFIG_NAME, IMPLEMENT_CONFIG_NAME) }
|
||||
}
|
||||
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
assertContains(IMPLEMENT_DEPRECATION_WARNING)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCommonKotlinOptions() {
|
||||
with(Project("multiplatformProject", GRADLE_VERSION)) {
|
||||
setupWorkingDir()
|
||||
|
||||
File(projectDir, "lib/build.gradle").appendText(
|
||||
"\ncompileKotlinCommon.kotlinOptions.freeCompilerArgs = ['-Xno-inline']" +
|
||||
"\ncompileKotlinCommon.kotlinOptions.suppressWarnings = true")
|
||||
|
||||
build("build", options = defaultBuildOptions().copy(kotlinDaemonDebugPort = 5556)) {
|
||||
assertSuccessful()
|
||||
assertContains("-Xno-inline")
|
||||
assertContains("-nowarn")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user