[Gradle] Add Gradle integration tests with precise compilation outputs backup
#KT-49785 In Progress
This commit is contained in:
committed by
Space Team
parent
40a901caa1
commit
db5df5c5ec
+6
-1
@@ -14,7 +14,7 @@ import kotlin.io.path.exists
|
|||||||
|
|
||||||
@DisplayName("Compiler plugin incremental compilation")
|
@DisplayName("Compiler plugin incremental compilation")
|
||||||
@OtherGradlePluginTests
|
@OtherGradlePluginTests
|
||||||
class CompilerPluginsIncrementalIT : KGPBaseTest() {
|
open class CompilerPluginsIncrementalIT : KGPBaseTest() {
|
||||||
override val defaultBuildOptions: BuildOptions
|
override val defaultBuildOptions: BuildOptions
|
||||||
get() = super.defaultBuildOptions.copy(
|
get() = super.defaultBuildOptions.copy(
|
||||||
incremental = true
|
incremental = true
|
||||||
@@ -68,3 +68,8 @@ class CompilerPluginsIncrementalIT : KGPBaseTest() {
|
|||||||
|
|
||||||
private val String.prefix get() = "compilerPlugins/$this"
|
private val String.prefix get() = "compilerPlugins/$this"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("Compiler plugin incremental compilation with precise compilation outputs backup")
|
||||||
|
class CompilerPluginsIncrementalWithPreciseBackupIT : CompilerPluginsIncrementalIT() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
|
}
|
||||||
+14
-2
@@ -12,7 +12,7 @@ import java.nio.file.Path
|
|||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
|
|
||||||
@JsGradlePluginTests
|
@JsGradlePluginTests
|
||||||
class IncrementalCompilationJsMultiProjectIT : BaseIncrementalCompilationMultiProjectIT() {
|
open class IncrementalCompilationJsMultiProjectIT : BaseIncrementalCompilationMultiProjectIT() {
|
||||||
override val defaultProjectName: String = "incrementalMultiproject"
|
override val defaultProjectName: String = "incrementalMultiproject"
|
||||||
|
|
||||||
override fun defaultProject(
|
override fun defaultProject(
|
||||||
@@ -136,6 +136,10 @@ class IncrementalCompilationJsMultiProjectIT : BaseIncrementalCompilationMultiPr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class IncrementalCompilationJsMultiProjectWithPreciseBackupIT : IncrementalCompilationJsMultiProjectIT() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
|
}
|
||||||
|
|
||||||
@JvmGradlePluginTests
|
@JvmGradlePluginTests
|
||||||
open class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationMultiProjectIT() {
|
open class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationMultiProjectIT() {
|
||||||
override val additionalLibDependencies: String =
|
override val additionalLibDependencies: String =
|
||||||
@@ -275,11 +279,15 @@ open class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class IncrementalCompilationJvmMultiProjectWithPreciseBackupIT : IncrementalCompilationJvmMultiProjectIT() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
|
}
|
||||||
|
|
||||||
class IncrementalCompilationFirJvmMultiProjectIT : IncrementalCompilationJvmMultiProjectIT() {
|
class IncrementalCompilationFirJvmMultiProjectIT : IncrementalCompilationJvmMultiProjectIT() {
|
||||||
override val defaultBuildOptions: BuildOptions = super.defaultBuildOptions.copy(useFir = true)
|
override val defaultBuildOptions: BuildOptions = super.defaultBuildOptions.copy(useFir = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
class IncrementalCompilationOldICJvmMultiProjectIT : IncrementalCompilationJvmMultiProjectIT() {
|
open class IncrementalCompilationOldICJvmMultiProjectIT : IncrementalCompilationJvmMultiProjectIT() {
|
||||||
|
|
||||||
override val defaultBuildOptions = super.defaultBuildOptions.copy(useGradleClasspathSnapshot = false)
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(useGradleClasspathSnapshot = false)
|
||||||
|
|
||||||
@@ -412,6 +420,10 @@ class IncrementalCompilationOldICJvmMultiProjectIT : IncrementalCompilationJvmMu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class IncrementalCompilationOldICJvmMultiProjectWithPreciseBackupIT : IncrementalCompilationOldICJvmMultiProjectIT() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
|
}
|
||||||
|
|
||||||
abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilationBaseIT() {
|
abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilationBaseIT() {
|
||||||
|
|
||||||
protected abstract val compileKotlinTaskName: String
|
protected abstract val compileKotlinTaskName: String
|
||||||
|
|||||||
+5
@@ -91,6 +91,11 @@ open class IncrementalJavaChangeDefaultIT : IncrementalCompilationJavaChangesBas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("Default incremental compilation with precise compilation outputs backup")
|
||||||
|
open class IncrementalJavaChangePreciseCompilationBackupIT : IncrementalJavaChangeDefaultIT() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
|
}
|
||||||
|
|
||||||
@DisplayName("Incremental compilation via classpath snapshots with default precise java tracking")
|
@DisplayName("Incremental compilation via classpath snapshots with default precise java tracking")
|
||||||
class IncrementalJavaChangeOldICIT : IncrementalJavaChangeDefaultIT() {
|
class IncrementalJavaChangeOldICIT : IncrementalJavaChangeDefaultIT() {
|
||||||
|
|
||||||
|
|||||||
+5
@@ -388,3 +388,8 @@ open class KaptIncrementalIT : KGPBaseTest() {
|
|||||||
|
|
||||||
val TestProject.kaptGeneratedToPath get() = projectPath.resolve("build/generated/source/kapt")
|
val TestProject.kaptGeneratedToPath get() = projectPath.resolve("build/generated/source/kapt")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("Kapt incremental compilation with precise compilation outputs backup")
|
||||||
|
class KaptIncrementalWithPreciseBackupIT : KaptIncrementalIT() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
|
}
|
||||||
+6
-1
@@ -21,7 +21,7 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
@DisplayName("Kapt incremental tests with aggregating apt")
|
@DisplayName("Kapt incremental tests with aggregating apt")
|
||||||
class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() {
|
open class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() {
|
||||||
|
|
||||||
override val defaultBuildOptions = super.defaultBuildOptions.copy(
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(
|
||||||
incremental = true,
|
incremental = true,
|
||||||
@@ -389,3 +389,8 @@ class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("Kapt incremental tests with aggregating apt with precise compilation outputs backup")
|
||||||
|
class KaptIncrementalWithAggregatingAptAndPreciseBackup : KaptIncrementalWithAggregatingApt() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
|
}
|
||||||
+6
-1
@@ -24,7 +24,7 @@ import kotlin.io.path.*
|
|||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@DisplayName("Kapt incremental tests with isolating apt")
|
@DisplayName("Kapt incremental tests with isolating apt")
|
||||||
class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() {
|
open class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() {
|
||||||
|
|
||||||
override val defaultBuildOptions = super.defaultBuildOptions.copy(
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(
|
||||||
incremental = true,
|
incremental = true,
|
||||||
@@ -429,6 +429,11 @@ class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("Kapt incremental tests with isolating apt with precise compilation outputs backup")
|
||||||
|
class KaptIncrementalWithIsolatingAptAndPreciseBackup : KaptIncrementalWithIsolatingApt() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
|
}
|
||||||
|
|
||||||
private const val patternApt = "Processing java sources with annotation processors:"
|
private const val patternApt = "Processing java sources with annotation processors:"
|
||||||
fun getProcessedSources(output: String): Set<String> {
|
fun getProcessedSources(output: String): Set<String> {
|
||||||
return output.lines().filter { it.contains(patternApt) }.flatMapTo(HashSet()) { logging ->
|
return output.lines().filter { it.contains(patternApt) }.flatMapTo(HashSet()) { logging ->
|
||||||
|
|||||||
+6
-1
@@ -18,7 +18,7 @@ import kotlin.io.path.writeText
|
|||||||
|
|
||||||
@DisplayName("android with kapt3 incremental build tests")
|
@DisplayName("android with kapt3 incremental build tests")
|
||||||
@AndroidGradlePluginTests
|
@AndroidGradlePluginTests
|
||||||
class Kapt3AndroidIncrementalIT : Kapt3BaseIT() {
|
open class Kapt3AndroidIncrementalIT : Kapt3BaseIT() {
|
||||||
@DisplayName("stubs generation is incremental on changes in android variant java sources")
|
@DisplayName("stubs generation is incremental on changes in android variant java sources")
|
||||||
@GradleAndroidTest
|
@GradleAndroidTest
|
||||||
fun generateStubsTaskShouldRunIncrementallyOnChangesInAndroidVariantJavaSources(
|
fun generateStubsTaskShouldRunIncrementallyOnChangesInAndroidVariantJavaSources(
|
||||||
@@ -202,4 +202,9 @@ class Kapt3AndroidIncrementalIT : Kapt3BaseIT() {
|
|||||||
modifyAndCheck(libJvmProject.kotlinSourcesDir().resolve("libJvmUtil.kt"), "useLibJvmUtil.kt")
|
modifyAndCheck(libJvmProject.kotlinSourcesDir().resolve("libJvmUtil.kt"), "useLibJvmUtil.kt")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DisplayName("android with kapt3 incremental build tests with precise compilation outputs backup")
|
||||||
|
class Kapt3AndroidIncrementalWithPreciseBackupIT : Kapt3AndroidIncrementalIT() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
}
|
}
|
||||||
+5
-4
@@ -8,16 +8,13 @@ package org.jetbrains.kotlin.gradle.android
|
|||||||
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.testbase.*
|
import org.jetbrains.kotlin.gradle.testbase.*
|
||||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
|
||||||
import org.jetbrains.kotlin.gradle.util.getFilesByNames
|
|
||||||
import org.jetbrains.kotlin.gradle.util.modify
|
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import kotlin.io.path.appendText
|
import kotlin.io.path.appendText
|
||||||
import kotlin.io.path.writeText
|
import kotlin.io.path.writeText
|
||||||
|
|
||||||
@DisplayName("kotlin-android incremental compilation tests")
|
@DisplayName("kotlin-android incremental compilation tests")
|
||||||
@AndroidGradlePluginTests
|
@AndroidGradlePluginTests
|
||||||
class KotlinAndroidIncrementalIT : KGPBaseTest() {
|
open class KotlinAndroidIncrementalIT : KGPBaseTest() {
|
||||||
@DisplayName("incremental compilation works with single-module android projects")
|
@DisplayName("incremental compilation works with single-module android projects")
|
||||||
@GradleAndroidTest
|
@GradleAndroidTest
|
||||||
fun testIncrementalCompilation(
|
fun testIncrementalCompilation(
|
||||||
@@ -180,4 +177,8 @@ class KotlinAndroidIncrementalIT : KGPBaseTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class KotlinAndroidIncrementalWithPreciseBackupIT : KotlinAndroidIncrementalIT() {
|
||||||
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(usePreciseOutputsBackup = true)
|
||||||
}
|
}
|
||||||
+5
@@ -38,6 +38,7 @@ data class BuildOptions(
|
|||||||
val usePreciseJavaTracking: Boolean? = null,
|
val usePreciseJavaTracking: Boolean? = null,
|
||||||
val freeArgs: List<String> = emptyList(),
|
val freeArgs: List<String> = emptyList(),
|
||||||
val statisticsForceValidation: Boolean = true,
|
val statisticsForceValidation: Boolean = true,
|
||||||
|
val usePreciseOutputsBackup: Boolean? = null,
|
||||||
) {
|
) {
|
||||||
data class KaptOptions(
|
data class KaptOptions(
|
||||||
val verbose: Boolean = false,
|
val verbose: Boolean = false,
|
||||||
@@ -144,6 +145,10 @@ data class BuildOptions(
|
|||||||
arguments.add("-Pkotlin_performance_profile_force_validation=true")
|
arguments.add("-Pkotlin_performance_profile_force_validation=true")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usePreciseOutputsBackup != null) {
|
||||||
|
arguments.add("-Pkotlin.compiler.preciseCompilationResultsBackup=$usePreciseOutputsBackup")
|
||||||
|
}
|
||||||
|
|
||||||
arguments.addAll(freeArgs)
|
arguments.addAll(freeArgs)
|
||||||
|
|
||||||
return arguments.toList()
|
return arguments.toList()
|
||||||
|
|||||||
Reference in New Issue
Block a user