Transform the new tests after rebase; Fix issues from KOTLIN-CR-1546
This commit is contained in:
@@ -133,11 +133,8 @@ task testsFromJps(type: Test) {
|
|||||||
|
|
||||||
task testAdvanceGradleVersion(type: Test) {
|
task testAdvanceGradleVersion(type: Test) {
|
||||||
def gradleVersionForTests = "4.3-rc-1"
|
def gradleVersionForTests = "4.3-rc-1"
|
||||||
systemProperty("advanceGradleVersion", gradleVersionForTests)
|
systemProperty("kotlin.gradle.version.for.tests", gradleVersionForTests)
|
||||||
dependsOn = test.dependsOn
|
dependsOn = test.dependsOn
|
||||||
beforeTest { descriptor ->
|
|
||||||
logger.info("(!) Using Gradle version $gradleVersionForTests")
|
|
||||||
}
|
|
||||||
exclude jpsIncrementalTestsClass
|
exclude jpsIncrementalTestsClass
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -10,10 +10,10 @@ import org.junit.Test
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
class KotlinAndroidGradleIT : AbstractKotlinAndroidGradleTests(gradleVersion = GradleVersionAtLeast("3.4"), androidGradlePluginVersion = "2.3.0")
|
class KotlinAndroidGradleIT : AbstractKotlinAndroidGradleTests(gradleVersion = GradleVersionRequired.AtLeast("3.4"), androidGradlePluginVersion = "2.3.0")
|
||||||
class KotlinAndroidWithJackGradleIT : AbstractKotlinAndroidWithJackGradleTests(androidGradlePluginVersion = "2.3.+")
|
class KotlinAndroidWithJackGradleIT : AbstractKotlinAndroidWithJackGradleTests(androidGradlePluginVersion = "2.3.+")
|
||||||
|
|
||||||
class KotlinAndroid30GradleIT : AbstractKotlinAndroidGradleTests(gradleVersion = GradleVersionAtLeast("4.1"), androidGradlePluginVersion = "3.0.0-beta1") {
|
class KotlinAndroid30GradleIT : AbstractKotlinAndroidGradleTests(gradleVersion = GradleVersionRequired.AtLeast("4.1"), androidGradlePluginVersion = "3.0.0-beta1") {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testApplyWithFeaturePlugin() {
|
fun testApplyWithFeaturePlugin() {
|
||||||
@@ -43,8 +43,8 @@ class KotlinAndroid30GradleIT : AbstractKotlinAndroidGradleTests(gradleVersion =
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class AbstractKotlinAndroidGradleTests(
|
abstract class AbstractKotlinAndroidGradleTests(
|
||||||
protected val gradleVersion: GradleVersionRequirement,
|
protected val gradleVersion: GradleVersionRequired,
|
||||||
private val androidGradlePluginVersion: String
|
private val androidGradlePluginVersion: String
|
||||||
) : BaseGradleIT() {
|
) : BaseGradleIT() {
|
||||||
|
|
||||||
override fun defaultBuildOptions() =
|
override fun defaultBuildOptions() =
|
||||||
@@ -276,7 +276,7 @@ fun getSomething() = 10
|
|||||||
":libAndroid:compileReleaseUnitTestKotlin"
|
":libAndroid:compileReleaseUnitTestKotlin"
|
||||||
)
|
)
|
||||||
|
|
||||||
val kotlinFolder = if (VersionNumber.parse(gradleVersion).major > 3) "kotlin" else ""
|
val kotlinFolder = if (VersionNumber.parse(project.chooseWrapperVersionOrFinishTest()).major > 3) "kotlin" else ""
|
||||||
|
|
||||||
assertFileExists("lib/build/classes/$kotlinFolder/main/foo/PlatformClass.kotlin_metadata")
|
assertFileExists("lib/build/classes/$kotlinFolder/main/foo/PlatformClass.kotlin_metadata")
|
||||||
assertFileExists("lib/build/classes/$kotlinFolder/test/foo/PlatformTest.kotlin_metadata")
|
assertFileExists("lib/build/classes/$kotlinFolder/test/foo/PlatformTest.kotlin_metadata")
|
||||||
@@ -304,7 +304,7 @@ abstract class AbstractKotlinAndroidWithJackGradleTests(
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSimpleCompile() {
|
fun testSimpleCompile() {
|
||||||
val project = Project("AndroidJackProject", SpecificGradleVersion("3.4"))
|
val project = Project("AndroidJackProject", GradleVersionRequired.Exact("3.4"))
|
||||||
|
|
||||||
project.build("assemble") {
|
project.build("assemble") {
|
||||||
assertFailed()
|
assertFailed()
|
||||||
|
|||||||
+9
-12
@@ -1,6 +1,5 @@
|
|||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import org.gradle.api.logging.LogLevel
|
import org.gradle.api.logging.LogLevel
|
||||||
import org.gradle.util.GradleVersion
|
import org.gradle.util.GradleVersion
|
||||||
import org.jetbrains.kotlin.gradle.util.*
|
import org.jetbrains.kotlin.gradle.util.*
|
||||||
@@ -177,10 +176,10 @@ abstract class BaseGradleIT {
|
|||||||
)
|
)
|
||||||
|
|
||||||
open inner class Project(
|
open inner class Project(
|
||||||
val projectName: String,
|
val projectName: String,
|
||||||
val gradleVersionRequirement: GradleVersionRequirement,
|
val gradleVersionRequirement: GradleVersionRequired = GradleVersionRequired.None,
|
||||||
directoryPrefix: String? = null,
|
directoryPrefix: String? = null,
|
||||||
val minLogLevel: LogLevel = LogLevel.DEBUG
|
val minLogLevel: LogLevel = LogLevel.DEBUG
|
||||||
) {
|
) {
|
||||||
val resourceDirName = if (directoryPrefix != null) "$directoryPrefix/$projectName" else projectName
|
val resourceDirName = if (directoryPrefix != null) "$directoryPrefix/$projectName" else projectName
|
||||||
open val resourcesRoot = File(resourcesRootFile, "testProject/$resourceDirName")
|
open val resourcesRoot = File(resourcesRootFile, "testProject/$resourceDirName")
|
||||||
@@ -442,24 +441,24 @@ abstract class BaseGradleIT {
|
|||||||
else
|
else
|
||||||
assertSameFiles(sources, compiledJavaSources.projectRelativePaths(this.project), "Compiled Java files differ:\n ")
|
assertSameFiles(sources, compiledJavaSources.projectRelativePaths(this.project), "Compiled Java files differ:\n ")
|
||||||
|
|
||||||
fun Project.resourcesDir(subproject: String? = null, sourceSet: String = "main") =
|
fun Project.resourcesDir(subproject: String? = null, sourceSet: String = "main"): String =
|
||||||
(subproject?.plus("/") ?: "") + "build/" +
|
(subproject?.plus("/") ?: "") + "build/" +
|
||||||
(if (GradleVersion.version(chooseWrapperVersionOrFinishTest()) < GradleVersion.version("4.0"))
|
(if (GradleVersion.version(chooseWrapperVersionOrFinishTest()) < GradleVersion.version("4.0"))
|
||||||
"classes/"
|
"classes/"
|
||||||
else "resources/") +
|
else "resources/") +
|
||||||
sourceSet + "/"
|
sourceSet + "/"
|
||||||
|
|
||||||
fun Project.classesDir(subproject: String? = null, sourceSet: String = "main", language: String = "kotlin") =
|
fun Project.classesDir(subproject: String? = null, sourceSet: String = "main", language: String = "kotlin"): String =
|
||||||
(subproject?.plus("/") ?: "") + "build/classes/" +
|
(subproject?.plus("/") ?: "") + "build/classes/" +
|
||||||
(if (GradleVersion.version(chooseWrapperVersionOrFinishTest()) >= GradleVersion.version("4.0"))
|
(if (GradleVersion.version(chooseWrapperVersionOrFinishTest()) >= GradleVersion.version("4.0"))
|
||||||
"$language/"
|
"$language/"
|
||||||
else "") +
|
else "") +
|
||||||
sourceSet + "/"
|
sourceSet + "/"
|
||||||
|
|
||||||
fun CompiledProject.kotlinClassesDir(subproject: String? = null, sourceSet: String = "main") =
|
fun CompiledProject.kotlinClassesDir(subproject: String? = null, sourceSet: String = "main"): String =
|
||||||
project.classesDir(subproject, sourceSet, language = "kotlin")
|
project.classesDir(subproject, sourceSet, language = "kotlin")
|
||||||
|
|
||||||
fun CompiledProject.javaClassesDir(subproject: String? = null, sourceSet: String = "main") =
|
fun CompiledProject.javaClassesDir(subproject: String? = null, sourceSet: String = "main"): String =
|
||||||
project.classesDir(subproject, sourceSet, language = "java")
|
project.classesDir(subproject, sourceSet, language = "java")
|
||||||
|
|
||||||
private fun Project.createBuildCommand(wrapperDir: File, params: Array<out String>, options: BuildOptions): List<String> =
|
private fun Project.createBuildCommand(wrapperDir: File, params: Array<out String>, options: BuildOptions): List<String> =
|
||||||
@@ -495,9 +494,7 @@ abstract class BaseGradleIT {
|
|||||||
System.getProperty("maven.repo.local")?.let {
|
System.getProperty("maven.repo.local")?.let {
|
||||||
add("-Dmaven.repo.local=$it") // TODO: proper escaping
|
add("-Dmaven.repo.local=$it") // TODO: proper escaping
|
||||||
}
|
}
|
||||||
if (options.withBuildCache) {
|
add(if (options.withBuildCache) "--build-cache" else "--no-build-cache")
|
||||||
add("--build-cache")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Workaround: override a console type set in the user machine gradle.properties (since Gradle 4.3):
|
// Workaround: override a console type set in the user machine gradle.properties (since Gradle 4.3):
|
||||||
add("--console=plain")
|
add("--console=plain")
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import org.junit.runners.Parameterized.Parameters
|
|||||||
abstract class BaseMultiGradleVersionIT : BaseGradleIT() {
|
abstract class BaseMultiGradleVersionIT : BaseGradleIT() {
|
||||||
@Parameter lateinit var gradleVersionString: String
|
@Parameter lateinit var gradleVersionString: String
|
||||||
|
|
||||||
protected val gradleVersion get() = SpecificGradleVersion(gradleVersionString)
|
protected val gradleVersion get() = GradleVersionRequired.Exact(gradleVersionString)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|||||||
+2
-2
@@ -25,11 +25,11 @@ class BuildCacheIT : BaseGradleIT() {
|
|||||||
super.defaultBuildOptions().copy(withBuildCache = true)
|
super.defaultBuildOptions().copy(withBuildCache = true)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val GRADLE_VERSION = "4.3.1"
|
private val GRADLE_VERSION = GradleVersionRequired.AtLeast("4.3")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testNoCacheWithGradlePre43() = with(Project("simpleProject", "4.2")) {
|
fun testNoCacheWithGradlePre43() = with(Project("simpleProject", GradleVersionRequired.Exact("4.2"))) {
|
||||||
// Check that even with the build cache enabled, the Kotlin tasks are not cacheable with Gradle < 4.3:
|
// Check that even with the build cache enabled, the Kotlin tasks are not cacheable with Gradle < 4.3:
|
||||||
val optionsWithCache = defaultBuildOptions().copy(withBuildCache = true)
|
val optionsWithCache = defaultBuildOptions().copy(withBuildCache = true)
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -36,16 +36,17 @@ class BuildCacheRelocationIT : BaseGradleIT() {
|
|||||||
@Parameterized.Parameter
|
@Parameterized.Parameter
|
||||||
lateinit var testCase: TestCase
|
lateinit var testCase: TestCase
|
||||||
|
|
||||||
|
val workingDirs = (0..1).map { createTempDir("BuildCacheRelocationIT$it") }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRelocation() = with(testCase) {
|
fun testRelocation() = with(testCase) {
|
||||||
val localBuildCacheDirectory = createTempDir("buildCache$projectName")
|
val localBuildCacheDirectory = createTempDir("buildCache$projectName")
|
||||||
|
|
||||||
val originalWorkingDir = workingDir
|
val originalWorkingDir = workingDir
|
||||||
val workingDirs = (0..1).map { createTempDir("BuildCacheRelocationIT$it") }
|
|
||||||
|
|
||||||
val (firstProject, secondProject) = (0..1).map { id ->
|
val (firstProject, secondProject) = (0..1).map { id ->
|
||||||
workingDir = workingDirs[id]
|
workingDir = workingDirs[id]
|
||||||
Project(projectName, "4.4", projectDirectoryPrefix).apply {
|
Project(projectName, GradleVersionRequired.AtLeast("4.3"), projectDirectoryPrefix).apply {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
initProject()
|
initProject()
|
||||||
prepareLocalBuildCache(localBuildCacheDirectory)
|
prepareLocalBuildCache(localBuildCacheDirectory)
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ class ClassFileIsRemovedIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun doTest(buildOptions: BuildOptions, transformDummy: (File)->Unit) {
|
fun doTest(buildOptions: BuildOptions, transformDummy: (File)->Unit) {
|
||||||
val project = Project("kotlinInJavaRoot", NoSpecificGradleVersion)
|
val project = Project("kotlinInJavaRoot")
|
||||||
project.build("build", options = buildOptions) {
|
project.build("build", options = buildOptions) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -23,14 +23,13 @@ import java.io.File
|
|||||||
|
|
||||||
class CoroutinesIT: BaseGradleIT() {
|
class CoroutinesIT: BaseGradleIT() {
|
||||||
companion object {
|
companion object {
|
||||||
private val GRADLE_VERSION = NoSpecificGradleVersion
|
|
||||||
private const val LOCAL_PROPERTIES = "local.properties"
|
private const val LOCAL_PROPERTIES = "local.properties"
|
||||||
private const val GRADLE_PROPERTIES = "gradle.properties"
|
private const val GRADLE_PROPERTIES = "gradle.properties"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCoroutinesProjectDSL() {
|
fun testCoroutinesProjectDSL() {
|
||||||
val project = Project("coroutinesProjectDSL", GRADLE_VERSION)
|
val project = Project("coroutinesProjectDSL")
|
||||||
project.build("assemble") {
|
project.build("assemble") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains("-Xcoroutines=enable")
|
assertContains("-Xcoroutines=enable")
|
||||||
@@ -98,10 +97,10 @@ class CoroutinesIT: BaseGradleIT() {
|
|||||||
|
|
||||||
// todo: replace with project that actually uses coroutines after their syntax is finalized
|
// todo: replace with project that actually uses coroutines after their syntax is finalized
|
||||||
private val jvmProject: Project
|
private val jvmProject: Project
|
||||||
get() = Project("kotlinProject", GRADLE_VERSION)
|
get() = Project("kotlinProject")
|
||||||
|
|
||||||
private val jsProject: Project
|
private val jsProject: Project
|
||||||
get() = Project("kotlin2JsProject", GRADLE_VERSION)
|
get() = Project("kotlin2JsProject")
|
||||||
|
|
||||||
private fun Project.doTest(coroutineSupport: String, propertyFileName: String?) {
|
private fun Project.doTest(coroutineSupport: String, propertyFileName: String?) {
|
||||||
if (propertyFileName != null) {
|
if (propertyFileName != null) {
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ class ExecutionStrategyJsIT : ExecutionStrategyIT() {
|
|||||||
|
|
||||||
open class ExecutionStrategyIT : BaseGradleIT() {
|
open class ExecutionStrategyIT : BaseGradleIT() {
|
||||||
companion object {
|
companion object {
|
||||||
private val GRADLE_VERSION = GradleVersionAtLeast("4.0")
|
private val GRADLE_VERSION = GradleVersionRequired.AtLeast("4.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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.gradle.util.GradleVersion
|
||||||
|
import org.junit.Assume
|
||||||
|
|
||||||
|
sealed class GradleVersionRequired(val minVersion: String, val maxVersion: String?) {
|
||||||
|
companion object {
|
||||||
|
//TODO once the plugin is compiled with API level 1.0, replace with the really supported one (3.2)
|
||||||
|
// Currently, it will lead to failing tests due to the conflict with the pre-release kotlin-reflect
|
||||||
|
// bundled into Gradle 3.2...3.4
|
||||||
|
const val OLDEST_SUPPORTED = "3.5"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Exact(version: String) : GradleVersionRequired(version, version)
|
||||||
|
|
||||||
|
class AtLeast(version: String) : GradleVersionRequired(version, null)
|
||||||
|
|
||||||
|
object None : GradleVersionRequired(GradleVersionRequired.OLDEST_SUPPORTED, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun BaseGradleIT.Project.chooseWrapperVersionOrFinishTest(): String {
|
||||||
|
val gradleVersionForTests = System.getProperty("kotlin.gradle.version.for.tests")?.toGradleVersion()
|
||||||
|
val minVersion = gradleVersionRequirement.minVersion.toGradleVersion()
|
||||||
|
val maxVersion = gradleVersionRequirement.maxVersion?.toGradleVersion()
|
||||||
|
|
||||||
|
if (gradleVersionForTests == null) {
|
||||||
|
return minVersion.version
|
||||||
|
}
|
||||||
|
|
||||||
|
Assume.assumeTrue(minVersion <= gradleVersionForTests && (maxVersion == null || gradleVersionForTests <= maxVersion))
|
||||||
|
|
||||||
|
return gradleVersionForTests.version
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun String.toGradleVersion() = GradleVersion.version(this)
|
||||||
-78
@@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.gradle.util.GradleVersion
|
|
||||||
import org.junit.AssumptionViolatedException
|
|
||||||
|
|
||||||
sealed class GradleVersionRequirement(val version: String) {
|
|
||||||
companion object {
|
|
||||||
//TODO once the plugin is compiled with API level 1.0, replace with the really supported one (3.2)
|
|
||||||
// Currently, it will lead to failing tests due to the conflict with the pre-release kotlin-reflect
|
|
||||||
// bundled into Gradle 3.2...3.4
|
|
||||||
const val OLDEST_SUPPORTED = "3.5"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SpecificGradleVersion(version: String) : GradleVersionRequirement(version)
|
|
||||||
|
|
||||||
class GradleVersionAtLeast(version: String) : GradleVersionRequirement(version)
|
|
||||||
|
|
||||||
object NoSpecificGradleVersion : GradleVersionRequirement(GradleVersionRequirement.OLDEST_SUPPORTED)
|
|
||||||
|
|
||||||
fun BaseGradleIT.Project.chooseWrapperVersionOrFinishTest(): String {
|
|
||||||
val advanceGradleVersionArg: String? = System.getProperty("advanceGradleVersion")
|
|
||||||
val requiredVersion = gradleVersionRequirement.version
|
|
||||||
|
|
||||||
/* Given arg = advanceGradleVersionArg,
|
|
||||||
req = requiredVersion,
|
|
||||||
min = GradleVersionRequirement.OLDEST_SUPPORTED
|
|
||||||
|
|
||||||
Decide whether to run the test (and with which version) or ignore it as follows:
|
|
||||||
|
|
||||||
project.requiredGradleVersion | arg is null | arg < req | arg = req | arg > req |
|
|
||||||
-------------------------------|-------------|-------------|-------------|-------------|
|
|
||||||
SpecificGradleVersion(req) | RUN (req) | IGNORE | IGNORE | IGNORE |
|
|
||||||
GradleVersionAtLeast(req) | RUN (req) | IGNORE | RUN | RUN (arg) |
|
|
||||||
NoSpecificVersion (req is min) | RUN (min) | IGNORE | RUN | RUN (arg) |
|
|
||||||
*/
|
|
||||||
|
|
||||||
return when {
|
|
||||||
advanceGradleVersionArg == null -> requiredVersion
|
|
||||||
else -> {
|
|
||||||
if (gradleVersionRequirement is SpecificGradleVersion)
|
|
||||||
throw AssumptionViolatedException("This test is ignored as it requires a specific Gradle version $requiredVersion. " +
|
|
||||||
"Remove the advanceGradleVersion system property to run it.")
|
|
||||||
|
|
||||||
val argComparedToReq = gradleVersionsComparator.compare(advanceGradleVersionArg, requiredVersion)
|
|
||||||
|
|
||||||
when {
|
|
||||||
argComparedToReq < 0 -> throw AssumptionViolatedException(
|
|
||||||
"The test requires Gradle version $requiredVersion, but this run uses $advanceGradleVersionArg")
|
|
||||||
argComparedToReq == 0 -> advanceGradleVersionArg
|
|
||||||
else /* argComparedToReq > 0 */ ->
|
|
||||||
if (gradleVersionRequirement is SpecificGradleVersion)
|
|
||||||
throw AssumptionViolatedException(
|
|
||||||
"The test requires specific Gradle version $requiredVersion and is not subject to " +
|
|
||||||
"version advance to $advanceGradleVersionArg")
|
|
||||||
else advanceGradleVersionArg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val gradleVersionsComparator = compareBy<String> { GradleVersion.version(it) }
|
|
||||||
+9
-10
@@ -10,7 +10,6 @@ import java.io.File
|
|||||||
|
|
||||||
class IncrementalCompilationMultiProjectIT : BaseGradleIT() {
|
class IncrementalCompilationMultiProjectIT : BaseGradleIT() {
|
||||||
companion object {
|
companion object {
|
||||||
private val GRADLE_VERSION = NoSpecificGradleVersion
|
|
||||||
private val ANDROID_GRADLE_PLUGIN_VERSION = "1.5.+"
|
private val ANDROID_GRADLE_PLUGIN_VERSION = "1.5.+"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +25,7 @@ class IncrementalCompilationMultiProjectIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testMoveFunctionFromLib() {
|
fun testMoveFunctionFromLib() {
|
||||||
val project = Project("incrementalMultiproject", GRADLE_VERSION)
|
val project = Project("incrementalMultiproject")
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
@@ -46,7 +45,7 @@ class IncrementalCompilationMultiProjectIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAddNewMethodToLib() {
|
fun testAddNewMethodToLib() {
|
||||||
val project = Project("incrementalMultiproject", GRADLE_VERSION)
|
val project = Project("incrementalMultiproject")
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
@@ -71,7 +70,7 @@ open class A {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testLibClassBecameFinal() {
|
fun testLibClassBecameFinal() {
|
||||||
val project = Project("incrementalMultiproject", GRADLE_VERSION)
|
val project = Project("incrementalMultiproject")
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
@@ -91,7 +90,7 @@ open class A {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCleanBuildLib() {
|
fun testCleanBuildLib() {
|
||||||
val project = Project("incrementalMultiproject", GRADLE_VERSION)
|
val project = Project("incrementalMultiproject")
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
@@ -113,7 +112,7 @@ open class A {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCompileErrorInLib() {
|
fun testCompileErrorInLib() {
|
||||||
val project = Project("incrementalMultiproject", GRADLE_VERSION)
|
val project = Project("incrementalMultiproject")
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
@@ -140,7 +139,7 @@ open class A {
|
|||||||
// that is not JavaCompile or KotlinCompile
|
// that is not JavaCompile or KotlinCompile
|
||||||
@Test
|
@Test
|
||||||
fun testCompileLibWithGroovy() {
|
fun testCompileLibWithGroovy() {
|
||||||
val project = Project("incrementalMultiproject", GRADLE_VERSION)
|
val project = Project("incrementalMultiproject")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
val lib = File(project.projectDir, "lib")
|
val lib = File(project.projectDir, "lib")
|
||||||
val libBuildGradle = File(lib, "build.gradle")
|
val libBuildGradle = File(lib, "build.gradle")
|
||||||
@@ -178,7 +177,7 @@ open class A {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAndroid() {
|
fun testAndroid() {
|
||||||
val project = Project("AndroidProject", SpecificGradleVersion("2.10"))
|
val project = Project("AndroidProject", GradleVersionRequired.Exact("2.10"))
|
||||||
val options = androidBuildOptions()
|
val options = androidBuildOptions()
|
||||||
|
|
||||||
project.build("assembleDebug", options = options) {
|
project.build("assembleDebug", options = options) {
|
||||||
@@ -186,7 +185,7 @@ open class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val libUtilKt = project.projectDir.getFileByName("libUtil.kt")
|
val libUtilKt = project.projectDir.getFileByName("libUtil.kt")
|
||||||
libUtilKt.modify { it.replace("fun libUtil(): String", "fun libUtil(): Any") }
|
libUtilKt.modify { it.replace("fun libUtil(): String", "fun libUtil(): None") }
|
||||||
|
|
||||||
project.build("assembleDebug", options = options) {
|
project.build("assembleDebug", options = options) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -279,7 +278,7 @@ abstract class IncrementalCompilationJavaChangesBase(val usePreciseJavaTracking:
|
|||||||
transformFile: (String)->String,
|
transformFile: (String)->String,
|
||||||
expectedAffectedSources: Collection<String>
|
expectedAffectedSources: Collection<String>
|
||||||
) {
|
) {
|
||||||
val project = Project("incrementalMultiproject", GRADLE_VERSION)
|
val project = Project("incrementalMultiproject")
|
||||||
|
|
||||||
val options = defaultBuildOptions().copy(usePreciseJavaTracking = usePreciseJavaTracking)
|
val options = defaultBuildOptions().copy(usePreciseJavaTracking = usePreciseJavaTracking)
|
||||||
project.build("build", options = options) {
|
project.build("build", options = options) {
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ class Kapt3Android30IT : Kapt3AndroidIT() {
|
|||||||
|
|
||||||
open class Kapt3AndroidIT : Kapt3BaseIT() {
|
open class Kapt3AndroidIT : Kapt3BaseIT() {
|
||||||
companion object {
|
companion object {
|
||||||
private val GRADLE_VERSION = GradleVersionAtLeast("4.1")
|
private val GRADLE_VERSION = GradleVersionRequired.AtLeast("4.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open val androidGradlePluginVersion: String
|
protected open val androidGradlePluginVersion: String
|
||||||
|
|||||||
+15
-19
@@ -35,13 +35,9 @@ abstract class Kapt3BaseIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class Kapt3IT : Kapt3BaseIT() {
|
open class Kapt3IT : Kapt3BaseIT() {
|
||||||
companion object {
|
|
||||||
private val GRADLE_VERSION = NoSpecificGradleVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAnnotationProcessorAsFqName() {
|
fun testAnnotationProcessorAsFqName() {
|
||||||
val project = Project("annotationProcessorAsFqName", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("annotationProcessorAsFqName", directoryPrefix = "kapt2")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -57,7 +53,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSimple() {
|
fun testSimple() {
|
||||||
val project = Project("simple", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("simple", directoryPrefix = "kapt2")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -86,7 +82,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
@Test
|
@Test
|
||||||
fun testSimpleWithIC() {
|
fun testSimpleWithIC() {
|
||||||
val options = defaultBuildOptions().copy(incremental = true)
|
val options = defaultBuildOptions().copy(incremental = true)
|
||||||
val project = Project("simple", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("simple", directoryPrefix = "kapt2")
|
||||||
val javaClassesDir = File(project.projectDir, project.classesDir(language = "java"))
|
val javaClassesDir = File(project.projectDir, project.classesDir(language = "java"))
|
||||||
|
|
||||||
project.build("clean", "build", options = options) {
|
project.build("clean", "build", options = options) {
|
||||||
@@ -120,7 +116,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDisableIcForGenerateStubs() {
|
fun testDisableIcForGenerateStubs() {
|
||||||
val project = Project("simple", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("simple", directoryPrefix = "kapt2")
|
||||||
project.build("build", options = defaultBuildOptions().copy(incremental = false)) {
|
project.build("build", options = defaultBuildOptions().copy(incremental = false)) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains(":kaptGenerateStubsKotlin")
|
assertContains(":kaptGenerateStubsKotlin")
|
||||||
@@ -130,7 +126,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testArguments() {
|
fun testArguments() {
|
||||||
Project("arguments", GRADLE_VERSION, directoryPrefix = "kapt2").build("build") {
|
Project("arguments", directoryPrefix = "kapt2").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertKaptSuccessful()
|
assertKaptSuccessful()
|
||||||
assertContains("Options: {suffix=Customized, justColon=:, justEquals==, containsColon=a:b, " +
|
assertContains("Options: {suffix=Customized, justColon=:, justEquals==, containsColon=a:b, " +
|
||||||
@@ -145,7 +141,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testInheritedAnnotations() {
|
fun testInheritedAnnotations() {
|
||||||
Project("inheritedAnnotations", GRADLE_VERSION, directoryPrefix = "kapt2").build("build") {
|
Project("inheritedAnnotations", directoryPrefix = "kapt2").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertKaptSuccessful()
|
assertKaptSuccessful()
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
||||||
@@ -157,7 +153,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testGeneratedDirectoryIsUpToDate() {
|
fun testGeneratedDirectoryIsUpToDate() {
|
||||||
val project = Project("generatedDirUpToDate", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("generatedDirUpToDate", directoryPrefix = "kapt2")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -200,7 +196,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRemoveAnnotationIC() {
|
fun testRemoveAnnotationIC() {
|
||||||
val project = Project("simple", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("simple", directoryPrefix = "kapt2")
|
||||||
val options = defaultBuildOptions().copy(incremental = true)
|
val options = defaultBuildOptions().copy(incremental = true)
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
val internalDummyKt = project.projectDir.getFileByName("InternalDummy.kt")
|
val internalDummyKt = project.projectDir.getFileByName("InternalDummy.kt")
|
||||||
@@ -227,7 +223,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKt18799() {
|
fun testKt18799() {
|
||||||
val project = Project("kt18799", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("kt18799", directoryPrefix = "kapt2")
|
||||||
|
|
||||||
project.build("kaptKotlin") {
|
project.build("kaptKotlin") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -246,7 +242,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKaptClassesDirSync() {
|
fun testKaptClassesDirSync() {
|
||||||
val project = Project("autoService", SpecificGradleVersion("3.5"), directoryPrefix = "kapt2")
|
val project = Project("autoService", GradleVersionRequired.Exact("3.5"), directoryPrefix = "kapt2")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -271,7 +267,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
fun testCopyCompileArguments() {
|
fun testCopyCompileArguments() {
|
||||||
val project = Project("simple", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("simple", directoryPrefix = "kapt2")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
val arg = "-Xskip-runtime-version-check"
|
val arg = "-Xskip-runtime-version-check"
|
||||||
@@ -293,7 +289,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testOutputKotlinCode() {
|
fun testOutputKotlinCode() {
|
||||||
Project("kaptOutputKotlinCode", GRADLE_VERSION, directoryPrefix = "kapt2").build("build") {
|
Project("kaptOutputKotlinCode", directoryPrefix = "kapt2").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertKaptSuccessful()
|
assertKaptSuccessful()
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
||||||
@@ -305,7 +301,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testLocationMapping() {
|
fun testLocationMapping() {
|
||||||
val project = Project("locationMapping", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("locationMapping", directoryPrefix = "kapt2")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertFailed()
|
assertFailed()
|
||||||
@@ -331,7 +327,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testChangesInLocalAnnotationProcessor() {
|
fun testChangesInLocalAnnotationProcessor() {
|
||||||
val project = Project("localAnnotationProcessor", GRADLE_VERSION, directoryPrefix = "kapt2")
|
val project = Project("localAnnotationProcessor", directoryPrefix = "kapt2")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -354,7 +350,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKaptConfigurationLazyResolution() = with(Project("simple", GRADLE_VERSION, directoryPrefix = "kapt2")) {
|
fun testKaptConfigurationLazyResolution() = with(Project("simple", directoryPrefix = "kapt2")) {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
File(projectDir, "build.gradle").appendText(
|
File(projectDir, "build.gradle").appendText(
|
||||||
"\ndependencies { kapt project.files { throw new GradleException(\"Resolved!\") } }"
|
"\ndependencies { kapt project.files { throw new GradleException(\"Resolved!\") } }"
|
||||||
|
|||||||
+10
-14
@@ -8,13 +8,9 @@ import java.io.File
|
|||||||
|
|
||||||
class KaptIT: BaseGradleIT() {
|
class KaptIT: BaseGradleIT() {
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val GRADLE_VERSION = NoSpecificGradleVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSimple() {
|
fun testSimple() {
|
||||||
val project = Project("kaptSimple", GRADLE_VERSION)
|
val project = Project("kaptSimple")
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
@@ -44,7 +40,7 @@ class KaptIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testEnumConstructor() {
|
fun testEnumConstructor() {
|
||||||
val project = Project("kaptEnumConstructor", GRADLE_VERSION)
|
val project = Project("kaptEnumConstructor")
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
@@ -61,7 +57,7 @@ class KaptIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testStubs() {
|
fun testStubs() {
|
||||||
val project = Project("kaptStubs", GRADLE_VERSION)
|
val project = Project("kaptStubs")
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
@@ -87,7 +83,7 @@ class KaptIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testStubsWithoutJava() {
|
fun testStubsWithoutJava() {
|
||||||
val project = Project("kaptStubs", GRADLE_VERSION)
|
val project = Project("kaptStubs")
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
project.projectDir.allJavaFiles().forEach { it.delete() }
|
project.projectDir.allJavaFiles().forEach { it.delete() }
|
||||||
|
|
||||||
@@ -113,7 +109,7 @@ class KaptIT: BaseGradleIT() {
|
|||||||
|
|
||||||
private fun doTestIncrementalBuild(projectName: String, compileTasks: Array<String>) {
|
private fun doTestIncrementalBuild(projectName: String, compileTasks: Array<String>) {
|
||||||
val compileTasksUpToDate = compileTasks.map { it + " UP-TO-DATE" }.toTypedArray()
|
val compileTasksUpToDate = compileTasks.map { it + " UP-TO-DATE" }.toTypedArray()
|
||||||
val project = Project(projectName, NoSpecificGradleVersion)
|
val project = Project(projectName)
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
@@ -150,7 +146,7 @@ class KaptIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testArguments() {
|
fun testArguments() {
|
||||||
val project = Project("kaptArguments", GRADLE_VERSION)
|
val project = Project("kaptArguments")
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
@@ -167,7 +163,7 @@ class KaptIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testInheritedAnnotations() {
|
fun testInheritedAnnotations() {
|
||||||
val project = Project("kaptInheritedAnnotations", GRADLE_VERSION)
|
val project = Project("kaptInheritedAnnotations")
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
@@ -181,7 +177,7 @@ class KaptIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testOutputKotlinCode() {
|
fun testOutputKotlinCode() {
|
||||||
val project = Project("kaptOutputKotlinCode", GRADLE_VERSION)
|
val project = Project("kaptOutputKotlinCode")
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
@@ -201,7 +197,7 @@ class KaptIT: BaseGradleIT() {
|
|||||||
fun testInternalUserIsModifiedStubsIC() {
|
fun testInternalUserIsModifiedStubsIC() {
|
||||||
val options = defaultBuildOptions().copy(incremental = true)
|
val options = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
val project = Project("kaptStubs", GRADLE_VERSION)
|
val project = Project("kaptStubs")
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
|
|
||||||
project.build("build", options = options) {
|
project.build("build", options = options) {
|
||||||
@@ -223,7 +219,7 @@ class KaptIT: BaseGradleIT() {
|
|||||||
fun testKotlinCompilerNotCalledStubsIC() {
|
fun testKotlinCompilerNotCalledStubsIC() {
|
||||||
val options = defaultBuildOptions().copy(incremental = true)
|
val options = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
val project = Project("kaptStubs", GRADLE_VERSION)
|
val project = Project("kaptStubs")
|
||||||
project.allowOriginalKapt()
|
project.allowOriginalKapt()
|
||||||
|
|
||||||
project.build("build", options = options) {
|
project.build("build", options = options) {
|
||||||
|
|||||||
+1
-2
@@ -19,7 +19,6 @@ abstract class KaptIncrementalBaseIT(val shouldUseStubs: Boolean, val useKapt3:
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val GRADLE_VERSION = NoSpecificGradleVersion
|
|
||||||
private val EXAMPLE_ANNOTATION_REGEX = "@(field:)?example.ExampleAnnotation".toRegex()
|
private val EXAMPLE_ANNOTATION_REGEX = "@(field:)?example.ExampleAnnotation".toRegex()
|
||||||
private const val GENERATE_STUBS_PLACEHOLDER = "GENERATE_STUBS_PLACEHOLDER"
|
private const val GENERATE_STUBS_PLACEHOLDER = "GENERATE_STUBS_PLACEHOLDER"
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ abstract class KaptIncrementalBaseIT(val shouldUseStubs: Boolean, val useKapt3:
|
|||||||
protected open val projectName = "kaptIncrementalCompilationProject"
|
protected open val projectName = "kaptIncrementalCompilationProject"
|
||||||
|
|
||||||
private fun getProject() =
|
private fun getProject() =
|
||||||
Project(projectName, GRADLE_VERSION).apply {
|
Project(projectName).apply {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
val buildGradle = projectDir.parentFile.getFileByName("build.gradle")
|
val buildGradle = projectDir.parentFile.getFileByName("build.gradle")
|
||||||
buildGradle.modify { it.replace(GENERATE_STUBS_PLACEHOLDER, shouldUseStubs.toString()) }
|
buildGradle.modify { it.replace(GENERATE_STUBS_PLACEHOLDER, shouldUseStubs.toString()) }
|
||||||
|
|||||||
+17
-17
@@ -13,7 +13,7 @@ import kotlin.test.assertTrue
|
|||||||
class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
||||||
@Test
|
@Test
|
||||||
fun testBuildAndClean() {
|
fun testBuildAndClean() {
|
||||||
val project = Project("kotlin2JsProject", NoSpecificGradleVersion)
|
val project = Project("kotlin2JsProject")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -58,7 +58,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testJarIncludesJsDefaultOutput() {
|
fun testJarIncludesJsDefaultOutput() {
|
||||||
val project = Project("kotlin2JsNoOutputFileProject", NoSpecificGradleVersion)
|
val project = Project("kotlin2JsNoOutputFileProject")
|
||||||
|
|
||||||
project.build("jar") {
|
project.build("jar") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -74,7 +74,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testJarIncludesJsOutputSetExplicitly() {
|
fun testJarIncludesJsOutputSetExplicitly() {
|
||||||
val project = Project("kotlin2JsModuleKind", NoSpecificGradleVersion)
|
val project = Project("kotlin2JsModuleKind")
|
||||||
|
|
||||||
project.build(":jar") {
|
project.build(":jar") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -90,7 +90,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testModuleKind() {
|
fun testModuleKind() {
|
||||||
val project = Project("kotlin2JsModuleKind", NoSpecificGradleVersion)
|
val project = Project("kotlin2JsModuleKind")
|
||||||
|
|
||||||
project.build("runRhino") {
|
project.build("runRhino") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -99,7 +99,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDefaultOutputFile() {
|
fun testDefaultOutputFile() {
|
||||||
val project = Project("kotlin2JsNoOutputFileProject", NoSpecificGradleVersion)
|
val project = Project("kotlin2JsNoOutputFileProject")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -110,7 +110,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCompileTestCouldAccessProduction() {
|
fun testCompileTestCouldAccessProduction() {
|
||||||
val project = Project("kotlin2JsProjectWithTests", NoSpecificGradleVersion)
|
val project = Project("kotlin2JsProjectWithTests")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -127,7 +127,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCompilerTestAccessInternalProduction() {
|
fun testCompilerTestAccessInternalProduction() {
|
||||||
val project = Project("kotlin2JsInternalTest", SpecificGradleVersion("3.5"))
|
val project = Project("kotlin2JsInternalTest", GradleVersionRequired.Exact("3.5"))
|
||||||
|
|
||||||
project.build("runRhino") {
|
project.build("runRhino") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -136,7 +136,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testJsCustomSourceSet() {
|
fun testJsCustomSourceSet() {
|
||||||
val project = Project("kotlin2JsProjectWithCustomSourceset", NoSpecificGradleVersion)
|
val project = Project("kotlin2JsProjectWithCustomSourceset")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -159,7 +159,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinJsBuiltins() {
|
fun testKotlinJsBuiltins() {
|
||||||
val project = Project("kotlinBuiltins", GradleVersionAtLeast("4.0"))
|
val project = Project("kotlinBuiltins", GradleVersionRequired.AtLeast("4.0"))
|
||||||
|
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
val buildGradle = File(project.projectDir, "app").getFileByName("build.gradle")
|
val buildGradle = File(project.projectDir, "app").getFileByName("build.gradle")
|
||||||
@@ -174,7 +174,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinJsSourceMap() {
|
fun testKotlinJsSourceMap() {
|
||||||
val project = Project("kotlin2JsNoOutputFileProject", NoSpecificGradleVersion)
|
val project = Project("kotlin2JsNoOutputFileProject")
|
||||||
|
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinJsSourceMapInline() {
|
fun testKotlinJsSourceMapInline() {
|
||||||
val project = Project("kotlin2JsProjectWithSourceMapInline", NoSpecificGradleVersion)
|
val project = Project("kotlin2JsProjectWithSourceMapInline")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -217,7 +217,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDce() {
|
fun testDce() {
|
||||||
val project = Project("kotlin2JsDceProject", NoSpecificGradleVersion, minLogLevel = LogLevel.INFO)
|
val project = Project("kotlin2JsDceProject", minLogLevel = LogLevel.INFO)
|
||||||
|
|
||||||
project.build("runRhino") {
|
project.build("runRhino") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -233,7 +233,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDceOutputPath() {
|
fun testDceOutputPath() {
|
||||||
val project = Project("kotlin2JsDceProject", "2.10", minLogLevel = LogLevel.INFO)
|
val project = Project("kotlin2JsDceProject", minLogLevel = LogLevel.INFO)
|
||||||
|
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
File(project.projectDir, "mainProject/build.gradle").modify {
|
File(project.projectDir, "mainProject/build.gradle").modify {
|
||||||
@@ -257,7 +257,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDceDevMode() {
|
fun testDceDevMode() {
|
||||||
val project = Project("kotlin2JsDceProject", "2.10", minLogLevel = LogLevel.INFO)
|
val project = Project("kotlin2JsDceProject", minLogLevel = LogLevel.INFO)
|
||||||
|
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
File(project.projectDir, "mainProject/build.gradle").modify {
|
File(project.projectDir, "mainProject/build.gradle").modify {
|
||||||
@@ -279,7 +279,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDceFileCollectionDependency() {
|
fun testDceFileCollectionDependency() {
|
||||||
val project = Project("kotlin2JsDceProject", "2.10", minLogLevel = LogLevel.INFO)
|
val project = Project("kotlin2JsDceProject", minLogLevel = LogLevel.INFO)
|
||||||
|
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
File(project.projectDir, "mainProject/build.gradle").modify {
|
File(project.projectDir, "mainProject/build.gradle").modify {
|
||||||
@@ -301,7 +301,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
/** Issue: KT-18495 */
|
/** Issue: KT-18495 */
|
||||||
@Test
|
@Test
|
||||||
fun testNoSeparateClassesDirWarning() {
|
fun testNoSeparateClassesDirWarning() {
|
||||||
val project = Project("kotlin2JsProject", GradleVersionAtLeast("4.0"))
|
val project = Project("kotlin2JsProject", GradleVersionRequired.AtLeast("4.0"))
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertNotContains("this build assumes a single directory for all classes from a source set")
|
assertNotContains("this build assumes a single directory for all classes from a source set")
|
||||||
@@ -309,7 +309,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIncrementalCompilation() = Project("kotlin2JsICProject", GradleVersionAtLeast("4.0")).run {
|
fun testIncrementalCompilation() = Project("kotlin2JsICProject", GradleVersionRequired.AtLeast("4.0")).run {
|
||||||
build("build") {
|
build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains(USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE)
|
assertContains(USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE)
|
||||||
|
|||||||
+2
-5
@@ -25,9 +25,6 @@ import java.io.File
|
|||||||
// todo: test daemon start (does not start every build)
|
// todo: test daemon start (does not start every build)
|
||||||
// todo: test daemon shutdown when gradle daemon dies
|
// todo: test daemon shutdown when gradle daemon dies
|
||||||
class KotlinDaemonIT : BaseGradleIT() {
|
class KotlinDaemonIT : BaseGradleIT() {
|
||||||
companion object {
|
|
||||||
private val GRADLE_VERSION = NoSpecificGradleVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDaemonMultiproject() {
|
fun testDaemonMultiproject() {
|
||||||
@@ -40,7 +37,7 @@ class KotlinDaemonIT : BaseGradleIT() {
|
|||||||
return result.toTypedArray()
|
return result.toTypedArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
val project = Project("multiprojectWithDependency", GRADLE_VERSION)
|
val project = Project("multiprojectWithDependency")
|
||||||
val strategyCLIArg = "-Dkotlin.compiler.execution.strategy=daemon"
|
val strategyCLIArg = "-Dkotlin.compiler.execution.strategy=daemon"
|
||||||
|
|
||||||
fun checkAfterNonIncrementalBuild(output: String) {
|
fun checkAfterNonIncrementalBuild(output: String) {
|
||||||
@@ -78,7 +75,7 @@ class KotlinDaemonIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testClientFileIsDeletedOnExit() {
|
fun testClientFileIsDeletedOnExit() {
|
||||||
val project = Project("kotlinProject", GRADLE_VERSION)
|
val project = Project("kotlinProject")
|
||||||
val options = defaultBuildOptions().copy(withDaemon = false)
|
val options = defaultBuildOptions().copy(withDaemon = false)
|
||||||
|
|
||||||
project.build("assemble", options = options) {
|
project.build("assemble", options = options) {
|
||||||
|
|||||||
+36
-36
@@ -32,7 +32,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCrossCompile() {
|
fun testCrossCompile() {
|
||||||
val project = Project("kotlinJavaProject", NoSpecificGradleVersion)
|
val project = Project("kotlinJavaProject")
|
||||||
|
|
||||||
project.build("compileDeployKotlin", "build") {
|
project.build("compileDeployKotlin", "build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -51,7 +51,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
val wd0 = workingDir
|
val wd0 = workingDir
|
||||||
val wd1 = File(wd0, "subdir").apply { mkdirs() }
|
val wd1 = File(wd0, "subdir").apply { mkdirs() }
|
||||||
workingDir = wd1
|
workingDir = wd1
|
||||||
val project1 = Project("kotlinJavaProject", NoSpecificGradleVersion)
|
val project1 = Project("kotlinJavaProject")
|
||||||
|
|
||||||
project1.build("assemble") {
|
project1.build("assemble") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -71,7 +71,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinOnlyCompile() {
|
fun testKotlinOnlyCompile() {
|
||||||
val project = Project("kotlinProject", NoSpecificGradleVersion)
|
val project = Project("kotlinProject")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -92,7 +92,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
// In order to stop daemon process, special exit task is used ( System.exit(0) ).
|
// In order to stop daemon process, special exit task is used ( System.exit(0) ).
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinOnlyDaemonMemory() {
|
fun testKotlinOnlyDaemonMemory() {
|
||||||
val project = Project("kotlinProject", NoSpecificGradleVersion)
|
val project = Project("kotlinProject")
|
||||||
val VARIANT_CONSTANT = "ForTest"
|
val VARIANT_CONSTANT = "ForTest"
|
||||||
val userVariantArg = "-Duser.variant=$VARIANT_CONSTANT"
|
val userVariantArg = "-Duser.variant=$VARIANT_CONSTANT"
|
||||||
val MEMORY_MAX_GROWTH_LIMIT_KB = 500
|
val MEMORY_MAX_GROWTH_LIMIT_KB = 500
|
||||||
@@ -146,12 +146,12 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testLogLevelForceGC() {
|
fun testLogLevelForceGC() {
|
||||||
val debugProject = Project("simpleProject", NoSpecificGradleVersion, minLogLevel = LogLevel.LIFECYCLE)
|
val debugProject = Project("simpleProject", minLogLevel = LogLevel.LIFECYCLE)
|
||||||
debugProject.build("build", "-Dkotlin.gradle.test.report.memory.usage=true") {
|
debugProject.build("build", "-Dkotlin.gradle.test.report.memory.usage=true") {
|
||||||
assertContains("Forcing System.gc()")
|
assertContains("Forcing System.gc()")
|
||||||
}
|
}
|
||||||
|
|
||||||
val infoProject = Project("simpleProject", NoSpecificGradleVersion, minLogLevel = LogLevel.QUIET)
|
val infoProject = Project("simpleProject", minLogLevel = LogLevel.QUIET)
|
||||||
infoProject.build("clean", "build", "-Dkotlin.gradle.test.report.memory.usage=true") {
|
infoProject.build("clean", "build", "-Dkotlin.gradle.test.report.memory.usage=true") {
|
||||||
assertNotContains("Forcing System.gc()")
|
assertNotContains("Forcing System.gc()")
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinClasspath() {
|
fun testKotlinClasspath() {
|
||||||
Project("classpathTest", NoSpecificGradleVersion).build("build") {
|
Project("classpathTest").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertReportExists()
|
assertReportExists()
|
||||||
assertContains(":compileKotlin", ":compileTestKotlin")
|
assertContains(":compileKotlin", ":compileTestKotlin")
|
||||||
@@ -168,7 +168,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testMultiprojectPluginClasspath() {
|
fun testMultiprojectPluginClasspath() {
|
||||||
Project("multiprojectClassPathTest", NoSpecificGradleVersion).build("build") {
|
Project("multiprojectClassPathTest").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertReportExists("subproject")
|
assertReportExists("subproject")
|
||||||
assertContains(":subproject:compileKotlin", ":subproject:compileTestKotlin")
|
assertContains(":subproject:compileKotlin", ":subproject:compileTestKotlin")
|
||||||
@@ -178,7 +178,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIncremental() {
|
fun testIncremental() {
|
||||||
val project = Project("kotlinProject", NoSpecificGradleVersion)
|
val project = Project("kotlinProject")
|
||||||
val options = defaultBuildOptions().copy(incremental = true)
|
val options = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", options = options) {
|
project.build("build", options = options) {
|
||||||
@@ -209,7 +209,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
val incremental = defaultBuildOptions().copy(incremental = true)
|
val incremental = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
Project("multiprojectWithDependency", NoSpecificGradleVersion).build("assemble", options = incremental) {
|
Project("multiprojectWithDependency").build("assemble", options = incremental) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertReportExists("projA")
|
assertReportExists("projA")
|
||||||
assertContains(":projA:compileKotlin")
|
assertContains(":projA:compileKotlin")
|
||||||
@@ -218,7 +218,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
assertContains(":projB:compileKotlin")
|
assertContains(":projB:compileKotlin")
|
||||||
assertNotContains("projB:compileKotlin UP-TO-DATE")
|
assertNotContains("projB:compileKotlin UP-TO-DATE")
|
||||||
}
|
}
|
||||||
Project("multiprojectWithDependency", NoSpecificGradleVersion).modify {
|
Project("multiprojectWithDependency").modify {
|
||||||
val oldSrc = File(this.projectDir, "projA/src/main/kotlin/a.kt")
|
val oldSrc = File(this.projectDir, "projA/src/main/kotlin/a.kt")
|
||||||
val newSrc = File(this.projectDir, "projA/src/main/kotlin/a.kt.new")
|
val newSrc = File(this.projectDir, "projA/src/main/kotlin/a.kt.new")
|
||||||
assertTrue { oldSrc.exists() }
|
assertTrue { oldSrc.exists() }
|
||||||
@@ -237,7 +237,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinInJavaRoot() {
|
fun testKotlinInJavaRoot() {
|
||||||
Project("kotlinInJavaRoot", NoSpecificGradleVersion).build("build") {
|
Project("kotlinInJavaRoot").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertReportExists()
|
assertReportExists()
|
||||||
assertContains(":compileKotlin", ":compileTestKotlin")
|
assertContains(":compileKotlin", ":compileTestKotlin")
|
||||||
@@ -246,7 +246,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIncrementalPropertyFromLocalPropertiesFile() {
|
fun testIncrementalPropertyFromLocalPropertiesFile() {
|
||||||
val project = Project("kotlinProject", NoSpecificGradleVersion)
|
val project = Project("kotlinProject")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
val localPropertyFile = File(project.projectDir, "local.properties")
|
val localPropertyFile = File(project.projectDir, "local.properties")
|
||||||
@@ -259,12 +259,12 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIncrementalCompilationLogLevel() {
|
fun testIncrementalCompilationLogLevel() {
|
||||||
val infoProject = Project("kotlinProject", NoSpecificGradleVersion, minLogLevel = LogLevel.INFO)
|
val infoProject = Project("kotlinProject", minLogLevel = LogLevel.INFO)
|
||||||
infoProject.build("build") {
|
infoProject.build("build") {
|
||||||
assertContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
|
assertContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
val lifecycleProject = Project("kotlinProject", NoSpecificGradleVersion, minLogLevel = LogLevel.LIFECYCLE)
|
val lifecycleProject = Project("kotlinProject", minLogLevel = LogLevel.LIFECYCLE)
|
||||||
lifecycleProject.build("build") {
|
lifecycleProject.build("build") {
|
||||||
assertNotContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
|
assertNotContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testConvertJavaToKotlin() {
|
fun testConvertJavaToKotlin() {
|
||||||
val project = Project("convertBetweenJavaAndKotlin", NoSpecificGradleVersion)
|
val project = Project("convertBetweenJavaAndKotlin")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
val barKt = project.projectDir.getFileByName("Bar.kt")
|
val barKt = project.projectDir.getFileByName("Bar.kt")
|
||||||
@@ -299,7 +299,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testWipeClassesDirectoryBetweenBuilds() {
|
fun testWipeClassesDirectoryBetweenBuilds() {
|
||||||
val project = Project("kotlinJavaProject", SpecificGradleVersion("3.5"))
|
val project = Project("kotlinJavaProject", GradleVersionRequired.Exact("3.5"))
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -317,7 +317,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testMoveClassToOtherModule() {
|
fun testMoveClassToOtherModule() {
|
||||||
val project = Project("moveClassToOtherModule", NoSpecificGradleVersion)
|
val project = Project("moveClassToOtherModule")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -333,7 +333,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testTypeAliasIncremental() {
|
fun testTypeAliasIncremental() {
|
||||||
val project = Project("typeAlias", NoSpecificGradleVersion)
|
val project = Project("typeAlias")
|
||||||
val options = defaultBuildOptions().copy(incremental = true)
|
val options = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", options = options) {
|
project.build("build", options = options) {
|
||||||
@@ -355,7 +355,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinBuiltins() {
|
fun testKotlinBuiltins() {
|
||||||
val project = Project("kotlinBuiltins", GradleVersionAtLeast("4.0"))
|
val project = Project("kotlinBuiltins", GradleVersionRequired.AtLeast("4.0"))
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -364,7 +364,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCustomCompilerFile() {
|
fun testCustomCompilerFile() {
|
||||||
val project = Project("customCompilerFile", NoSpecificGradleVersion)
|
val project = Project("customCompilerFile")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
// copy compiler embeddable to project dir using custom name
|
// copy compiler embeddable to project dir using custom name
|
||||||
@@ -381,7 +381,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFreeCompilerArgs() {
|
fun testFreeCompilerArgs() {
|
||||||
val project = Project("kotlinProject", NoSpecificGradleVersion)
|
val project = Project("kotlinProject")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
val customModuleName = "custom_module_name"
|
val customModuleName = "custom_module_name"
|
||||||
@@ -401,7 +401,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testChangeDestinationDir() {
|
fun testChangeDestinationDir() {
|
||||||
val project = Project("kotlinProject", SpecificGradleVersion("3.5"))
|
val project = Project("kotlinProject", GradleVersionRequired.Exact("3.5"))
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
val fileToRemove = File(project.projectDir, "src/main/kotlin/removeMe.kt")
|
val fileToRemove = File(project.projectDir, "src/main/kotlin/removeMe.kt")
|
||||||
@@ -437,7 +437,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDowngradeTo106() {
|
fun testDowngradeTo106() {
|
||||||
val project = Project("kotlinProject", NoSpecificGradleVersion)
|
val project = Project("kotlinProject")
|
||||||
val options = defaultBuildOptions().copy(incremental = true, withDaemon = false)
|
val options = defaultBuildOptions().copy(incremental = true, withDaemon = false)
|
||||||
|
|
||||||
project.build("assemble", options = options) {
|
project.build("assemble", options = options) {
|
||||||
@@ -451,7 +451,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testOmittedStdlibVersion() {
|
fun testOmittedStdlibVersion() {
|
||||||
val project = Project("kotlinProject", GradleVersionAtLeast("4.4"))
|
val project = Project("kotlinProject", GradleVersionRequired.AtLeast("4.4"))
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
File(project.projectDir, "build.gradle").modify {
|
File(project.projectDir, "build.gradle").modify {
|
||||||
it.replace("kotlin-stdlib:\$kotlin_version", "kotlin-stdlib").apply { check(!equals(it)) } + "\n" + """
|
it.replace("kotlin-stdlib:\$kotlin_version", "kotlin-stdlib").apply { check(!equals(it)) } + "\n" + """
|
||||||
@@ -472,7 +472,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCleanAfterIncrementalBuild() {
|
fun testCleanAfterIncrementalBuild() {
|
||||||
val project = Project("kotlinProject", NoSpecificGradleVersion)
|
val project = Project("kotlinProject")
|
||||||
val options = defaultBuildOptions().copy(incremental = true)
|
val options = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", "clean", options = options) {
|
project.build("build", "clean", options = options) {
|
||||||
@@ -482,7 +482,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIncrementalTestCompile() {
|
fun testIncrementalTestCompile() {
|
||||||
val project = Project("kotlinProject", NoSpecificGradleVersion)
|
val project = Project("kotlinProject")
|
||||||
val options = defaultBuildOptions().copy(incremental = true)
|
val options = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", options = options) {
|
project.build("build", options = options) {
|
||||||
@@ -503,7 +503,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testLanguageVersionApiVersionExplicit() {
|
fun testLanguageVersionApiVersionExplicit() {
|
||||||
val project = Project("kotlinProject", NoSpecificGradleVersion)
|
val project = Project("kotlinProject")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
val buildGradle = File(project.projectDir, "build.gradle")
|
val buildGradle = File(project.projectDir, "build.gradle")
|
||||||
@@ -552,7 +552,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSeparateOutputGradle40() {
|
fun testSeparateOutputGradle40() {
|
||||||
val project = Project("kotlinJavaProject", GradleVersionAtLeast("4.0"))
|
val project = Project("kotlinJavaProject", GradleVersionRequired.AtLeast("4.0"))
|
||||||
project.build("compileDeployKotlin", "assemble") {
|
project.build("compileDeployKotlin", "assemble") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
@@ -575,7 +575,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testArchiveBaseNameForModuleName() {
|
fun testArchiveBaseNameForModuleName() {
|
||||||
val project = Project("simpleProject", NoSpecificGradleVersion)
|
val project = Project("simpleProject")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
val archivesBaseName = "myArchivesBaseName"
|
val archivesBaseName = "myArchivesBaseName"
|
||||||
@@ -599,7 +599,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testJavaPackagePrefix() {
|
fun testJavaPackagePrefix() {
|
||||||
val project = Project("javaPackagePrefix", NoSpecificGradleVersion)
|
val project = Project("javaPackagePrefix")
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
@@ -643,7 +643,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
assertNotContains(CopyClassesToJavaOutputStatus.gradleVersionTooLowWarningMessage)
|
assertNotContains(CopyClassesToJavaOutputStatus.gradleVersionTooLowWarningMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
Project("simpleProject", SpecificGradleVersion("4.0")).apply {
|
Project("simpleProject", GradleVersionRequired.Exact("4.0")).apply {
|
||||||
build("build") {
|
build("build") {
|
||||||
check(copyClassesToJavaOutput = false,
|
check(copyClassesToJavaOutput = false,
|
||||||
expectBuildCacheWarning = false,
|
expectBuildCacheWarning = false,
|
||||||
@@ -655,7 +655,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
expectBuildCacheWarning = false,
|
expectBuildCacheWarning = false,
|
||||||
expectGradleLowVersionWarning = false)
|
expectGradleLowVersionWarning = false)
|
||||||
}
|
}
|
||||||
build("clean", "build", "--build-cache") {
|
build("clean", "build", options = defaultBuildOptions().copy(withBuildCache = true)) {
|
||||||
check(copyClassesToJavaOutput = true,
|
check(copyClassesToJavaOutput = true,
|
||||||
expectBuildCacheWarning = true,
|
expectBuildCacheWarning = true,
|
||||||
expectGradleLowVersionWarning = false)
|
expectGradleLowVersionWarning = false)
|
||||||
@@ -663,7 +663,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
projectDir.deleteRecursively()
|
projectDir.deleteRecursively()
|
||||||
}
|
}
|
||||||
|
|
||||||
Project("simpleProject", SpecificGradleVersion("3.4")).apply {
|
Project("simpleProject", GradleVersionRequired.Exact("3.4")).apply {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
File(projectDir, "build.gradle").appendText("\nkotlin.copyClassesToJavaOutput = true")
|
File(projectDir, "build.gradle").appendText("\nkotlin.copyClassesToJavaOutput = true")
|
||||||
build("build") {
|
build("build") {
|
||||||
@@ -676,7 +676,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSrcDirTaskDependency() {
|
fun testSrcDirTaskDependency() {
|
||||||
Project("simpleProject", GradleVersionAtLeast("4.1")).apply {
|
Project("simpleProject", GradleVersionRequired.AtLeast("4.1")).apply {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
File(projectDir, "build.gradle").appendText("""${'\n'}
|
File(projectDir, "build.gradle").appendText("""${'\n'}
|
||||||
task generateSources {
|
task generateSources {
|
||||||
@@ -705,7 +705,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSourceJar() {
|
fun testSourceJar() {
|
||||||
Project("simpleProject", NoSpecificGradleVersion).apply {
|
Project("simpleProject").apply {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
val additionalSrcDir = "src/additional/kotlin/"
|
val additionalSrcDir = "src/additional/kotlin/"
|
||||||
|
|
||||||
|
|||||||
+5
-9
@@ -19,20 +19,16 @@ package org.jetbrains.kotlin.gradle
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.EXPECTED_BY_CONFIG_NAME
|
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_CONFIG_NAME
|
||||||
import org.jetbrains.kotlin.gradle.plugin.IMPLEMENT_DEPRECATION_WARNING
|
import org.jetbrains.kotlin.gradle.plugin.IMPLEMENT_DEPRECATION_WARNING
|
||||||
import org.jetbrains.kotlin.gradle.util.allKotlinFiles
|
|
||||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||||
import org.jetbrains.kotlin.gradle.util.modify
|
import org.jetbrains.kotlin.gradle.util.modify
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class MultiplatformGradleIT : BaseGradleIT() {
|
class MultiplatformGradleIT : BaseGradleIT() {
|
||||||
companion object {
|
|
||||||
private val GRADLE_VERSION = NoSpecificGradleVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testMultiplatformCompile() {
|
fun testMultiplatformCompile() {
|
||||||
val project = Project("multiplatformProject", GradleVersionAtLeast("4.0"))
|
val project = Project("multiplatformProject", GradleVersionRequired.AtLeast("4.0"))
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -53,7 +49,7 @@ class MultiplatformGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDeprecatedImplementWarning() {
|
fun testDeprecatedImplementWarning() {
|
||||||
val project = Project("multiplatformProject", GRADLE_VERSION)
|
val project = Project("multiplatformProject")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -72,7 +68,7 @@ class MultiplatformGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCommonKotlinOptions() {
|
fun testCommonKotlinOptions() {
|
||||||
with(Project("multiplatformProject", GRADLE_VERSION)) {
|
with(Project("multiplatformProject")) {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
|
|
||||||
File(projectDir, "lib/build.gradle").appendText(
|
File(projectDir, "lib/build.gradle").appendText(
|
||||||
@@ -89,7 +85,7 @@ class MultiplatformGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSubprojectWithAnotherClassLoader() {
|
fun testSubprojectWithAnotherClassLoader() {
|
||||||
with(Project("multiplatformProject", GradleVersionAtLeast("4.0"))) {
|
with(Project("multiplatformProject", GradleVersionRequired.AtLeast("4.0"))) {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
|
|
||||||
// Make sure there is a plugin applied with the plugins DSL, so that Gradle loads the
|
// Make sure there is a plugin applied with the plugins DSL, so that Gradle loads the
|
||||||
@@ -126,7 +122,7 @@ class MultiplatformGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
// todo: also make incremental compilation test
|
// todo: also make incremental compilation test
|
||||||
@Test
|
@Test
|
||||||
fun testIncrementalBuild(): Unit = Project("multiplatformProject", GRADLE_VERSION).run {
|
fun testIncrementalBuild(): Unit = Project("multiplatformProject").run {
|
||||||
val compileCommonTask = ":lib:compileKotlinCommon"
|
val compileCommonTask = ":lib:compileKotlinCommon"
|
||||||
val compileJsTask = ":libJs:compileKotlin2Js"
|
val compileJsTask = ":libJs:compileKotlin2Js"
|
||||||
val compileJvmTask = ":libJvm:compileKotlin"
|
val compileJvmTask = ":libJvm:compileKotlin"
|
||||||
|
|||||||
+5
-5
@@ -50,7 +50,7 @@ class PluginsDslIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val GRADLE_VERSION = GradleVersionAtLeast("4.0")
|
private val GRADLE_VERSION = GradleVersionRequired.AtLeast("4.0")
|
||||||
private const val DIRECTORY_PREFIX = "pluginsDsl"
|
private const val DIRECTORY_PREFIX = "pluginsDsl"
|
||||||
|
|
||||||
private const val MAVEN_LOCAL_URL_PLACEHOLDER = "<mavenLocalUrl>"
|
private const val MAVEN_LOCAL_URL_PLACEHOLDER = "<mavenLocalUrl>"
|
||||||
@@ -61,10 +61,10 @@ class PluginsDslIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun projectWithMavenLocalPlugins(
|
private fun projectWithMavenLocalPlugins(
|
||||||
projectName: String,
|
projectName: String,
|
||||||
wrapperVersion: GradleVersionRequirement = GRADLE_VERSION,
|
wrapperVersion: GradleVersionRequired = GRADLE_VERSION,
|
||||||
directoryPrefix: String? = DIRECTORY_PREFIX,
|
directoryPrefix: String? = DIRECTORY_PREFIX,
|
||||||
minLogLevel: LogLevel = LogLevel.DEBUG
|
minLogLevel: LogLevel = LogLevel.DEBUG
|
||||||
): Project {
|
): Project {
|
||||||
|
|
||||||
val result = Project(projectName, wrapperVersion, directoryPrefix, minLogLevel)
|
val result = Project(projectName, wrapperVersion, directoryPrefix, minLogLevel)
|
||||||
|
|||||||
+15
-19
@@ -8,13 +8,9 @@ import kotlin.test.assertTrue
|
|||||||
|
|
||||||
class SimpleKotlinGradleIT : BaseGradleIT() {
|
class SimpleKotlinGradleIT : BaseGradleIT() {
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val GRADLE_VERSION = NoSpecificGradleVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSimpleCompile() {
|
fun testSimpleCompile() {
|
||||||
val project = Project("simpleProject", GRADLE_VERSION)
|
val project = Project("simpleProject")
|
||||||
|
|
||||||
project.build("compileDeployKotlin", "build") {
|
project.build("compileDeployKotlin", "build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -34,7 +30,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSuppressWarnings() {
|
fun testSuppressWarnings() {
|
||||||
val project = Project("suppressWarnings", GRADLE_VERSION)
|
val project = Project("suppressWarnings")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -45,28 +41,28 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinCustomDirectory() {
|
fun testKotlinCustomDirectory() {
|
||||||
Project("customSrcDir", GRADLE_VERSION).build("build") {
|
Project("customSrcDir").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinExtraJavaSrc() {
|
fun testKotlinExtraJavaSrc() {
|
||||||
Project("additionalJavaSrc", GRADLE_VERSION).build("build") {
|
Project("additionalJavaSrc").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testLanguageVersion() {
|
fun testLanguageVersion() {
|
||||||
Project("languageVersion", GRADLE_VERSION).build("build") {
|
Project("languageVersion").build("build") {
|
||||||
assertFailed()
|
assertFailed()
|
||||||
assertContains("This type is sealed")
|
assertContains("This type is sealed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
fun testJvmTarget() {
|
fun testJvmTarget() {
|
||||||
Project("jvmTarget", GRADLE_VERSION).build("build") {
|
Project("jvmTarget").build("build") {
|
||||||
assertFailed()
|
assertFailed()
|
||||||
assertContains("Unknown JVM target version: 1.7")
|
assertContains("Unknown JVM target version: 1.7")
|
||||||
}
|
}
|
||||||
@@ -74,7 +70,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCustomJdk() {
|
fun testCustomJdk() {
|
||||||
Project("customJdk", GRADLE_VERSION).build("build") {
|
Project("customJdk").build("build") {
|
||||||
assertFailed()
|
assertFailed()
|
||||||
assertContains("Unresolved reference: stream")
|
assertContains("Unresolved reference: stream")
|
||||||
assertNotContains("AutoCloseable")
|
assertNotContains("AutoCloseable")
|
||||||
@@ -83,7 +79,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testGradleSubplugin() {
|
fun testGradleSubplugin() {
|
||||||
val project = Project("kotlinGradleSubplugin", GRADLE_VERSION)
|
val project = Project("kotlinGradleSubplugin")
|
||||||
|
|
||||||
project.build("compileKotlin", "build") {
|
project.build("compileKotlin", "build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -102,7 +98,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDestinationDirReferencedDuringEvaluation() {
|
fun testDestinationDirReferencedDuringEvaluation() {
|
||||||
Project("destinationDirReferencedDuringEvaluation", GRADLE_VERSION).build("build") {
|
Project("destinationDirReferencedDuringEvaluation").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains("GreeterTest PASSED")
|
assertContains("GreeterTest PASSED")
|
||||||
}
|
}
|
||||||
@@ -110,7 +106,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAllOpenPlugin() {
|
fun testAllOpenPlugin() {
|
||||||
Project("allOpenSimple", GRADLE_VERSION).build("build") {
|
Project("allOpenSimple").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
val classesDir = File(project.projectDir, kotlinClassesDir())
|
val classesDir = File(project.projectDir, kotlinClassesDir())
|
||||||
@@ -131,7 +127,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinSpringPlugin() {
|
fun testKotlinSpringPlugin() {
|
||||||
Project("allOpenSpring", GRADLE_VERSION).build("build") {
|
Project("allOpenSpring").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
val classesDir = File(project.projectDir, kotlinClassesDir())
|
val classesDir = File(project.projectDir, kotlinClassesDir())
|
||||||
@@ -152,7 +148,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinJpaPlugin() {
|
fun testKotlinJpaPlugin() {
|
||||||
Project("noArgJpa", GRADLE_VERSION).build("build") {
|
Project("noArgJpa").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
val classesDir = File(project.projectDir, kotlinClassesDir())
|
val classesDir = File(project.projectDir, kotlinClassesDir())
|
||||||
@@ -170,21 +166,21 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testNoArgKt18668() {
|
fun testNoArgKt18668() {
|
||||||
Project("noArgKt18668", GRADLE_VERSION).build("build") {
|
Project("noArgKt18668").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSamWithReceiverSimple() {
|
fun testSamWithReceiverSimple() {
|
||||||
Project("samWithReceiverSimple", GRADLE_VERSION).build("build") {
|
Project("samWithReceiverSimple").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testBuildDirLazyEvaluation() {
|
fun testBuildDirLazyEvaluation() {
|
||||||
val project = Project("kotlinProject", GRADLE_VERSION)
|
val project = Project("kotlinProject")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
// Change the build directory in the end of the build script:
|
// Change the build directory in the end of the build script:
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,7 @@ import org.junit.Test
|
|||||||
class TestRootAffectedIT : BaseGradleIT() {
|
class TestRootAffectedIT : BaseGradleIT() {
|
||||||
@Test
|
@Test
|
||||||
fun testSourceRootClassIsModifiedIC() {
|
fun testSourceRootClassIsModifiedIC() {
|
||||||
val project = Project("kotlinProject", GradleVersionAtLeast("4.1"))
|
val project = Project("kotlinProject", GradleVersionRequired.AtLeast("4.1"))
|
||||||
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", options = buildOptions) {
|
project.build("build", options = buildOptions) {
|
||||||
@@ -37,7 +37,7 @@ class TestRootAffectedIT : BaseGradleIT() {
|
|||||||
@Test
|
@Test
|
||||||
fun testSourceRootClassIsRemovedIC() {
|
fun testSourceRootClassIsRemovedIC() {
|
||||||
// todo: update Gradle after https://github.com/gradle/gradle/issues/3051 is resolved
|
// todo: update Gradle after https://github.com/gradle/gradle/issues/3051 is resolved
|
||||||
val project = Project("kotlinProject", SpecificGradleVersion("3.0"))
|
val project = Project("kotlinProject", GradleVersionRequired.Exact("3.0"))
|
||||||
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", options = buildOptions) {
|
project.build("build", options = buildOptions) {
|
||||||
@@ -55,7 +55,7 @@ class TestRootAffectedIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testTestRootClassIsRemovedIC() {
|
fun testTestRootClassIsRemovedIC() {
|
||||||
val project = Project("kotlinProject", GradleVersionAtLeast("4.1"))
|
val project = Project("kotlinProject", GradleVersionRequired.AtLeast("4.1"))
|
||||||
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", options = buildOptions) {
|
project.build("build", options = buildOptions) {
|
||||||
|
|||||||
+9
-2
@@ -1,5 +1,6 @@
|
|||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
|
import org.gradle.util.GradleVersion
|
||||||
import org.jetbrains.kotlin.gradle.util.modify
|
import org.jetbrains.kotlin.gradle.util.modify
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import org.junit.Assume
|
import org.junit.Assume
|
||||||
@@ -32,7 +33,7 @@ class UpToDateIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun testMutations(vararg mutations: ProjectMutation) {
|
private fun testMutations(vararg mutations: ProjectMutation) {
|
||||||
val project = Project("simpleProject", GradleVersionAtLeast("4.0"))
|
val project = Project("simpleProject")
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
mutations.forEach {
|
mutations.forEach {
|
||||||
it.initProject(project)
|
it.initProject(project)
|
||||||
@@ -119,7 +120,13 @@ class UpToDateIT : BaseGradleIT() {
|
|||||||
lateinit var helloWorldKtClass: File
|
lateinit var helloWorldKtClass: File
|
||||||
|
|
||||||
override fun mutateProject(project: Project) = with(project) {
|
override fun mutateProject(project: Project) = with(project) {
|
||||||
helloWorldKtClass = File(projectDir, project.classesDir() + "demo/KotlinGreetingJoiner.class")
|
val kotlinOutputPath =
|
||||||
|
if (GradleVersion.version(project.chooseWrapperVersionOrFinishTest()) >= GradleVersion.version("4.0"))
|
||||||
|
project.classesDir() else
|
||||||
|
// Before 4.0, we should delete the classes from the temporary dir to make compileKotlin rerun:
|
||||||
|
"build/kotlin-classes/main/"
|
||||||
|
|
||||||
|
helloWorldKtClass = File(projectDir, kotlinOutputPath + "demo/KotlinGreetingJoiner.class")
|
||||||
Assume.assumeTrue(helloWorldKtClass.exists())
|
Assume.assumeTrue(helloWorldKtClass.exists())
|
||||||
helloWorldKtClass.delete(); Unit
|
helloWorldKtClass.delete(); Unit
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -2,7 +2,7 @@ package org.jetbrains.kotlin.jps
|
|||||||
|
|
||||||
import org.gradle.api.logging.LogLevel
|
import org.gradle.api.logging.LogLevel
|
||||||
import org.jetbrains.kotlin.gradle.BaseGradleIT
|
import org.jetbrains.kotlin.gradle.BaseGradleIT
|
||||||
import org.jetbrains.kotlin.gradle.SpecificGradleVersion
|
import org.jetbrains.kotlin.gradle.GradleVersionRequired
|
||||||
import org.jetbrains.kotlin.incremental.BuildStep
|
import org.jetbrains.kotlin.incremental.BuildStep
|
||||||
import org.jetbrains.kotlin.incremental.parseTestBuildLog
|
import org.jetbrains.kotlin.incremental.parseTestBuildLog
|
||||||
import org.jetbrains.kotlin.incremental.testingUtils.*
|
import org.jetbrains.kotlin.incremental.testingUtils.*
|
||||||
@@ -16,9 +16,8 @@ abstract class BaseIncrementalGradleIT : BaseGradleIT() {
|
|||||||
val buildLogFinder: BuildLogFinder,
|
val buildLogFinder: BuildLogFinder,
|
||||||
val resourcesBase: File,
|
val resourcesBase: File,
|
||||||
val relPath: String,
|
val relPath: String,
|
||||||
wrapperVersion: String = "2.10",
|
|
||||||
minLogLevel: LogLevel = LogLevel.DEBUG
|
minLogLevel: LogLevel = LogLevel.DEBUG
|
||||||
) : Project(File(relPath).name, SpecificGradleVersion(wrapperVersion), null, minLogLevel) {
|
) : Project(File(relPath).name, GradleVersionRequired.Exact("2.10"), null, minLogLevel) {
|
||||||
|
|
||||||
override val resourcesRoot = File(resourcesBase, relPath)
|
override val resourcesRoot = File(resourcesBase, relPath)
|
||||||
val mapWorkingToOriginalFile = hashMapOf<File, File>()
|
val mapWorkingToOriginalFile = hashMapOf<File, File>()
|
||||||
|
|||||||
Reference in New Issue
Block a user