From 11918f3e8a980e5682ccde4b7b4847e2f8573bea Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov <654232+AlexeyTsvetkov@users.noreply.github.com> Date: Tue, 28 Dec 2021 11:55:37 +0300 Subject: [PATCH] Fix MPP CI issues (#1645) * Fix compilation of SplitPane * Fix Gradle tests --- components/build.gradle.kts | 4 +++ .../compose/gradle/GradlePluginTest.kt | 7 +--- .../compose/test/TestKotlinVersion.kt | 7 ++-- .../org/jetbrains/compose/test/TestProject.kt | 4 ++- .../application/defaultArgs/build.gradle | 10 +----- .../application/javaLogger/build.gradle | 8 ----- .../application/jvm/build.gradle | 2 -- .../application/jvmKotlinDsl/build.gradle.kts | 2 -- .../application/macOptions/build.gradle | 8 ----- .../application/macSign/build.gradle | 8 ----- .../application/moduleClashCli/build.gradle | 14 -------- .../application/mpp/build.gradle | 9 ----- .../optionsWithSpaces/build.gradle | 8 ----- .../application/resources/build.gradle | 8 ----- .../application/unpackSkiko/build.gradle | 8 ----- .../src/test/test-projects/init.gradle | 34 +++++++++++++++++++ .../test-projects/misc/jsMpp/build.gradle | 7 ---- .../misc/jvmPreview/build.gradle | 10 ------ 18 files changed, 46 insertions(+), 112 deletions(-) create mode 100644 gradle-plugins/compose/src/test/test-projects/init.gradle diff --git a/components/build.gradle.kts b/components/build.gradle.kts index c75dd5b55d..18ec477339 100644 --- a/components/build.gradle.kts +++ b/components/build.gradle.kts @@ -17,6 +17,10 @@ subprojects { } } + tasks.withType() { + kotlinOptions.jvmTarget = "11" + } + plugins.withId("maven-publish") { configureIfExists { repositories { diff --git a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/gradle/GradlePluginTest.kt b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/gradle/GradlePluginTest.kt index ee70c98400..a735da46c2 100644 --- a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/gradle/GradlePluginTest.kt +++ b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/gradle/GradlePluginTest.kt @@ -24,12 +24,7 @@ import kotlin.concurrent.thread class GradlePluginTest : GradlePluginTestBase() { @Test fun jsMppIsNotBroken() = - with( - testProject( - TestProjects.jsMpp, - testEnvironment = defaultTestEnvironment.copy(kotlinVersion = TestKotlinVersion.V1_5_20) - ) - ) { + with(testProject(TestProjects.jsMpp)) { gradle(":compileKotlinJs").build().checks { check -> check.taskOutcome(":compileKotlinJs", TaskOutcome.SUCCESS) } diff --git a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestKotlinVersion.kt b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestKotlinVersion.kt index 2c4e9cd38d..51864dd1d9 100644 --- a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestKotlinVersion.kt +++ b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestKotlinVersion.kt @@ -7,7 +7,6 @@ package org.jetbrains.compose.test @Suppress("EnumEntryName") enum class TestKotlinVersion(val versionString: String) { - Default("1.6.10"), - V1_5_31("1.5.31"), - V1_5_20("1.5.20") -} + // __KOTLIN_COMPOSE_VERSION__ + Default("1.6.10") +} \ No newline at end of file diff --git a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestProject.kt b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestProject.kt index bb8d62bfd7..f76292d0c2 100644 --- a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestProject.kt +++ b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestProject.kt @@ -19,13 +19,15 @@ class TestProject( private val name: String, private val testEnvironment: TestEnvironment ) { + private val testProjectsRootDir = File("src/test/test-projects") private val additionalArgs = listOf( "--stacktrace", + "--init-script", testProjectsRootDir.resolve("init.gradle").absolutePath, "-P${ComposeProperties.VERBOSE}=true" ) init { - val originalTestRoot = File("src/test/test-projects").resolve(name).also { + val originalTestRoot = testProjectsRootDir.resolve(name).also { check(it.exists()) { "Test project is not found: ${it.absolutePath}" } } for (orig in originalTestRoot.walk()) { diff --git a/gradle-plugins/compose/src/test/test-projects/application/defaultArgs/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/defaultArgs/build.gradle index 4c8c40ec8b..9d1d21d1cd 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/defaultArgs/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/defaultArgs/build.gradle @@ -5,14 +5,6 @@ plugins { id "org.jetbrains.compose" } -repositories { - google() - mavenCentral() - maven { - url "https://maven.pkg.jetbrains.space/public/p/compose/dev" - } -} - dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" implementation compose.desktop.currentOs @@ -27,4 +19,4 @@ compose.desktop { packageName = "Test Package" } } -} +} \ No newline at end of file diff --git a/gradle-plugins/compose/src/test/test-projects/application/javaLogger/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/javaLogger/build.gradle index 903c8a95c4..87fbb5d4de 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/javaLogger/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/javaLogger/build.gradle @@ -3,14 +3,6 @@ plugins { id "org.jetbrains.compose" } -repositories { - google() - mavenCentral() - maven { - url "https://maven.pkg.jetbrains.space/public/p/compose/dev" - } -} - dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" implementation compose.desktop.currentOs diff --git a/gradle-plugins/compose/src/test/test-projects/application/jvm/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/jvm/build.gradle index 75c1067643..8905f5a05f 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/jvm/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/jvm/build.gradle @@ -6,8 +6,6 @@ plugins { } repositories { - google() - mavenCentral() jetbrainsCompose() } diff --git a/gradle-plugins/compose/src/test/test-projects/application/jvmKotlinDsl/build.gradle.kts b/gradle-plugins/compose/src/test/test-projects/application/jvmKotlinDsl/build.gradle.kts index 442f6d36cf..39d923ec20 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/jvmKotlinDsl/build.gradle.kts +++ b/gradle-plugins/compose/src/test/test-projects/application/jvmKotlinDsl/build.gradle.kts @@ -7,8 +7,6 @@ plugins { } repositories { - google() - mavenCentral() jetbrainsCompose() } diff --git a/gradle-plugins/compose/src/test/test-projects/application/macOptions/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/macOptions/build.gradle index d1c9437a9d..05c8d8b0c7 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/macOptions/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/macOptions/build.gradle @@ -5,14 +5,6 @@ plugins { id "org.jetbrains.compose" } -repositories { - google() - mavenCentral() - maven { - url "https://maven.pkg.jetbrains.space/public/p/compose/dev" - } -} - dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" implementation compose.desktop.currentOs diff --git a/gradle-plugins/compose/src/test/test-projects/application/macSign/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/macSign/build.gradle index 92fce3f186..25af20375d 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/macSign/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/macSign/build.gradle @@ -5,14 +5,6 @@ plugins { id "org.jetbrains.compose" } -repositories { - google() - mavenCentral() - maven { - url "https://maven.pkg.jetbrains.space/public/p/compose/dev" - } -} - dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" implementation compose.desktop.currentOs diff --git a/gradle-plugins/compose/src/test/test-projects/application/moduleClashCli/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/moduleClashCli/build.gradle index 7c52b3ee91..e69de29bb2 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/moduleClashCli/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/moduleClashCli/build.gradle @@ -1,14 +0,0 @@ -plugins { - id "org.jetbrains.kotlin.jvm" apply false - id "org.jetbrains.compose" apply false -} - -subprojects { - repositories { - google() - mavenCentral() - maven { - url "https://maven.pkg.jetbrains.space/public/p/compose/dev" - } - } -} diff --git a/gradle-plugins/compose/src/test/test-projects/application/mpp/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/mpp/build.gradle index 585672eff4..3b13d85550 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/mpp/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/mpp/build.gradle @@ -5,14 +5,6 @@ plugins { id "org.jetbrains.compose" } -repositories { - google() - mavenCentral() - maven { - url "https://maven.pkg.jetbrains.space/public/p/compose/dev" - } -} - kotlin { jvm { } @@ -26,7 +18,6 @@ kotlin { } } - compose.desktop { application { mainClass = "MainKt" diff --git a/gradle-plugins/compose/src/test/test-projects/application/optionsWithSpaces/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/optionsWithSpaces/build.gradle index 05088e3507..f0df53799f 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/optionsWithSpaces/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/optionsWithSpaces/build.gradle @@ -5,14 +5,6 @@ plugins { id "org.jetbrains.compose" } -repositories { - google() - mavenCentral() - maven { - url "https://maven.pkg.jetbrains.space/public/p/compose/dev" - } -} - dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" implementation compose.desktop.currentOs diff --git a/gradle-plugins/compose/src/test/test-projects/application/resources/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/resources/build.gradle index e4e8a01b88..9db2a01e22 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/resources/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/resources/build.gradle @@ -5,14 +5,6 @@ plugins { id "org.jetbrains.compose" } -repositories { - google() - mavenCentral() - maven { - url "https://maven.pkg.jetbrains.space/public/p/compose/dev" - } -} - dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" implementation compose.desktop.currentOs diff --git a/gradle-plugins/compose/src/test/test-projects/application/unpackSkiko/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/unpackSkiko/build.gradle index 57722d1a55..d49191985c 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/unpackSkiko/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/unpackSkiko/build.gradle @@ -5,14 +5,6 @@ plugins { id "org.jetbrains.compose" } -repositories { - google() - mavenCentral() - maven { - url "https://maven.pkg.jetbrains.space/public/p/compose/dev" - } -} - dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" implementation compose.desktop.currentOs diff --git a/gradle-plugins/compose/src/test/test-projects/init.gradle b/gradle-plugins/compose/src/test/test-projects/init.gradle new file mode 100644 index 0000000000..7db1e57b4f --- /dev/null +++ b/gradle-plugins/compose/src/test/test-projects/init.gradle @@ -0,0 +1,34 @@ +def jvmTargetForKotlinCompile(Project project, String jvmTarget) { + project.tasks.all { + // tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) fails for init scripts + if (it.class.name == "org.jetbrains.kotlin.gradle.tasks.KotlinCompile_Decorated") { + kotlinOptions.jvmTarget = "11" + } + } +} + +allprojects { + repositories { + mavenLocal() + mavenCentral() + maven { + url 'https://maven.pkg.jetbrains.space/public/p/compose/dev' + } + google() + } + + plugins.withId("java-base") { + java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + } + + plugins.withId("org.jetbrains.kotlin.jvm") { + jvmTargetForKotlinCompile(project, "11") + } + + plugins.withId("org.jetbrains.kotlin.multiplatform") { + jvmTargetForKotlinCompile(project, "11") + } +} \ No newline at end of file diff --git a/gradle-plugins/compose/src/test/test-projects/misc/jsMpp/build.gradle b/gradle-plugins/compose/src/test/test-projects/misc/jsMpp/build.gradle index 072f6aa1bd..421b6a144b 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/jsMpp/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/misc/jsMpp/build.gradle @@ -5,13 +5,6 @@ plugins { id "org.jetbrains.compose" } -repositories { - google() - mavenCentral() - maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" } - maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } -} - kotlin { js(IR) { browser() diff --git a/gradle-plugins/compose/src/test/test-projects/misc/jvmPreview/build.gradle b/gradle-plugins/compose/src/test/test-projects/misc/jvmPreview/build.gradle index e5a360f3a0..e69de29bb2 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/jvmPreview/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/misc/jvmPreview/build.gradle @@ -1,10 +0,0 @@ -subprojects { - repositories { - mavenLocal() - mavenCentral() - maven { - url 'https://maven.pkg.jetbrains.space/public/p/compose/dev' - } - google() - } -} \ No newline at end of file