@ -24,6 +24,8 @@ import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.atomic.AtomicInteger
import kotlin.concurrent.thread
import kotlin.concurrent.thread
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Test
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import java.io.File
import java.io.File
class GradlePluginTest : GradlePluginTestBase ( ) {
class GradlePluginTest : GradlePluginTestBase ( ) {
@ -64,22 +66,15 @@ class GradlePluginTest : GradlePluginTestBase() {
)
)
}
}
// We rely on this property to use gradle configuration cache in some tests.
// Enabling configuration cache unconditionally breaks out tests with gradle 7.3.3.
// Old comment: 'for some reason configuration cache + test kit + custom vars does not work'
private val GradleVersion . isAtLeastGradle8
get ( ) = this >= GradleVersion . version ( " 8.0 " )
@Test
@Test
fun iosResources ( ) {
fun iosResources ( ) {
Assumptions . assumeTrue ( currentOS == OS . MacOS )
Assumptions . assumeTrue ( currentOS == OS . MacOS )
val iosTestEnv = iosTestEnv ( )
val iosTestEnv = iosTestEnv ( )
val testEnv = defaultTestEnvironment . copy (
val testEnv = defaultTestEnvironment . copy (
useGradleConfigurationCache = TestProperties . gradleBaseVersionForTests . isAtLeastGradle8 ,
additionalEnvVars = iosTestEnv . envVars
additionalEnvVars = iosTestEnv . envVars
)
)
with ( t estProject( TestProjects . iosResources , testEnv ) ) {
with ( T estProject( TestProjects . iosResources , testEnv ) ) {
gradle ( " :embedAndSignAppleFrameworkForXcode " , " --dry-run " ) . checks {
gradle ( " :embedAndSignAppleFrameworkForXcode " , " --dry-run " ) . checks {
// This test is not intended to actually run embedAndSignAppleFrameworkForXcode.
// This test is not intended to actually run embedAndSignAppleFrameworkForXcode.
// Instead, it should check that embedAndSign depends on syncComposeResources using dry run
// Instead, it should check that embedAndSign depends on syncComposeResources using dry run
@ -96,11 +91,7 @@ class GradlePluginTest : GradlePluginTestBase() {
@Test
@Test
fun iosTestResources ( ) {
fun iosTestResources ( ) {
Assumptions . assumeTrue ( currentOS == OS . MacOS )
Assumptions . assumeTrue ( currentOS == OS . MacOS )
val testEnv = defaultTestEnvironment . copy (
with ( testProject ( TestProjects . iosResources ) ) {
useGradleConfigurationCache = TestProperties . gradleBaseVersionForTests . isAtLeastGradle8
)
with ( testProject ( TestProjects . iosResources , testEnv ) ) {
gradle ( " :linkDebugTestIosX64 " , " --dry-run " ) . checks {
gradle ( " :linkDebugTestIosX64 " , " --dry-run " ) . checks {
check . taskSkipped ( " :copyTestComposeResourcesForIosX64 " )
check . taskSkipped ( " :copyTestComposeResourcesForIosX64 " )
check . taskSkipped ( " :linkDebugTestIosX64 " )
check . taskSkipped ( " :linkDebugTestIosX64 " )
@ -117,7 +108,6 @@ class GradlePluginTest : GradlePluginTestBase() {
Assumptions . assumeTrue ( currentOS == OS . MacOS )
Assumptions . assumeTrue ( currentOS == OS . MacOS )
val iosTestEnv = iosTestEnv ( )
val iosTestEnv = iosTestEnv ( )
val testEnv = defaultTestEnvironment . copy (
val testEnv = defaultTestEnvironment . copy (
useGradleConfigurationCache = TestProperties . gradleBaseVersionForTests . isAtLeastGradle8 ,
additionalEnvVars = iosTestEnv . envVars
additionalEnvVars = iosTestEnv . envVars
)
)
with ( testProject ( TestProjects . iosMokoResources , testEnv ) ) {
with ( testProject ( TestProjects . iosMokoResources , testEnv ) ) {
@ -138,11 +128,6 @@ class GradlePluginTest : GradlePluginTestBase() {
@Test
@Test
fun nativeCacheKind ( ) {
fun nativeCacheKind ( ) {
Assumptions . assumeTrue ( currentOS == OS . MacOS )
Assumptions . assumeTrue ( currentOS == OS . MacOS )
fun nativeCacheKindProject ( kotlinVersion : String ) = testProject (
TestProjects . nativeCacheKind ,
defaultTestEnvironment . copy ( kotlinVersion = kotlinVersion , useGradleConfigurationCache = false )
)
val task = if ( currentArch == Arch . X64 ) {
val task = if ( currentArch == Arch . X64 ) {
" :subproject:linkDebugFrameworkIosX64 "
" :subproject:linkDebugFrameworkIosX64 "
} else {
} else {
@ -153,11 +138,14 @@ class GradlePluginTest : GradlePluginTestBase() {
// the compiler crashed (older k/native doesn't support libs built using newer k/native):
// the compiler crashed (older k/native doesn't support libs built using newer k/native):
// e: kotlin.NotImplementedError: Generation of stubs for class org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterPublicSymbolImpl is not supported yet
// e: kotlin.NotImplementedError: Generation of stubs for class org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterPublicSymbolImpl is not supported yet
val defaultKotlinVersion = kotlinVersionNumbers ( TestKotlinVersions . Default )
if ( kotlinVersionNumbers ( defaultTestEnvironment . kotlinVersion ) >= KotlinVersion ( 1 , 9 , 20 ) ) {
if ( defaultKotlinVersion >= KotlinVersion ( 1 , 9 , 20 ) ) {
testWorkDir . deleteRecursively ( )
testWorkDir . deleteRecursively ( )
testWorkDir . mkdirs ( )
testWorkDir . mkdirs ( )
with ( nativeCacheKindProject ( TestKotlinVersions . Default ) ) {
val project = TestProject (
TestProjects . nativeCacheKind ,
defaultTestEnvironment . copy ( useGradleConfigurationCache = false )
)
with ( project ) {
gradle ( task , " --info " ) . checks {
gradle ( task , " --info " ) . checks {
check . taskSuccessful ( task )
check . taskSuccessful ( task )
check . logContains ( " -Xauto-cache-from= " )
check . logContains ( " -Xauto-cache-from= " )
@ -220,7 +208,7 @@ class GradlePluginTest : GradlePluginTestBase() {
}
}
}
}
testKotlinVersion ( TestKotlinVersions . v1 _9 _21 )
testKotlinVersion ( " 1.9.21 " )
}
}
@Test
@Test
@ -251,7 +239,7 @@ class GradlePluginTest : GradlePluginTestBase() {
@Test
@Test
fun newAndroidTarget ( ) {
fun newAndroidTarget ( ) {
Assumptions . assumeTrue ( TestProperties . gradleBaseVersionForTests >= GradleVersion . version ( " 8.0.0 " ) )
Assumptions . assumeTrue ( defaultTestEnvironment . parsedGradleVersion >= GradleVersion . version ( " 8.0.0 " ) )
with ( testProject ( TestProjects . newAndroidTarget ) ) {
with ( testProject ( TestProjects . newAndroidTarget ) ) {
gradle ( " build " , " --dry-run " ) . checks {
gradle ( " build " , " --dry-run " ) . checks {
}
}