simple test on dependent module recompilation
KT-8487
This commit is contained in:
committed by
Alexey Tsvetkov
parent
1f83745862
commit
42cbd940c3
+37
@@ -3,6 +3,8 @@ package org.jetbrains.kotlin.gradle
|
|||||||
import org.gradle.api.logging.LogLevel
|
import org.gradle.api.logging.LogLevel
|
||||||
import org.jetbrains.kotlin.gradle.plugin.CleanUpBuildListener
|
import org.jetbrains.kotlin.gradle.plugin.CleanUpBuildListener
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import java.io.File
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class KotlinGradleIT: BaseGradleIT() {
|
class KotlinGradleIT: BaseGradleIT() {
|
||||||
|
|
||||||
@@ -123,6 +125,41 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testSimpleMultiprojectIncremental() {
|
||||||
|
|
||||||
|
fun Project.modify(body: Project.() -> Unit): Project {
|
||||||
|
this.body()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
Project("multiprojectWithDependency", "1.6").build("-PincrementalOption=true", "assemble") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertReportExists("projA")
|
||||||
|
assertContains(":projA:compileKotlin")
|
||||||
|
assertNotContains("projA:compileKotlin UP-TO-DATE")
|
||||||
|
assertReportExists("projB")
|
||||||
|
assertContains(":projB:compileKotlin")
|
||||||
|
assertNotContains("projB:compileKotlin UP-TO-DATE")
|
||||||
|
}
|
||||||
|
Project("multiprojectWithDependency", "1.6").modify {
|
||||||
|
val oldSrc = File(this.projectDir, "projA/src/main/kotlin/a.kt")
|
||||||
|
val newSrc = File(this.projectDir, "projA/src/main/kotlin/a.kt.new")
|
||||||
|
assertTrue { oldSrc.exists() }
|
||||||
|
assertTrue { newSrc.exists() }
|
||||||
|
newSrc.copyTo(oldSrc, overwrite = true)
|
||||||
|
}.build("-PincrementalOption=true", "assemble") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertReportExists("projA")
|
||||||
|
assertContains(":projA:compileKotlin")
|
||||||
|
assertContains("[KOTLIN] is incremental == true")
|
||||||
|
assertNotContains("projA:compileKotlin UP-TO-DATE")
|
||||||
|
assertReportExists("projB")
|
||||||
|
assertContains(":projB:compileKotlin")
|
||||||
|
assertNotContains("projB:compileKotlin UP-TO-DATE")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinInJavaRoot() {
|
fun testKotlinInJavaRoot() {
|
||||||
Project("kotlinInJavaRoot", "1.6").build("build") {
|
Project("kotlinInJavaRoot", "1.6").build("build") {
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
url 'file://' + pathToKotlinPlugin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.1-SNAPSHOT'
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
apply plugin: "kotlin"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
url 'file://' + pathToKotlinPlugin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileKotlin {
|
||||||
|
experimentalIncremental = incrementalOption
|
||||||
|
}
|
||||||
|
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package projA
|
||||||
|
|
||||||
|
fun getInfo(): String = "s1"
|
||||||
|
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package projA
|
||||||
|
|
||||||
|
fun getInfo(): String = "s1_changed"
|
||||||
|
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
apply plugin: "kotlin"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
url 'file://' + pathToKotlinPlugin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile project(':projA')
|
||||||
|
}
|
||||||
|
|
||||||
|
compileKotlin {
|
||||||
|
experimentalIncremental = incrementalOption
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package projB
|
||||||
|
|
||||||
|
fun main(vararg args: String) {
|
||||||
|
System.out.println(projA.getInfo())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
include 'projA'
|
||||||
|
include 'projB'
|
||||||
Reference in New Issue
Block a user