summaryrefslogtreecommitdiff
path: root/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains')
-rw-r--r--libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt2
-rw-r--r--libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt2
-rw-r--r--libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/PluginsDslIT.kt6
-rw-r--r--libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt149
-rw-r--r--libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativePlatformLibsIT.kt69
-rw-r--r--libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/projectSetupDefaults.kt2
6 files changed, 19 insertions, 211 deletions
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt
index 7d25e28148a..9d47bb6606c 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt
@@ -61,13 +61,13 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
@MppGradlePluginTests
@DisplayName("works with MPP publishing")
@GradleTest
- @OptIn(ExperimentalStdlibApi::class)
fun testMppWithMavenPublish(gradleVersion: GradleVersion) {
project("new-mpp-lib-and-app/sample-lib", gradleVersion) {
// KT-49933: Support Gradle Configuration caching with HMPP
val publishedTargets = listOf(/*"kotlinMultiplatform",*/ "jvm6", "nodeJs")
testConfigurationCacheOf(
+ ":buildKotlinToolingMetadata", // Remove it when KT-49933 is fixed and `kotlinMultiplatform` publication works
*(publishedTargets.map { ":publish${it.replaceFirstChar { it.uppercaseChar() }}PublicationToMavenRepository" }.toTypedArray()),
checkUpToDateOnRebuild = false
)
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt
index c65442dde88..9d5a082ad9c 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt
@@ -675,7 +675,7 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
}
build("assemble") {
- assertOutputContains("Non-incremental compilation will be performed: CACHE_CORRUPTION")
+ assertOutputContains("Non-incremental compilation will be performed: INCREMENTAL_COMPILATION_FAILED")
}
val lookupFile = projectPath.resolve("lib/build/kotlin/${compileKotlinTaskName}/cacheable/${compileCacheFolderName}/lookups/file-to-id.tab")
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/PluginsDslIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/PluginsDslIT.kt
index 35325fdf1ff..a88f7467641 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/PluginsDslIT.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/PluginsDslIT.kt
@@ -40,7 +40,11 @@ class PluginsDslIT : KGPBaseTest() {
"org.jetbrains.kotlin.allopen.gradle.AllOpenGradleSubplugin",
"org.jetbrains.kotlin.allopen.gradle.SpringGradleSubplugin",
"org.jetbrains.kotlin.noarg.gradle.NoArgGradleSubplugin",
- "org.jetbrains.kotlin.noarg.gradle.KotlinJpaSubplugin"
+ "org.jetbrains.kotlin.noarg.gradle.KotlinJpaSubplugin",
+ "org.jetbrains.kotlinx.atomicfu.gradle.AtomicfuKotlinGradleSubplugin",
+ "org.jetbrains.kotlin.lombok.gradle.LombokSubplugin",
+ "org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverGradleSubplugin",
+ "org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin"
)
build("build") {
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt
index f9647c59479..0cc45064a34 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt
@@ -21,8 +21,11 @@ import org.jetbrains.kotlin.konan.target.CompilerOutputKind
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.konan.target.KonanTarget
import org.jetbrains.kotlin.konan.target.presetName
-import org.junit.*
-import org.junit.rules.TemporaryFolder
+import org.junit.Assume
+import org.junit.Ignore
+import org.junit.Rule
+import org.junit.Test
+import org.junit.rules.ErrorCollector
import java.io.File
import java.nio.file.Files
import java.util.*
@@ -98,13 +101,6 @@ private fun BaseGradleIT.Project.configureSingleNativeTarget(preset: String = Ho
}
}
-internal fun BaseGradleIT.BuildOptions.withCustomKonanDataDir(
- customKonanDataDir: File
-) = this.copy(
- customEnvironmentVariables = this.customEnvironmentVariables +
- ("KONAN_DATA_DIR" to customKonanDataDir.absolutePath)
-)
-
class GeneralNativeIT : BaseGradleIT() {
val nativeHostTargetName = MPPNativeTargets.current
@@ -1101,131 +1097,6 @@ class GeneralNativeIT : BaseGradleIT() {
}
@Test
- fun `check offline mode is propagated to the compiler`() = with(
- transformNativeTestProjectWithPluginDsl(
- "executables",
- directoryPrefix = "native-binaries"
- )
- ) {
- val buildOptions = defaultBuildOptions()
-
- val linkTask = ":linkDebugExecutableHost"
- val compileTask = ":compileKotlinHost"
-
- build(linkTask, options = buildOptions) {
- assertSuccessful()
- }
-
- // Check that --offline works when all the dependencies are already downloaded:
- val buildOptionsOffline = buildOptions.copy(freeCommandLineArgs = buildOptions.freeCommandLineArgs + "--offline")
-
- build("clean", linkTask, options = buildOptionsOffline) {
- assertSuccessful()
- withNativeCommandLineArguments(compileTask, linkTask) {
- assertTrue(it.contains("-Xoverride-konan-properties=airplaneMode=true"))
- }
- }
-
- // Check that --offline fails when there are no downloaded dependencies:
- run {
- val customKonanDataDir = tempDir.newFolder()
- val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
-
- build("clean", linkTask, options = buildOptionsOfflineWithCustomKonanDataDir) {
- assertFailed()
- assertTasksNotExecuted(listOf(linkTask))
- }
-
- checkNoDependenciesDownloaded(customKonanDataDir)
- }
-
- // Check that the compiler is not extracted if it is not cached:
- run {
- val customKonanDataDir = tempDir.newFolder()
- val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
- build(
- "clean", linkTask, "-Pkotlin.native.version=1.6.20-M1-9999",
- options = buildOptionsOfflineWithCustomKonanDataDir
- ) {
- assertFailed()
- assertTasksNotExecuted(listOf(linkTask, compileTask))
- }
-
- assertTrue(customKonanDataDir.listFiles().isNullOrEmpty())
- }
- }
-
- private fun checkNoDependenciesDownloaded(customKonanDataDir: File) {
- // Check that no files have actually been downloaded or extracted,
- // except for maybe the compiler itself, which can be extracted from the Gradle cache
- // (see NativeCompilerDownloader, it uses regular dependency resolution,
- // so supports --offline properly by default).
- val cacheDirName = "cache"
- val dependenciesDirName = "dependencies"
-
- fun assertDirectoryHasNothingButMaybe(directory: File, vararg names: String) {
- assertEquals(emptyList(), directory.listFiles().orEmpty().map { it.name } - names)
- }
-
- assertDirectoryHasNothingButMaybe(File(customKonanDataDir, cacheDirName), ".lock")
- assertDirectoryHasNothingButMaybe(File(customKonanDataDir, dependenciesDirName), ".extracted")
-
- val customKonanDataDirFiles = customKonanDataDir.listFiles().orEmpty().map { it.name } - setOf(cacheDirName, dependenciesDirName)
- if (customKonanDataDirFiles.isNotEmpty()) {
- assertEquals(1, customKonanDataDirFiles.size, message = customKonanDataDirFiles.toString())
- assertTrue(customKonanDataDirFiles.single().startsWith("kotlin-native-"), message = customKonanDataDirFiles.single())
- }
- }
-
- @Test
- fun `check offline mode is propagated to the cinterop`() = with(transformNativeTestProjectWithPluginDsl("native-cinterop")) {
- val buildOptions = defaultBuildOptions()
- val cinteropTask = ":projectLibrary:cinteropAnotherNumberHost"
-
- build(cinteropTask, options = buildOptions) {
- assertSuccessful()
- }
-
- // Check that --offline works when all the dependencies are already downloaded:
- val buildOptionsOffline = buildOptions.copy(freeCommandLineArgs = buildOptions.freeCommandLineArgs + "--offline")
-
- build("clean", cinteropTask, options = buildOptionsOffline) {
- assertSuccessful()
- withNativeCommandLineArguments(cinteropTask, toolName = "cinterop") {
- assertTrue(it.containsSequentially("-Xoverride-konan-properties", "airplaneMode=true"))
- }
- }
-
- // Check that --offline fails when there are no downloaded dependencies:
- run {
- val customKonanDataDir = tempDir.newFolder()
- val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
-
- build("clean", cinteropTask, options = buildOptionsOfflineWithCustomKonanDataDir) {
- assertFailed()
- }
-
- checkNoDependenciesDownloaded(customKonanDataDir)
- }
-
- // Check that the compiler is not extracted if it is not cached:
- run {
- val customKonanDataDir = tempDir.newFolder()
- val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
-
- build(
- "clean", cinteropTask, "-Pkotlin.native.version=1.6.20-M1-9999",
- options = buildOptionsOfflineWithCustomKonanDataDir
- ) {
- assertFailed()
- assertTasksNotExecuted(listOf(cinteropTask))
- }
-
- assertTrue(customKonanDataDir.listFiles().isNullOrEmpty())
- }
- }
-
- @Test
fun allowToOverrideDownloadUrl() {
with(transformNativeTestProjectWithPluginDsl("native-parallel")) {
gradleProperties().appendText(
@@ -1320,15 +1191,5 @@ class GeneralNativeIT : BaseGradleIT() {
toolName: String = "konanc",
check: (Map<String, String>) -> Unit
) = taskPaths.forEach { taskPath -> check(extractNativeCustomEnvironment(taskPath, toolName)) }
-
- @field:ClassRule
- @JvmField
- val tempDir = TemporaryFolder()
-
- @JvmStatic
- @AfterClass
- fun deleteTempDir() {
- tempDir.delete()
- }
}
} \ No newline at end of file
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativePlatformLibsIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativePlatformLibsIT.kt
index dc3a107ae3a..a95107353b0 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativePlatformLibsIT.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativePlatformLibsIT.kt
@@ -20,9 +20,9 @@ import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.konan.target.KonanTarget
import org.jetbrains.kotlin.konan.target.presetName
import org.jetbrains.kotlin.konan.util.DependencyDirectories
-import org.junit.*
-import org.junit.rules.TemporaryFolder
-import kotlin.test.assertFalse
+import org.junit.Assume
+import org.junit.BeforeClass
+import org.junit.Test
import kotlin.test.assertTrue
class NativePlatformLibsIT : BaseGradleIT() {
@@ -35,16 +35,6 @@ class NativePlatformLibsIT : BaseGradleIT() {
// We temporary disable it for windows until a proper fix is found.
Assume.assumeFalse(HostManager.hostIsMingw)
}
-
- @field:ClassRule
- @JvmField
- val tempDir = TemporaryFolder()
-
- @JvmStatic
- @AfterClass
- fun deleteTempDir() {
- tempDir.delete()
- }
}
override val defaultGradleVersion: GradleVersionRequired
@@ -85,11 +75,8 @@ class NativePlatformLibsIT : BaseGradleIT() {
}
}
- private fun Project.buildWithLightDist(
- vararg tasks: String,
- options: BuildOptions = defaultBuildOptions(),
- check: CompiledProject.() -> Unit
- ) = build(*tasks, "-Pkotlin.native.distribution.type=light", options = options, check = check)
+ private fun Project.buildWithLightDist(vararg tasks: String, check: CompiledProject.() -> Unit) =
+ build(*tasks, "-Pkotlin.native.distribution.type=light", check = check)
@Test
fun testNoGenerationForOldCompiler() = with(platformLibrariesProject("linuxX64")) {
@@ -319,50 +306,4 @@ class NativePlatformLibsIT : BaseGradleIT() {
assertContains("Generate platform libraries for linux_x64")
}
}
-
- @Test
- fun `check offline mode is propagated to the platform libs generator`() = with(platformLibrariesProject("linuxX64")) {
- deleteInstalledCompilers()
-
- // Install the compiler at the first time. Don't build to reduce execution time.
- buildWithLightDist("tasks") {
- assertSuccessful()
- assertContains("Generate platform libraries for linux_x64")
- }
-
- deleteInstalledCompilers()
-
- // Check that --offline works when all the dependencies are already downloaded:
- val buildOptionsOffline = defaultBuildOptions()
- .let { it.copy(freeCommandLineArgs = it.freeCommandLineArgs + "--offline") }
-
- buildWithLightDist("tasks", options = buildOptionsOffline) {
- assertSuccessful()
- assertContains("Generate platform libraries for linux_x64")
- }
-
- // Check that --offline fails when there are no downloaded dependencies:
- run {
- val customKonanDataDir = tempDir.newFolder()
- val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
-
- buildWithLightDist("tasks", options = buildOptionsOfflineWithCustomKonanDataDir) {
- assertFailed()
- assertContains("Generate platform libraries for linux_x64")
- }
- }
-
- // The build above have extracted the cached compiler to the custom KONAN_DATA_DIR; remove it:
- run {
- val customKonanDataDir = tempDir.newFolder()
- val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
- // Check that the compiler is not extracted if it is not cached:
- buildWithLightDist("tasks", "-Pkotlin.native.version=1.6.20-M1-9999", options = buildOptionsOfflineWithCustomKonanDataDir) {
- assertFailed()
- assertNotContains("Generate platform libraries for linux_x64")
- }
-
- assertTrue(customKonanDataDir.listFiles().isNullOrEmpty())
- }
- }
}
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/projectSetupDefaults.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/projectSetupDefaults.kt
index 129cd62ae22..227ab8f56a1 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/projectSetupDefaults.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/projectSetupDefaults.kt
@@ -34,6 +34,7 @@ internal val DEFAULT_GROOVY_SETTINGS_FILE =
id "org.jetbrains.kotlin.plugin.serialization" version "${'$'}kotlin_version"
id "org.jetbrains.kotlin.test.fixes.android" version "${'$'}test_fixes_version"
id "org.jetbrains.kotlin.gradle-subplugin-example" version "${'$'}kotlin_version"
+ id "org.jetbrains.kotlin.plugin.atomicfu" version "${'$'}kotlin_version"
}
resolutionStrategy {
@@ -86,6 +87,7 @@ internal val DEFAULT_KOTLIN_SETTINGS_FILE =
id("org.jetbrains.kotlin.plugin.serialization") version kotlin_version
id("org.jetbrains.kotlin.test.fixes.android") version test_fixes_version
id("org.jetbrains.kotlin.gradle-subplugin-example") version kotlin_version
+ id("org.jetbrains.kotlin.plugin.atomicfu") version kotlin_version
}
resolutionStrategy {