diff --git a/components/build.gradle.kts b/components/build.gradle.kts index 18ec477339..7095180735 100644 --- a/components/build.gradle.kts +++ b/components/build.gradle.kts @@ -1,3 +1,7 @@ +plugins { + kotlin("multiplatform") apply false +} + subprojects { version = findProperty("deploy.version") ?: property("compose.version")!! diff --git a/compose/frameworks/support b/compose/frameworks/support index fe220467ab..3ebf1d4460 160000 --- a/compose/frameworks/support +++ b/compose/frameworks/support @@ -1 +1 @@ -Subproject commit fe220467abcf2368966a051b732752513ffeceda +Subproject commit 3ebf1d446089cc8da34bb1b906982327af7b8249 diff --git a/compose/scripts/runGradle b/compose/scripts/runGradle new file mode 100755 index 0000000000..287bb586f2 --- /dev/null +++ b/compose/scripts/runGradle @@ -0,0 +1,8 @@ +#!/bin/bash + +cd "$(dirname "$0")" +. ./prepare + +pushd .. +./gradlew $COMPOSE_DEFAULT_GRADLE_ARGS "$@" || exit 1 +popd \ No newline at end of file diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt index 87f28ae123..c02b4003ca 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt @@ -19,6 +19,7 @@ import org.gradle.api.artifacts.repositories.MavenArtifactRepository import org.gradle.api.plugins.ExtensionAware import org.jetbrains.compose.android.AndroidExtension import org.jetbrains.compose.desktop.DesktopExtension +import org.jetbrains.compose.desktop.application.internal.ComposeProperties import org.jetbrains.compose.desktop.application.internal.configureApplicationImpl import org.jetbrains.compose.desktop.application.internal.currentTarget import org.jetbrains.compose.desktop.preview.internal.initializePreview @@ -58,7 +59,7 @@ class ComposePlugin : Plugin { project.configureExperimental(composeExtension, experimentalExtension) if (androidExtension.useAndroidX) { - println("useAndroidX is an experimental feature at the moment!") + project.logger.warn("useAndroidX is an experimental feature at the moment!") RedirectAndroidVariants.androidxVersion = androidExtension.androidxVersion listOf( RedirectAndroidVariants::class.java, @@ -125,12 +126,14 @@ class ComposePlugin : Plugin { } } - } - - project.tasks.withType(KotlinCompile::class.java) { - it.kotlinOptions.apply { - jvmTarget = "1.8".takeIf { jvmTarget.toDouble() < 1.8 } ?: jvmTarget - useIR = true + val overrideDefaultJvmTarget = ComposeProperties.overrideKotlinJvmTarget(project.providers).get() + project.tasks.withType(KotlinCompile::class.java) { + it.kotlinOptions.apply { + if (overrideDefaultJvmTarget) { + jvmTarget = "11".takeIf { jvmTarget.toDouble() < 11 } ?: jvmTarget + } + useIR = true + } } } } diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ComposeProjectProperties.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ComposeProjectProperties.kt index b032f42f2f..cdb20a40c9 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ComposeProjectProperties.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ComposeProjectProperties.kt @@ -10,6 +10,7 @@ import org.gradle.api.provider.ProviderFactory internal object ComposeProperties { internal const val VERBOSE = "compose.desktop.verbose" + internal const val OVERRIDE_KOTLIN_JVM_TARGET = "compose.desktop.override.default.kotlin.jvm.target" internal const val PRESERVE_WD = "compose.preserve.working.dir" internal const val MAC_SIGN = "compose.desktop.mac.sign" internal const val MAC_SIGN_ID = "compose.desktop.mac.signing.identity" @@ -22,6 +23,11 @@ internal object ComposeProperties { fun isVerbose(providers: ProviderFactory): Provider = providers.findProperty(VERBOSE).toBoolean() + fun overrideKotlinJvmTarget(providers: ProviderFactory): Provider = + providers.provider { + providers.findProperty(OVERRIDE_KOTLIN_JVM_TARGET)?.toString() != "false" + } + fun preserveWorkingDir(providers: ProviderFactory): Provider = providers.findProperty(PRESERVE_WD).toBoolean() diff --git a/gradle-plugins/compose/src/test/test-projects/init.gradle b/gradle-plugins/compose/src/test/test-projects/init.gradle index 7db1e57b4f..2fde7a8a5d 100644 --- a/gradle-plugins/compose/src/test/test-projects/init.gradle +++ b/gradle-plugins/compose/src/test/test-projects/init.gradle @@ -1,12 +1,3 @@ -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() @@ -16,19 +7,4 @@ allprojects { } 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