Browse Source

Update Kotlin, dependencies and build scripts (#3835)

pull/3912/head
Konstantin 7 months ago committed by GitHub
parent
commit
2692cb320d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      components/AnimatedImage/demo/build.gradle.kts
  2. 18
      components/AnimatedImage/library/build.gradle.kts
  3. 15
      components/SplitPane/demo/build.gradle.kts
  4. 17
      components/SplitPane/library/build.gradle.kts
  5. 9
      components/build.gradle.kts
  6. 34
      components/gradle.properties
  7. 2
      components/gradle/wrapper/gradle-wrapper.properties
  8. 24
      components/resources/demo/androidApp/build.gradle.kts
  9. 3
      components/resources/demo/androidApp/src/main/AndroidManifest.xml
  10. 2
      components/resources/demo/desktopApp/build.gradle.kts
  11. 78
      components/resources/demo/shared/build.gradle.kts
  12. 2
      components/resources/demo/shared/src/androidMain/AndroidManifest.xml
  13. 110
      components/resources/library/build.gradle.kts
  14. 0
      components/resources/library/src/androidInstrumentedTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt
  15. 0
      components/resources/library/src/androidInstrumentedTest/resources/1.png
  16. 0
      components/resources/library/src/androidInstrumentedTest/resources/2.png
  17. 2
      components/resources/library/src/androidMain/AndroidManifest.xml
  18. 13
      components/settings.gradle.kts

16
components/AnimatedImage/demo/build.gradle.kts

@ -1,15 +1,17 @@
import org.jetbrains.compose.compose
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
kotlin { kotlin {
jvm {} jvm()
sourceSets { sourceSets {
named("jvmMain") { all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
val jvmMain by getting {
dependencies { dependencies {
implementation(compose.desktop.currentOs) implementation(compose.desktop.currentOs)
implementation(project(":AnimatedImage:library")) implementation(project(":AnimatedImage:library"))
@ -22,8 +24,4 @@ compose.desktop {
application { application {
mainClass = "org.jetbrains.compose.animatedimage.demo.MainKt" mainClass = "org.jetbrains.compose.animatedimage.demo.MainKt"
} }
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
} }

18
components/AnimatedImage/library/build.gradle.kts

@ -1,6 +1,3 @@
import org.jetbrains.compose.compose
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
id("org.jetbrains.compose") id("org.jetbrains.compose")
@ -9,25 +6,22 @@ plugins {
kotlin { kotlin {
jvm("desktop") jvm("desktop")
sourceSets { sourceSets {
named("commonMain") { all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
val commonMain by getting {
dependencies { dependencies {
api(compose.runtime) api(compose.runtime)
api(compose.foundation) api(compose.foundation)
api(project(":resources:library")) api(project(":resources:library"))
} }
} }
named("desktopMain") {}
} }
} }
// TODO it seems that argument isn't applied to the common sourceSet. Figure out why
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
configureMavenPublication( configureMavenPublication(
groupId = "org.jetbrains.compose.components", groupId = "org.jetbrains.compose.components",
artifactId = "components-animatedimage", artifactId = "components-animatedimage",

15
components/SplitPane/demo/build.gradle.kts

@ -1,5 +1,4 @@
import org.jetbrains.compose.compose import org.jetbrains.compose.compose
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
@ -7,9 +6,15 @@ plugins {
} }
kotlin { kotlin {
jvm {} jvm()
sourceSets { sourceSets {
named("jvmMain") { all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
val jvmMain by getting {
dependencies { dependencies {
implementation(compose.desktop.currentOs) implementation(compose.desktop.currentOs)
implementation(project(":SplitPane:library")) implementation(project(":SplitPane:library"))
@ -22,8 +27,4 @@ compose.desktop {
application { application {
mainClass = "org.jetbrains.compose.splitpane.demo.MainKt" mainClass = "org.jetbrains.compose.splitpane.demo.MainKt"
} }
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
} }

17
components/SplitPane/library/build.gradle.kts

@ -1,6 +1,3 @@
import org.jetbrains.compose.compose
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
id("org.jetbrains.compose") id("org.jetbrains.compose")
@ -11,21 +8,21 @@ kotlin {
jvm("desktop") jvm("desktop")
sourceSets { sourceSets {
named("commonMain") { all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
val commonMain by getting {
dependencies { dependencies {
api(compose.runtime) api(compose.runtime)
api(compose.foundation) api(compose.foundation)
} }
} }
named("desktopMain") {}
} }
} }
// TODO it seems that argument isn't applied to the common sourceSet. Figure out why
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
configureMavenPublication( configureMavenPublication(
groupId = "org.jetbrains.compose.components", groupId = "org.jetbrains.compose.components",
artifactId = "components-splitpane", artifactId = "components-splitpane",

9
components/build.gradle.kts

@ -3,15 +3,6 @@ plugins {
id("com.android.library") apply false id("com.android.library") apply false
} }
allprojects {
repositories {
mavenLocal() // mavenLocal should be the first to get the correct version of skiko during a local build.
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
}
subprojects { subprojects {
version = findProperty("deploy.version") ?: property("compose.version")!! version = findProperty("deploy.version") ?: property("compose.version")!!

34
components/gradle.properties

@ -1,21 +1,25 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 #Gradle
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
org.gradle.caching=true
#org.gradle.configuration-cache=true //stable since kotlin 1.9.20
#Android
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official #Versions
# __KOTLIN_COMPOSE_VERSION__ kotlin.version=1.9.10
kotlin.version=1.8.22 compose.version=1.5.3
# __LATEST_COMPOSE_RELEASE_VERSION__ agp.version=8.1.2
compose.version=1.5.10-rc01
agp.version=7.3.1 #Compose
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.native.useEmbeddableCompilerJar=true
kotlin.native.enableDependencyPropagation=false
kotlin.mpp.enableGranularSourceSetsMetadata=true
# Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental
compose.desktop.verbose=true compose.desktop.verbose=true
#Kotlin
kotlin.code.style=official
kotlin.js.compiler=ir
kotlin.js.webpack.major.version=4 kotlin.js.webpack.major.version=4
xcodeproj=./resources/demo/iosApp kotlin.native.useEmbeddableCompilerJar=true
kotlin.native.binary.memoryModel=experimental

2
components/gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

24
components/resources/demo/androidApp/build.gradle.kts

@ -4,25 +4,25 @@ plugins {
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
dependencies {
implementation(project(":resources:demo:shared"))
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("androidx.activity:activity-compose:1.6.1")
implementation("androidx.compose.foundation:foundation:1.3.1")
implementation("androidx.compose.ui:ui:1.3.1")
}
android { android {
compileSdk = 33 compileSdk = 34
namespace = "org.jetbrains.compose.resources.demo"
defaultConfig { defaultConfig {
applicationId = "me.user.androidApp" applicationId = "me.user.androidApp"
minSdk = 21 minSdk = 21
targetSdk = 33 targetSdk = 34
versionCode = 1 versionCode = 1
versionName = "1.0" versionName = "1.0"
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
implementation(project(":resources:demo:shared"))
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.activity:activity-compose:1.8.0")
implementation("androidx.compose.foundation:foundation:1.5.3")
implementation("androidx.compose.ui:ui:1.5.3")
} }
} }

3
components/resources/demo/androidApp/src/main/AndroidManifest.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android">
package="org.jetbrains.compose.resources.demo">
<application <application
android:allowBackup="true" android:allowBackup="true"

2
components/resources/demo/desktopApp/build.gradle.kts

@ -4,7 +4,7 @@ plugins {
} }
kotlin { kotlin {
jvm {} jvm()
sourceSets { sourceSets {
val jvmMain by getting { val jvmMain by getting {
dependencies { dependencies {

78
components/resources/demo/shared/build.gradle.kts

@ -1,13 +1,21 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
id("com.android.library") id("com.android.library")
id("org.jetbrains.compose") id("org.jetbrains.compose")
} }
version = "1.0-SNAPSHOT"
kotlin { kotlin {
android() @OptIn(ExperimentalKotlinGradlePluginApi::class)
targetHierarchy.default()
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "11"
}
}
}
jvm("desktop") jvm("desktop")
listOf( listOf(
iosX64(), iosX64(),
@ -19,19 +27,20 @@ kotlin {
isStatic = true isStatic = true
} }
} }
js(IR) { js {
browser() browser {
binaries.executable() testTask(Action {
} enabled = false
macosX64 { })
binaries {
executable {
entryPoint = "main"
}
} }
binaries.executable()
} }
macosArm64 {
binaries { listOf(
macosX64(),
macosArm64()
).forEach { macosTarget ->
macosTarget.binaries {
executable { executable {
entryPoint = "main" entryPoint = "main"
} }
@ -48,56 +57,23 @@ kotlin {
implementation(project(":resources:library")) implementation(project(":resources:library"))
} }
} }
val iosMain by creating {
dependsOn(commonMain)
}
val iosTest by creating {
}
val iosX64Main by getting {
dependsOn(iosMain)
}
val iosArm64Main by getting {
dependsOn(iosMain)
}
val iosSimulatorArm64Main by getting {
dependsOn(iosMain)
}
val iosX64Test by getting {
dependsOn(iosMain)
}
val iosArm64Test by getting {
dependsOn(iosMain)
}
val iosSimulatorArm64Test by getting {
dependsOn(iosMain)
}
val desktopMain by getting { val desktopMain by getting {
dependencies { dependencies {
implementation(compose.desktop.common) implementation(compose.desktop.common)
} }
} }
val macosMain by creating {
dependsOn(commonMain)
}
val macosX64Main by getting {
dependsOn(macosMain)
}
val macosArm64Main by getting {
dependsOn(macosMain)
}
} }
} }
android { android {
compileSdk = 33 compileSdk = 34
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") namespace = "org.jetbrains.compose.resources.demo.shared"
defaultConfig { defaultConfig {
minSdk = 21 minSdk = 21
targetSdk = 33
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
sourceSets { sourceSets {
named("main") { named("main") {

2
components/resources/demo/shared/src/androidMain/AndroidManifest.xml

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.jetbrains.compose.resources.demo.shared"/>

110
components/resources/library/build.gradle.kts

@ -1,4 +1,4 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
@ -10,42 +10,68 @@ plugins {
val composeVersion = extra["compose.version"] as String val composeVersion = extra["compose.version"] as String
kotlin { kotlin {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
targetHierarchy.default()
jvm("desktop") jvm("desktop")
android { androidTarget {
publishLibraryVariants("release") publishLibraryVariants("release")
compilations.all {
kotlinOptions {
jvmTarget = "11"
}
}
} }
ios() iosX64()
iosArm64()
iosSimulatorArm64() iosSimulatorArm64()
js(IR) { js {
browser() browser {
testTask(Action {
enabled = false
})
}
} }
macosX64() macosX64()
macosArm64() macosArm64()
sourceSets { sourceSets {
all {
languageSettings {
optIn("kotlin.RequiresOptIn")
optIn("kotlinx.cinterop.ExperimentalForeignApi")
}
}
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
implementation("org.jetbrains.compose.runtime:runtime:$composeVersion") implementation("org.jetbrains.compose.runtime:runtime:$composeVersion")
implementation("org.jetbrains.compose.foundation:foundation:$composeVersion") implementation("org.jetbrains.compose.foundation:foundation:$composeVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
} }
} }
val commonTest by getting { val commonTest by getting {
dependencies { dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
implementation(kotlin("test")) implementation(kotlin("test"))
} }
} }
val commonButJSMain by creating { val commonButJSMain by creating {
dependsOn(commonMain) dependsOn(commonMain)
} }
val commonButJSTest by creating {
dependsOn(commonTest)
}
val skikoMain by creating { val skikoMain by creating {
dependsOn(commonMain) dependsOn(commonMain)
} }
val skikoTest by creating {
dependsOn(commonTest)
}
val jvmAndAndroidMain by creating { val jvmAndAndroidMain by creating {
dependsOn(commonMain) dependsOn(commonMain)
} }
val nativeMain by creating { val jvmAndAndroidTest by creating {
dependsOn(commonMain) dependsOn(commonTest)
} }
val desktopMain by getting { val desktopMain by getting {
dependsOn(skikoMain) dependsOn(skikoMain)
@ -53,60 +79,61 @@ kotlin {
dependsOn(commonButJSMain) dependsOn(commonButJSMain)
} }
val desktopTest by getting { val desktopTest by getting {
dependsOn(skikoTest)
dependsOn(jvmAndAndroidTest)
dependsOn(commonButJSTest)
dependencies { dependencies {
implementation(compose.desktop.currentOs) implementation(compose.desktop.currentOs)
implementation("org.jetbrains.compose.ui:ui-test-junit4:$composeVersion") implementation("org.jetbrains.compose.ui:ui-test-junit4:$composeVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.6.4") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.7.3")
} }
} }
val androidMain by getting { val androidMain by getting {
dependsOn(jvmAndAndroidMain) dependsOn(jvmAndAndroidMain)
dependsOn(commonButJSMain) dependsOn(commonButJSMain)
} }
val androidTest by getting { val androidInstrumentedTest by getting {
dependencies { dependsOn(commonTest)
dependsOn(jvmAndAndroidTest)
} dependsOn(commonButJSTest)
} }
val iosMain by getting { val iosMain by getting {
dependsOn(skikoMain) dependsOn(skikoMain)
dependsOn(commonButJSMain) dependsOn(commonButJSMain)
dependsOn(nativeMain)
} }
val iosTest by getting val iosTest by getting {
val iosSimulatorArm64Main by getting dependsOn(skikoTest)
iosSimulatorArm64Main.dependsOn(iosMain) dependsOn(commonButJSTest)
val iosSimulatorArm64Test by getting }
iosSimulatorArm64Test.dependsOn(iosTest)
val jsMain by getting { val jsMain by getting {
dependsOn(skikoMain) dependsOn(skikoMain)
} }
val macosMain by creating { val jsTest by getting {
dependsOn(skikoTest)
}
val macosMain by getting {
dependsOn(skikoMain) dependsOn(skikoMain)
dependsOn(commonButJSMain) dependsOn(commonButJSMain)
dependsOn(nativeMain)
}
val macosX64Main by getting {
dependsOn(macosMain)
} }
val macosArm64Main by getting { val macosTest by getting {
dependsOn(macosMain) dependsOn(skikoTest)
dependsOn(commonButJSTest)
} }
} }
} }
android { android {
compileSdk = 33 compileSdk = 34
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") namespace = "org.jetbrains.compose.components.resources"
defaultConfig { defaultConfig {
minSdk = 21 minSdk = 21
targetSdk = 33
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
@Suppress("UnstableApiUsage")
testOptions { testOptions {
managedDevices { managedDevices {
devices { devices {
@ -118,20 +145,13 @@ android {
} }
} }
} }
} dependencies {
//Android integration tests
dependencies { testImplementation("androidx.test:core:1.5.0")
//Android integration tests androidTestImplementation("androidx.compose.ui:ui-test-manifest:1.5.3")
testImplementation("androidx.test:core:1.5.0") androidTestImplementation("androidx.compose.ui:ui-test:1.5.3")
androidTestImplementation("androidx.compose.ui:ui-test-manifest:1.3.1") androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.5.3")
androidTestImplementation("androidx.compose.ui:ui-test:1.3.1") }
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.3.1")
androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
}
// TODO it seems that argument isn't applied to the common sourceSet. Figure out why
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
} }
configureMavenPublication( configureMavenPublication(

0
components/resources/library/src/androidAndroidTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt → components/resources/library/src/androidInstrumentedTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt

0
components/resources/library/src/androidAndroidTest/resources/1.png → components/resources/library/src/androidInstrumentedTest/resources/1.png

Before

Width:  |  Height:  |  Size: 946 B

After

Width:  |  Height:  |  Size: 946 B

0
components/resources/library/src/androidAndroidTest/resources/2.png → components/resources/library/src/androidInstrumentedTest/resources/2.png

Before

Width:  |  Height:  |  Size: 785 B

After

Width:  |  Height:  |  Size: 785 B

2
components/resources/library/src/androidMain/AndroidManifest.xml

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.jetbrains.compose.components.resources"/>

13
components/settings.gradle.kts

@ -1,10 +1,9 @@
pluginManagement { pluginManagement {
repositories { repositories {
google()
gradlePluginPortal() gradlePluginPortal()
mavenCentral() mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google()
mavenLocal()
} }
plugins { plugins {
@ -15,10 +14,18 @@ pluginManagement {
} }
} }
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
}
include(":SplitPane:library") include(":SplitPane:library")
include(":SplitPane:demo") include(":SplitPane:demo")
include(":AnimatedImage:library") include(":AnimatedImage:library")
include("AnimatedImage:demo") include(":AnimatedImage:demo")
include(":resources:library") include(":resources:library")
include(":resources:demo:androidApp") include(":resources:demo:androidApp")
include(":resources:demo:desktopApp") include(":resources:demo:desktopApp")

Loading…
Cancel
Save