Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to use Compose on multiple Kotlin versions (#2366)
JS target supports a lower version (1.7.10), because we have a bug in Koltin 1.7.20 Compose 1.2.0 will support: 1.7.20 and 1.7.10 for Android and Desktop 1.7.10 for JS We will release the new patchset (1.2.1) with 1.7.2X support for JS later
- Loading branch information
Showing
18 changed files
with
251 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# Script to build most of the examples, to verify if they can compile. | ||
# Don't add examples, which don't depend on maven.pkg.jetbrains.space, because they won't be able to compile. | ||
|
||
set -euo pipefail | ||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "Specify Compose and Kotlin version. For example: ./validateExamplesWithJs.sh 1.1.1 1.6.10" | ||
exit 1 | ||
fi | ||
COMPOSE_VERSION=$1 | ||
KOTLIN_VERSION=$2 | ||
|
||
|
||
runGradle() { | ||
pushd $1 | ||
./gradlew $2 -Pcompose.version=$COMPOSE_VERSION -Pkotlin.version=$KOTLIN_VERSION | ||
popd | ||
} | ||
|
||
runGradle web-compose-bird build | ||
runGradle web-landing build | ||
runGradle web-with-react build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeCompilerCompatability.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.jetbrains.compose | ||
|
||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType | ||
|
||
internal object ComposeCompilerCompatability { | ||
fun compilerVersionFor(kotlinVersion: String): ComposeCompilerVersion? = when (kotlinVersion) { | ||
"1.7.10" -> ComposeCompilerVersion("1.3.0-alpha01") | ||
"1.7.20" -> ComposeCompilerVersion( | ||
"1.3.2-alpha01", | ||
unsupportedPlatforms = setOf(KotlinPlatformType.js) | ||
) | ||
else -> null | ||
} | ||
} | ||
|
||
internal data class ComposeCompilerVersion( | ||
val version: String, | ||
val unsupportedPlatforms: Set<KotlinPlatformType> = emptySet() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...e/src/test/kotlin/org/jetbrains/compose/test/tests/integration/KotlinCompatabilityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2020-2022 JetBrains s.r.o. and respective authors and developers. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. | ||
*/ | ||
|
||
package org.jetbrains.compose.test.tests.integration | ||
|
||
import org.gradle.testkit.runner.TaskOutcome | ||
import org.gradle.testkit.runner.UnexpectedBuildFailure | ||
import org.jetbrains.compose.test.utils.GradlePluginTestBase | ||
import org.jetbrains.compose.test.utils.TestProjects | ||
import org.jetbrains.compose.test.utils.checks | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.assertThrows | ||
|
||
class KotlinCompatabilityTest : GradlePluginTestBase() { | ||
@Test | ||
fun testKotlinMpp_1_7_10() = testMpp("1.7.10") | ||
|
||
@Test | ||
fun testKotlinJsMpp_1_7_10() = testJsMpp("1.7.10") | ||
|
||
@Test | ||
fun testKotlinMpp_1_7_20() = testMpp("1.7.20") | ||
|
||
@Test | ||
fun testKotlinJsMpp_1_7_20() { | ||
assertThrows<UnexpectedBuildFailure> { | ||
testJsMpp("1.7.20") | ||
} | ||
} | ||
|
||
private fun testMpp(kotlinVersion: String) = with( | ||
testProject( | ||
TestProjects.mpp, | ||
testEnvironment = defaultTestEnvironment.copy(kotlinVersion = kotlinVersion) | ||
) | ||
) { | ||
val logLine = "Kotlin MPP app is running!" | ||
gradle("run").build().checks { check -> | ||
check.taskOutcome(":run", TaskOutcome.SUCCESS) | ||
check.logContains(logLine) | ||
} | ||
} | ||
|
||
private fun testJsMpp(kotlinVersion: String) = with( | ||
testProject( | ||
TestProjects.jsMpp, | ||
testEnvironment = defaultTestEnvironment.copy(kotlinVersion = kotlinVersion) | ||
) | ||
) { | ||
gradle(":compileKotlinJs").build().checks { check -> | ||
check.taskOutcome(":compileKotlinJs", TaskOutcome.SUCCESS) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.