Implement logic for classes directories in Gradle IT across versions.
Also add a workaround for console type set in user's gradle.properties.
This commit is contained in:
+25
-1
@@ -375,7 +375,7 @@ abstract class BaseGradleIT {
|
|||||||
|
|
||||||
fun CompiledProject.assertTasksExecuted(tasks: Iterable<String>) {
|
fun CompiledProject.assertTasksExecuted(tasks: Iterable<String>) {
|
||||||
for (task in tasks) {
|
for (task in tasks) {
|
||||||
assertContains("Executing task '$task'")
|
assertContainsRegex("(Executing actions for task|Executing task) '$task'".toRegex())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,6 +440,26 @@ 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") =
|
||||||
|
(subproject?.plus("/") ?: "") + "build/" +
|
||||||
|
(if (GradleVersion.version(chooseWrapperVersionOrFinishTest()) < GradleVersion.version("4.0"))
|
||||||
|
"classes/"
|
||||||
|
else "resources/") +
|
||||||
|
sourceSet + "/"
|
||||||
|
|
||||||
|
fun Project.classesDir(subproject: String? = null, sourceSet: String = "main", language: String = "kotlin") =
|
||||||
|
(subproject?.plus("/") ?: "") + "build/classes/" +
|
||||||
|
(if (GradleVersion.version(chooseWrapperVersionOrFinishTest()) >= GradleVersion.version("4.0"))
|
||||||
|
"$language/"
|
||||||
|
else "") +
|
||||||
|
sourceSet + "/"
|
||||||
|
|
||||||
|
fun CompiledProject.kotlinClassesDir(subproject: String? = null, sourceSet: String = "main") =
|
||||||
|
project.classesDir(subproject, sourceSet, language = "kotlin")
|
||||||
|
|
||||||
|
fun CompiledProject.javaClassesDir(subproject: String? = null, sourceSet: String = "main") =
|
||||||
|
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> =
|
||||||
createGradleCommand(wrapperDir, createGradleTailParameters(options, params))
|
createGradleCommand(wrapperDir, createGradleTailParameters(options, params))
|
||||||
|
|
||||||
@@ -476,6 +496,10 @@ abstract class BaseGradleIT {
|
|||||||
if (options.withBuildCache) {
|
if (options.withBuildCache) {
|
||||||
add("--build-cache")
|
add("--build-cache")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workaround: override a console type set in the user machine gradle.properties (since Gradle 4.3):
|
||||||
|
add("--console=plain")
|
||||||
|
|
||||||
addAll(options.freeCommandLineArgs)
|
addAll(options.freeCommandLineArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -69,6 +69,6 @@ open class ExecutionStrategyIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected open fun CompiledProject.checkOutput() {
|
protected open fun CompiledProject.checkOutput() {
|
||||||
assertFileExists("app/build/classes/kotlin/main/foo/MainKt.class")
|
assertFileExists(kotlinClassesDir(subproject = "app") + "foo/MainKt.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+31
-29
@@ -49,8 +49,9 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
assertContains(":compileKotlin")
|
assertContains(":compileKotlin")
|
||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
val javaClassesDir = javaClassesDir()
|
||||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
assertFileExists(javaClassesDir + "example/TestClass.class")
|
||||||
|
assertFileExists(javaClassesDir + "example/TestClassGenerated.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,11 +65,12 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
assertContains(":compileKotlin")
|
assertContains(":compileKotlin")
|
||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
val javaClassesDir = javaClassesDir()
|
||||||
assertFileExists("build/classes/main/example/SourceAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir + "example/TestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/BinaryAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir + "example/SourceAnnotatedTestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/RuntimeAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir + "example/BinaryAnnotatedTestClassGenerated.class")
|
||||||
|
assertFileExists(javaClassesDir + "example/RuntimeAnnotatedTestClassGenerated.class")
|
||||||
assertContains("example.JavaTest PASSED")
|
assertContains("example.JavaTest PASSED")
|
||||||
assertClassFilesNotContain(File(project.projectDir, "build/classes"), "ExampleSourceAnnotation")
|
assertClassFilesNotContain(File(project.projectDir, "build/classes"), "ExampleSourceAnnotation")
|
||||||
assertNotContains("warning: The following options were not recognized by any processor")
|
assertNotContains("warning: The following options were not recognized by any processor")
|
||||||
@@ -85,14 +87,14 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
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", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||||
val classesDir = File(project.projectDir, "build/classes")
|
val javaClassesDir = File(project.projectDir, project.classesDir(language = "java"))
|
||||||
|
|
||||||
project.build("clean", "build", options = options) {
|
project.build("clean", "build", options = options) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertKaptSuccessful()
|
assertKaptSuccessful()
|
||||||
assertContains(":compileKotlin")
|
assertContains(":compileKotlin")
|
||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertClassFilesNotContain(classesDir, "ExampleSourceAnnotation")
|
assertClassFilesNotContain(javaClassesDir, "ExampleSourceAnnotation")
|
||||||
}
|
}
|
||||||
|
|
||||||
project.projectDir.getFilesByNames("InternalDummy.kt", "test.kt").forEach { it.appendText(" ") }
|
project.projectDir.getFilesByNames("InternalDummy.kt", "test.kt").forEach { it.appendText(" ") }
|
||||||
@@ -101,18 +103,18 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
assertKaptSuccessful()
|
assertKaptSuccessful()
|
||||||
assertContains(":compileKotlin")
|
assertContains(":compileKotlin")
|
||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertClassFilesNotContain(classesDir, "ExampleSourceAnnotation")
|
assertClassFilesNotContain(javaClassesDir, "ExampleSourceAnnotation")
|
||||||
}
|
}
|
||||||
|
|
||||||
// emulating wipe by android plugin's IncrementalSafeguardTask
|
// emulating wipe by android plugin's IncrementalSafeguardTask
|
||||||
classesDir.deleteRecursively()
|
javaClassesDir.deleteRecursively()
|
||||||
project.build("build", options = options) {
|
project.build("build", options = options) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains(":compileKotlin UP-TO-DATE")
|
assertContains(":compileKotlin UP-TO-DATE")
|
||||||
assertContains(":kaptGenerateStubsKotlin UP-TO-DATE")
|
assertContains(":kaptGenerateStubsKotlin UP-TO-DATE")
|
||||||
assertContains(":kaptKotlin UP-TO-DATE")
|
assertContains(":kaptKotlin UP-TO-DATE")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
assertClassFilesNotContain(classesDir, "ExampleSourceAnnotation")
|
assertClassFilesNotContain(javaClassesDir, "ExampleSourceAnnotation")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,8 +138,8 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
"endsWithEquals=a:, withSpace=a b c,")
|
"endsWithEquals=a:, withSpace=a b c,")
|
||||||
assertContains("-Xmaxerrs=500, -Xlint:all=-Xlint:all") // Javac options test
|
assertContains("-Xmaxerrs=500, -Xlint:all=-Xlint:all") // Javac options test
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
assertFileExists("build/classes/main/example/TestClassCustomized.class")
|
assertFileExists(javaClassesDir() + "example/TestClassCustomized.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,8 +150,8 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
assertKaptSuccessful()
|
assertKaptSuccessful()
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/AncestorClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/AncestorClassGenerated.java")
|
||||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/TestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/AncestorClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/AncestorClassGenerated.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,17 +164,17 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
assertKaptSuccessful()
|
assertKaptSuccessful()
|
||||||
assertContains(":compileKotlin")
|
assertContains(":compileKotlin")
|
||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
|
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/SourceAnnotatedTestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/SourceAnnotatedTestClassGenerated.java")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/BinaryAnnotatedTestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/BinaryAnnotatedTestClassGenerated.java")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/RuntimeAnnotatedTestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/RuntimeAnnotatedTestClassGenerated.java")
|
||||||
|
|
||||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/TestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/SourceAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/SourceAnnotatedTestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/BinaryAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/BinaryAnnotatedTestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/RuntimeAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/RuntimeAnnotatedTestClassGenerated.class")
|
||||||
}
|
}
|
||||||
|
|
||||||
val testKt = project.projectDir.getFileByName("test.kt")
|
val testKt = project.projectDir.getFileByName("test.kt")
|
||||||
@@ -182,17 +184,17 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains(":compileKotlin")
|
assertContains(":compileKotlin")
|
||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
|
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/SourceAnnotatedTestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/SourceAnnotatedTestClassGenerated.java")
|
||||||
/*!*/ assertNoSuchFile("build/generated/source/kapt/main/example/BinaryAnnotatedTestClassGenerated.java")
|
/*!*/ assertNoSuchFile("build/generated/source/kapt/main/example/BinaryAnnotatedTestClassGenerated.java")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/RuntimeAnnotatedTestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/RuntimeAnnotatedTestClassGenerated.java")
|
||||||
|
|
||||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/TestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/SourceAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/SourceAnnotatedTestClassGenerated.class")
|
||||||
/*!*/ assertNoSuchFile("build/classes/main/example/BinaryAnnotatedTestClassGenerated.class")
|
/*!*/ assertNoSuchFile(javaClassesDir() + "example/BinaryAnnotatedTestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/RuntimeAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/RuntimeAnnotatedTestClassGenerated.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,8 +298,8 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
assertKaptSuccessful()
|
assertKaptSuccessful()
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
||||||
assertFileExists("build/generated/source/kaptKotlin/main/TestClass.kt")
|
assertFileExists("build/generated/source/kaptKotlin/main/TestClass.kt")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
assertFileExists("build/classes/main/example/TestClassCustomized.class")
|
assertFileExists(javaClassesDir() + "example/TestClassCustomized.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
-19
@@ -24,14 +24,15 @@ class KaptIT: BaseGradleIT() {
|
|||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/TestClassGenerated.class")
|
||||||
assertNoSuchFile("build/classes/main/example/SourceAnnotatedTestClassGenerated.class")
|
assertNoSuchFile(javaClassesDir() + "example/SourceAnnotatedTestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/BinaryAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/BinaryAnnotatedTestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/RuntimeAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/RuntimeAnnotatedTestClassGenerated.class")
|
||||||
assertContains("example.JavaTest PASSED")
|
assertContains("example.JavaTest PASSED")
|
||||||
assertContains("example.KotlinTest PASSED")
|
assertContains("example.KotlinTest PASSED")
|
||||||
assertClassFilesNotContain(File(project.projectDir, "build/classes"), "ExampleSourceAnnotation")
|
assertClassFilesNotContain(File(project.projectDir, kotlinClassesDir()), "ExampleSourceAnnotation")
|
||||||
|
assertClassFilesNotContain(File(project.projectDir, javaClassesDir()), "ExampleSourceAnnotation")
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean build is important
|
// clean build is important
|
||||||
@@ -70,11 +71,11 @@ class KaptIT: BaseGradleIT() {
|
|||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/TestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/SourceAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/SourceAnnotatedTestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/BinaryAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/BinaryAnnotatedTestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/RuntimeAnnotatedTestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/RuntimeAnnotatedTestClassGenerated.class")
|
||||||
assertNotContains("w: Classpath entry points to a non-existent location")
|
assertNotContains("w: Classpath entry points to a non-existent location")
|
||||||
assertContains("example.JavaTest PASSED")
|
assertContains("example.JavaTest PASSED")
|
||||||
}
|
}
|
||||||
@@ -95,8 +96,8 @@ class KaptIT: BaseGradleIT() {
|
|||||||
assertContains("kapt: Using class file stubs")
|
assertContains("kapt: Using class file stubs")
|
||||||
assertContains(":compileKotlin")
|
assertContains(":compileKotlin")
|
||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/TestClassGenerated.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +160,8 @@ class KaptIT: BaseGradleIT() {
|
|||||||
assertContains(":compileJava")
|
assertContains(":compileJava")
|
||||||
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
assertFileExists("build/classes/main/example/TestClassCustomized.class")
|
assertFileExists(javaClassesDir() + "example/TestClassCustomized.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,8 +174,8 @@ class KaptIT: BaseGradleIT() {
|
|||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassGenerated.java")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/AncestorClassGenerated.java")
|
assertFileExists("build/generated/source/kapt/main/example/AncestorClassGenerated.java")
|
||||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/TestClassGenerated.class")
|
||||||
assertFileExists("build/classes/main/example/AncestorClassGenerated.class")
|
assertFileExists(javaClassesDir() + "example/AncestorClassGenerated.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,8 +192,8 @@ class KaptIT: BaseGradleIT() {
|
|||||||
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
||||||
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
assertFileExists("build/generated/source/kapt/main/example/TestClassCustomized.java")
|
||||||
assertFileExists("build/tmp/kapt/main/kotlinGenerated/TestClass.kt")
|
assertFileExists("build/tmp/kapt/main/kotlinGenerated/TestClass.kt")
|
||||||
assertFileExists("build/classes/main/example/TestClass.class")
|
assertFileExists(kotlinClassesDir() + "example/TestClass.class")
|
||||||
assertFileExists("build/classes/main/example/TestClassCustomized.class")
|
assertFileExists(javaClassesDir() + "example/TestClassCustomized.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -103,8 +103,8 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertFileExists("build/classes/main/kotlin2JsNoOutputFileProject.js")
|
assertFileExists(kotlinClassesDir() + "kotlin2JsNoOutputFileProject.js")
|
||||||
assertFileExists("build/classes/test/kotlin2JsNoOutputFileProject_test.js")
|
assertFileExists(kotlinClassesDir(sourceSet = "test") + "kotlin2JsNoOutputFileProject_test.js")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-8
@@ -75,7 +75,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertFileExists("build/classes/main/META-INF/kotlinProject.kotlin_module")
|
assertFileExists(kotlinClassesDir() + "META-INF/kotlinProject.kotlin_module")
|
||||||
assertReportExists()
|
assertReportExists()
|
||||||
assertContains(":compileKotlin", ":compileTestKotlin")
|
assertContains(":compileKotlin", ":compileTestKotlin")
|
||||||
assertNotContains("Forcing System.gc")
|
assertNotContains("Forcing System.gc")
|
||||||
@@ -395,7 +395,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertFileExists("build/classes/main/META-INF/$customModuleName.kotlin_module")
|
assertFileExists(kotlinClassesDir() + "META-INF/$customModuleName.kotlin_module")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,8 +557,8 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
// Check that the Kotlin classes are placed under directories following the guideline:
|
// Check that the Kotlin classes are placed under directories following the guideline:
|
||||||
assertFileExists("build/classes/kotlin/main/demo/KotlinGreetingJoiner.class")
|
assertFileExists(kotlinClassesDir() + "demo/KotlinGreetingJoiner.class")
|
||||||
assertFileExists("build/classes/kotlin/deploy/demo/ExampleSource.class")
|
assertFileExists(kotlinClassesDir(sourceSet = "deploy") + "demo/ExampleSource.class")
|
||||||
|
|
||||||
// Check that the resulting JAR contains the Kotlin classes, without duplicates:
|
// Check that the resulting JAR contains the Kotlin classes, without duplicates:
|
||||||
val jar = ZipFile(fileInWorkingDir("build/libs/${project.projectName}.jar"))
|
val jar = ZipFile(fileInWorkingDir("build/libs/${project.projectName}.jar"))
|
||||||
@@ -592,8 +592,8 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
project.build("build", "compileDeployKotlin") {
|
project.build("build", "compileDeployKotlin") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
// Main source set should have a *.kotlin_module file without '_main'
|
// Main source set should have a *.kotlin_module file without '_main'
|
||||||
assertFileExists("build/classes/kotlin/main/META-INF/$archivesBaseName.kotlin_module")
|
assertFileExists(kotlinClassesDir() + "META-INF/$archivesBaseName.kotlin_module")
|
||||||
assertFileExists("build/classes/kotlin/deploy/META-INF/${archivesBaseName}_deploy.kotlin_module")
|
assertFileExists(kotlinClassesDir(sourceSet = "deploy") + "META-INF/${archivesBaseName}_deploy.kotlin_module")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -612,12 +612,14 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDisableSeparateClassesDirs() {
|
fun testDisableSeparateClassesDirs() {
|
||||||
val separateDirPath = "build/classes/kotlin/main/demo/KotlinGreetingJoiner.class"
|
|
||||||
val singleDirPath = "build/classes/java/main/demo/KotlinGreetingJoiner.class"
|
|
||||||
|
|
||||||
fun CompiledProject.check(copyClassesToJavaOutput: Boolean?,
|
fun CompiledProject.check(copyClassesToJavaOutput: Boolean?,
|
||||||
expectBuildCacheWarning: Boolean,
|
expectBuildCacheWarning: Boolean,
|
||||||
expectGradleLowVersionWarning: Boolean) {
|
expectGradleLowVersionWarning: Boolean) {
|
||||||
|
|
||||||
|
val separateDirPath = kotlinClassesDir() + "demo/KotlinGreetingJoiner.class"
|
||||||
|
val singleDirPath = javaClassesDir() + "demo/KotlinGreetingJoiner.class"
|
||||||
|
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
when (copyClassesToJavaOutput) {
|
when (copyClassesToJavaOutput) {
|
||||||
true -> {
|
true -> {
|
||||||
|
|||||||
+2
-2
@@ -110,7 +110,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
Project("allOpenSimple", GRADLE_VERSION).build("build") {
|
Project("allOpenSimple", GRADLE_VERSION).build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
val classesDir = File(project.projectDir, "build/classes/main")
|
val classesDir = File(project.projectDir, kotlinClassesDir())
|
||||||
val openClass = File(classesDir, "test/OpenClass.class")
|
val openClass = File(classesDir, "test/OpenClass.class")
|
||||||
val closedClass = File(classesDir, "test/ClosedClass.class")
|
val closedClass = File(classesDir, "test/ClosedClass.class")
|
||||||
assertTrue(openClass.exists())
|
assertTrue(openClass.exists())
|
||||||
@@ -152,7 +152,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
Project("noArgJpa", GRADLE_VERSION).build("build") {
|
Project("noArgJpa", GRADLE_VERSION).build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
val classesDir = File(project.projectDir, "build/classes/main")
|
val classesDir = File(project.projectDir, kotlinClassesDir())
|
||||||
|
|
||||||
fun checkClass(name: String) {
|
fun checkClass(name: String) {
|
||||||
val testClass = File(classesDir, "test/$name.class")
|
val testClass = File(classesDir, "test/$name.class")
|
||||||
|
|||||||
+1
-1
@@ -119,7 +119,7 @@ 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, "build/classes/kotlin/main/demo/KotlinGreetingJoiner.class")
|
helloWorldKtClass = File(projectDir, project.classesDir() + "demo/KotlinGreetingJoiner.class")
|
||||||
Assume.assumeTrue(helloWorldKtClass.exists())
|
Assume.assumeTrue(helloWorldKtClass.exists())
|
||||||
helloWorldKtClass.delete(); Unit
|
helloWorldKtClass.delete(); Unit
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user