[Gradle] Use for Gradle IT tests custom location for kotlin.user.home
Such way, we could easily clean all persistent storage produced by test runs. ^KT-58223 In Progress
This commit is contained in:
committed by
Space Team
parent
3d94679db4
commit
e8a7c53dde
+2
-2
@@ -172,7 +172,7 @@ open class CommonizerIT : KGPBaseTest() {
|
|||||||
gradleVersion: GradleVersion,
|
gradleVersion: GradleVersion,
|
||||||
@TempDir tempDir: Path,
|
@TempDir tempDir: Path,
|
||||||
) {
|
) {
|
||||||
nativeProject("commonizeCurlInterop", gradleVersion) {
|
nativeProject("commonizeCurlInterop", gradleVersion, buildOptions = defaultBuildOptions.copy(kotlinUserHome = null)) {
|
||||||
|
|
||||||
configureCommonizerTargets()
|
configureCommonizerTargets()
|
||||||
|
|
||||||
@@ -546,7 +546,7 @@ open class CommonizerIT : KGPBaseTest() {
|
|||||||
gradleVersion: GradleVersion,
|
gradleVersion: GradleVersion,
|
||||||
@TempDir tempDir: Path,
|
@TempDir tempDir: Path,
|
||||||
) {
|
) {
|
||||||
nativeProject("commonizeCurlInterop", gradleVersion) {
|
nativeProject("commonizeCurlInterop", gradleVersion, buildOptions = defaultBuildOptions.copy(kotlinUserHome = null)) {
|
||||||
gradleProperties.append("kotlin.user.home=${tempDir.absolutePathString()}")
|
gradleProperties.append("kotlin.user.home=${tempDir.absolutePathString()}")
|
||||||
|
|
||||||
configureCommonizerTargets()
|
configureCommonizerTargets()
|
||||||
|
|||||||
+6
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.gradle.report.BuildReportType
|
|||||||
import org.junit.jupiter.api.condition.OS
|
import org.junit.jupiter.api.condition.OS
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import kotlin.io.path.absolutePathString
|
||||||
|
|
||||||
data class BuildOptions(
|
data class BuildOptions(
|
||||||
val logLevel: LogLevel = LogLevel.INFO,
|
val logLevel: LogLevel = LogLevel.INFO,
|
||||||
@@ -53,6 +54,7 @@ data class BuildOptions(
|
|||||||
val compilerExecutionStrategy: KotlinCompilerExecutionStrategy? = null,
|
val compilerExecutionStrategy: KotlinCompilerExecutionStrategy? = null,
|
||||||
val runViaBuildToolsApi: Boolean? = null,
|
val runViaBuildToolsApi: Boolean? = null,
|
||||||
val konanDataDir: Path? = konanDir, // null can be used only if you are using custom 'kotlin.native.home' or 'org.jetbrains.kotlin.native.home' property instead of konanDir
|
val konanDataDir: Path? = konanDir, // null can be used only if you are using custom 'kotlin.native.home' or 'org.jetbrains.kotlin.native.home' property instead of konanDir
|
||||||
|
val kotlinUserHome: Path? = testKitDir.resolve(".kotlin"),
|
||||||
) {
|
) {
|
||||||
val isK2ByDefault
|
val isK2ByDefault
|
||||||
get() = KotlinVersion.DEFAULT >= KotlinVersion.KOTLIN_2_0
|
get() = KotlinVersion.DEFAULT >= KotlinVersion.KOTLIN_2_0
|
||||||
@@ -217,6 +219,10 @@ data class BuildOptions(
|
|||||||
arguments.add("-Pkonan.data.dir=${konanDataDir.toAbsolutePath().normalize()}")
|
arguments.add("-Pkonan.data.dir=${konanDataDir.toAbsolutePath().normalize()}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (kotlinUserHome != null) {
|
||||||
|
arguments.add("-Pkotlin.user.home=${kotlinUserHome.absolutePathString()}")
|
||||||
|
}
|
||||||
|
|
||||||
arguments.addAll(freeArgs)
|
arguments.addAll(freeArgs)
|
||||||
|
|
||||||
return arguments.toList()
|
return arguments.toList()
|
||||||
|
|||||||
+1
-1
@@ -489,7 +489,7 @@ val konanDir
|
|||||||
/**
|
/**
|
||||||
* On changing test kit dir location update related location in 'cleanTestKitCache' task.
|
* On changing test kit dir location update related location in 'cleanTestKitCache' task.
|
||||||
*/
|
*/
|
||||||
private val testKitDir get() = Paths.get(".").resolve("build").resolve("testKitCache")
|
internal val testKitDir get() = Paths.get(".").resolve("build").resolve("testKitCache")
|
||||||
|
|
||||||
private val hashAlphabet: List<Char> = ('a'..'z') + ('A'..'Z') + ('0'..'9')
|
private val hashAlphabet: List<Char> = ('a'..'z') + ('A'..'Z') + ('0'..'9')
|
||||||
private fun randomHash(length: Int = 15): String {
|
private fun randomHash(length: Int = 15): String {
|
||||||
|
|||||||
Reference in New Issue
Block a user