Merge branch 'master' into KT-18765
This commit is contained in:
@@ -26,6 +26,37 @@ dependencies {
|
||||
testCompile 'org.jetbrains.kotlin:gradle-api:2.2'
|
||||
}
|
||||
|
||||
test.dependsOn(":kotlin-allopen:install",
|
||||
":kotlin-android-extensions:install",
|
||||
":kotlin-build-common:install",
|
||||
":kotlin-compiler-embeddable:install",
|
||||
":kotlin-gradle-plugin:install",
|
||||
":kotlin-reflect:install",
|
||||
":kotlin-test:kotlin-test-jvm:install",
|
||||
":kotlin-gradle-subplugin-example:install",
|
||||
":kotlin-stdlib-jre8:install")
|
||||
|
||||
// Validate that all dependencies 'install' tasks are added to 'test' dependencies
|
||||
// Test dependencies are specified as paths to avoid forcing dependency resolution
|
||||
// and also to avoid specifying evaluationDependsOn for each testCompile dependency.
|
||||
gradle.taskGraph.whenReady {
|
||||
def notAddedTestTasks = []
|
||||
def testDependencies = test.dependsOn
|
||||
|
||||
for (dependency in configurations.getByName("testCompile").allDependencies) {
|
||||
if (!(dependency instanceof ProjectDependency)) continue
|
||||
|
||||
def task = dependency.dependencyProject.tasks.findByName("install")
|
||||
if (task != null && !testDependencies.contains(task.path)) {
|
||||
notAddedTestTasks.add("\"${task.path}\"")
|
||||
}
|
||||
}
|
||||
|
||||
if (!notAddedTestTasks.isEmpty()) {
|
||||
throw new GradleException("Add the following tasks to ${test.path} dependencies:\n ${notAddedTestTasks.join(",\n ")}")
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
expand(project.properties)
|
||||
}
|
||||
|
||||
+5
-1
@@ -145,7 +145,8 @@ abstract class BaseGradleIT {
|
||||
val forceOutputToStdout: Boolean = false,
|
||||
val debug: Boolean = false,
|
||||
val freeCommandLineArgs: List<String> = emptyList(),
|
||||
val kotlinVersion: String = KOTLIN_VERSION)
|
||||
val kotlinVersion: String = KOTLIN_VERSION,
|
||||
val kotlinDaemonDebugPort: Int? = null)
|
||||
|
||||
open inner class Project(
|
||||
val projectName: String,
|
||||
@@ -438,6 +439,9 @@ abstract class BaseGradleIT {
|
||||
if (options.debug) {
|
||||
add("-Dorg.gradle.debug=true")
|
||||
}
|
||||
options.kotlinDaemonDebugPort?.let { port ->
|
||||
add("-Dkotlin.daemon.jvm.options=-agentlib:jdwp=transport=dt_socket\\,server=y\\,suspend=y\\,address=$port")
|
||||
}
|
||||
addAll(options.freeCommandLineArgs)
|
||||
}
|
||||
|
||||
|
||||
+22
-4
@@ -20,10 +20,7 @@ import org.gradle.api.logging.LogLevel
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.gradle.plugin.CopyClassesToJavaOutputStatus
|
||||
import org.jetbrains.kotlin.gradle.tasks.USING_INCREMENTAL_COMPILATION_MESSAGE
|
||||
import org.jetbrains.kotlin.gradle.util.checkBytecodeContains
|
||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||
import org.jetbrains.kotlin.gradle.util.getFilesByNames
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.jetbrains.kotlin.gradle.util.*
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
import java.util.zip.ZipFile
|
||||
@@ -503,6 +500,27 @@ class KotlinGradleIT: BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIncrementalTestCompile() {
|
||||
val project = Project("kotlinProject", GRADLE_VERSION)
|
||||
val options = defaultBuildOptions().copy(incremental = true)
|
||||
|
||||
project.build("build", options = options) {
|
||||
assertSuccessful()
|
||||
}
|
||||
|
||||
val joinerKt = project.projectDir.getFileByName("KotlinGreetingJoiner.kt")
|
||||
joinerKt.modify {
|
||||
it.replace("class KotlinGreetingJoiner", "internal class KotlinGreetingJoiner")
|
||||
}
|
||||
|
||||
project.build("build", options = options) {
|
||||
assertSuccessful()
|
||||
val testJoinerKt = project.projectDir.getFileByName("TestKotlinGreetingJoiner.kt")
|
||||
assertCompiledKotlinSources(project.relativize(joinerKt, testJoinerKt))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLanguageVersionApiVersionExplicit() {
|
||||
val project = Project("kotlinProject", "3.3")
|
||||
|
||||
+6
-21
@@ -1,15 +1,13 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.gradle.util.allKotlinFiles
|
||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class TestRootAffectedIT : BaseGradleIT() {
|
||||
@Test
|
||||
fun testSourceRootClassIsModifiedIC() {
|
||||
val project = Project("kotlinProject", "2.10")
|
||||
val project = Project("kotlinProject", "4.1")
|
||||
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
||||
|
||||
project.build("build", options = buildOptions) {
|
||||
@@ -26,8 +24,8 @@ class TestRootAffectedIT : BaseGradleIT() {
|
||||
|
||||
project.build("build", options = buildOptions) {
|
||||
assertSuccessful()
|
||||
val expectedToCompile = project.relativize(listOf(kotlinGreetingJoinerFile) + project.allTestKotlinFiles())
|
||||
assertCompiledKotlinSources(expectedToCompile)
|
||||
val testKotlinGreetingJoinerFile = project.projectDir.getFileByName("TestKotlinGreetingJoiner.kt")
|
||||
assertCompiledKotlinSources(project.relativize(kotlinGreetingJoinerFile, testKotlinGreetingJoinerFile))
|
||||
}
|
||||
|
||||
project.build("build", options = buildOptions) {
|
||||
@@ -38,7 +36,8 @@ class TestRootAffectedIT : BaseGradleIT() {
|
||||
|
||||
@Test
|
||||
fun testSourceRootClassIsRemovedIC() {
|
||||
val project = Project("kotlinProject", "2.10")
|
||||
// todo: update Gradle after https://github.com/gradle/gradle/issues/3051 is resolved
|
||||
val project = Project("kotlinProject", "3.0")
|
||||
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
||||
|
||||
project.build("build", options = buildOptions) {
|
||||
@@ -48,12 +47,6 @@ class TestRootAffectedIT : BaseGradleIT() {
|
||||
val dummyFile = project.projectDir.getFileByName("Dummy.kt")
|
||||
dummyFile.delete()
|
||||
|
||||
project.build("build", options = buildOptions) {
|
||||
assertSuccessful()
|
||||
val expectedToCompile = project.relativize(project.allTestKotlinFiles())
|
||||
assertCompiledKotlinSources(expectedToCompile)
|
||||
}
|
||||
|
||||
project.build("build", options = buildOptions) {
|
||||
assertSuccessful()
|
||||
assertCompiledKotlinSources(emptyList())
|
||||
@@ -62,7 +55,7 @@ class TestRootAffectedIT : BaseGradleIT() {
|
||||
|
||||
@Test
|
||||
fun testTestRootClassIsRemovedIC() {
|
||||
val project = Project("kotlinProject", "2.10")
|
||||
val project = Project("kotlinProject", "4.1")
|
||||
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
||||
|
||||
project.build("build", options = buildOptions) {
|
||||
@@ -76,13 +69,5 @@ class TestRootAffectedIT : BaseGradleIT() {
|
||||
assertSuccessful()
|
||||
assertCompiledKotlinSources(emptyList())
|
||||
}
|
||||
|
||||
project.build("build", options = buildOptions) {
|
||||
assertSuccessful()
|
||||
assertCompiledKotlinSources(emptyList())
|
||||
}
|
||||
}
|
||||
|
||||
private fun Project.allTestKotlinFiles(): Iterable<File> =
|
||||
File(projectDir, "src/test").allKotlinFiles()
|
||||
}
|
||||
Reference in New Issue
Block a user