Skip to content

Commit 2692cb3

Browse files
authored
Update Kotlin, dependencies and build scripts (JetBrains#3835)
1 parent c26ebac commit 2692cb3

File tree

18 files changed

+164
-181
lines changed

18 files changed

+164
-181
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import org.jetbrains.compose.compose
2-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3-
41
plugins {
52
kotlin("multiplatform")
63
id("org.jetbrains.compose")
74
}
85

96
kotlin {
10-
jvm {}
7+
jvm()
118
sourceSets {
12-
named("jvmMain") {
9+
all {
10+
languageSettings {
11+
optIn("kotlin.RequiresOptIn")
12+
}
13+
}
14+
val jvmMain by getting {
1315
dependencies {
1416
implementation(compose.desktop.currentOs)
1517
implementation(project(":AnimatedImage:library"))
@@ -22,8 +24,4 @@ compose.desktop {
2224
application {
2325
mainClass = "org.jetbrains.compose.animatedimage.demo.MainKt"
2426
}
25-
}
26-
27-
tasks.withType<KotlinCompile>().configureEach {
28-
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
2927
}

components/AnimatedImage/library/build.gradle.kts

+6-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import org.jetbrains.compose.compose
2-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3-
41
plugins {
52
kotlin("multiplatform")
63
id("org.jetbrains.compose")
@@ -9,25 +6,22 @@ plugins {
96

107
kotlin {
118
jvm("desktop")
12-
139
sourceSets {
14-
named("commonMain") {
10+
all {
11+
languageSettings {
12+
optIn("kotlin.RequiresOptIn")
13+
}
14+
}
15+
val commonMain by getting {
1516
dependencies {
1617
api(compose.runtime)
1718
api(compose.foundation)
1819
api(project(":resources:library"))
19-
2020
}
2121
}
22-
named("desktopMain") {}
2322
}
2423
}
2524

26-
// TODO it seems that argument isn't applied to the common sourceSet. Figure out why
27-
tasks.withType<KotlinCompile>().configureEach {
28-
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
29-
}
30-
3125
configureMavenPublication(
3226
groupId = "org.jetbrains.compose.components",
3327
artifactId = "components-animatedimage",
+8-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
import org.jetbrains.compose.compose
2-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
32

43
plugins {
54
kotlin("multiplatform")
65
id("org.jetbrains.compose")
76
}
87

98
kotlin {
10-
jvm {}
9+
jvm()
1110
sourceSets {
12-
named("jvmMain") {
11+
all {
12+
languageSettings {
13+
optIn("kotlin.RequiresOptIn")
14+
}
15+
}
16+
17+
val jvmMain by getting {
1318
dependencies {
1419
implementation(compose.desktop.currentOs)
1520
implementation(project(":SplitPane:library"))
@@ -22,8 +27,4 @@ compose.desktop {
2227
application {
2328
mainClass = "org.jetbrains.compose.splitpane.demo.MainKt"
2429
}
25-
}
26-
27-
tasks.withType<KotlinCompile>().configureEach {
28-
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
2930
}

components/SplitPane/library/build.gradle.kts

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import org.jetbrains.compose.compose
2-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3-
41
plugins {
52
kotlin("multiplatform")
63
id("org.jetbrains.compose")
@@ -11,21 +8,21 @@ kotlin {
118
jvm("desktop")
129

1310
sourceSets {
14-
named("commonMain") {
11+
all {
12+
languageSettings {
13+
optIn("kotlin.RequiresOptIn")
14+
}
15+
}
16+
17+
val commonMain by getting {
1518
dependencies {
1619
api(compose.runtime)
1720
api(compose.foundation)
1821
}
1922
}
20-
named("desktopMain") {}
2123
}
2224
}
2325

24-
// TODO it seems that argument isn't applied to the common sourceSet. Figure out why
25-
tasks.withType<KotlinCompile>().configureEach {
26-
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
27-
}
28-
2926
configureMavenPublication(
3027
groupId = "org.jetbrains.compose.components",
3128
artifactId = "components-splitpane",

components/build.gradle.kts

-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ plugins {
33
id("com.android.library") apply false
44
}
55

6-
allprojects {
7-
repositories {
8-
mavenLocal() // mavenLocal should be the first to get the correct version of skiko during a local build.
9-
google()
10-
mavenCentral()
11-
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
12-
}
13-
}
14-
156
subprojects {
167
version = findProperty("deploy.version") ?: property("compose.version")!!
178

components/gradle.properties

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
1+
#Gradle
2+
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
3+
org.gradle.caching=true
4+
#org.gradle.configuration-cache=true //stable since kotlin 1.9.20
5+
6+
#Android
27
android.useAndroidX=true
3-
android.enableJetifier=true
4-
kotlin.code.style=official
5-
# __KOTLIN_COMPOSE_VERSION__
6-
kotlin.version=1.8.22
7-
# __LATEST_COMPOSE_RELEASE_VERSION__
8-
compose.version=1.5.10-rc01
9-
agp.version=7.3.1
8+
9+
#Versions
10+
kotlin.version=1.9.10
11+
compose.version=1.5.3
12+
agp.version=8.1.2
13+
14+
#Compose
1015
org.jetbrains.compose.experimental.jscanvas.enabled=true
1116
org.jetbrains.compose.experimental.macos.enabled=true
1217
org.jetbrains.compose.experimental.uikit.enabled=true
13-
14-
kotlin.native.useEmbeddableCompilerJar=true
15-
kotlin.native.enableDependencyPropagation=false
16-
kotlin.mpp.enableGranularSourceSetsMetadata=true
17-
# Enable kotlin/native experimental memory model
18-
kotlin.native.binary.memoryModel=experimental
1918
compose.desktop.verbose=true
19+
20+
#Kotlin
21+
kotlin.code.style=official
22+
kotlin.js.compiler=ir
2023
kotlin.js.webpack.major.version=4
21-
xcodeproj=./resources/demo/iosApp
24+
kotlin.native.useEmbeddableCompilerJar=true
25+
kotlin.native.binary.memoryModel=experimental
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ plugins {
44
id("org.jetbrains.compose")
55
}
66

7-
dependencies {
8-
implementation(project(":resources:demo:shared"))
9-
implementation("androidx.appcompat:appcompat:1.5.1")
10-
implementation("androidx.activity:activity-compose:1.6.1")
11-
implementation("androidx.compose.foundation:foundation:1.3.1")
12-
implementation("androidx.compose.ui:ui:1.3.1")
13-
}
14-
157
android {
16-
compileSdk = 33
8+
compileSdk = 34
9+
namespace = "org.jetbrains.compose.resources.demo"
1710
defaultConfig {
1811
applicationId = "me.user.androidApp"
1912
minSdk = 21
20-
targetSdk = 33
13+
targetSdk = 34
2114
versionCode = 1
2215
versionName = "1.0"
2316
}
2417
compileOptions {
25-
sourceCompatibility = JavaVersion.VERSION_1_8
26-
targetCompatibility = JavaVersion.VERSION_1_8
18+
sourceCompatibility = JavaVersion.VERSION_11
19+
targetCompatibility = JavaVersion.VERSION_11
20+
}
21+
dependencies {
22+
implementation(project(":resources:demo:shared"))
23+
implementation("androidx.appcompat:appcompat:1.6.1")
24+
implementation("androidx.activity:activity-compose:1.8.0")
25+
implementation("androidx.compose.foundation:foundation:1.5.3")
26+
implementation("androidx.compose.ui:ui:1.5.3")
2727
}
2828
}

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="org.jetbrains.compose.resources.demo">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

54
<application
65
android:allowBackup="true"

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
kotlin {
7-
jvm {}
7+
jvm()
88
sourceSets {
99
val jvmMain by getting {
1010
dependencies {

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

+27-51
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
2+
13
plugins {
24
kotlin("multiplatform")
35
id("com.android.library")
46
id("org.jetbrains.compose")
57
}
68

7-
version = "1.0-SNAPSHOT"
8-
99
kotlin {
10-
android()
10+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
11+
targetHierarchy.default()
12+
androidTarget {
13+
compilations.all {
14+
kotlinOptions {
15+
jvmTarget = "11"
16+
}
17+
}
18+
}
1119
jvm("desktop")
1220
listOf(
1321
iosX64(),
@@ -19,19 +27,20 @@ kotlin {
1927
isStatic = true
2028
}
2129
}
22-
js(IR) {
23-
browser()
24-
binaries.executable()
25-
}
26-
macosX64 {
27-
binaries {
28-
executable {
29-
entryPoint = "main"
30-
}
30+
js {
31+
browser {
32+
testTask(Action {
33+
enabled = false
34+
})
3135
}
36+
binaries.executable()
3237
}
33-
macosArm64 {
34-
binaries {
38+
39+
listOf(
40+
macosX64(),
41+
macosArm64()
42+
).forEach { macosTarget ->
43+
macosTarget.binaries {
3544
executable {
3645
entryPoint = "main"
3746
}
@@ -48,56 +57,23 @@ kotlin {
4857
implementation(project(":resources:library"))
4958
}
5059
}
51-
val iosMain by creating {
52-
dependsOn(commonMain)
53-
}
54-
val iosTest by creating {
55-
}
56-
val iosX64Main by getting {
57-
dependsOn(iosMain)
58-
}
59-
val iosArm64Main by getting {
60-
dependsOn(iosMain)
61-
}
62-
val iosSimulatorArm64Main by getting {
63-
dependsOn(iosMain)
64-
}
65-
val iosX64Test by getting {
66-
dependsOn(iosMain)
67-
}
68-
val iosArm64Test by getting {
69-
dependsOn(iosMain)
70-
}
71-
val iosSimulatorArm64Test by getting {
72-
dependsOn(iosMain)
73-
}
7460
val desktopMain by getting {
7561
dependencies {
7662
implementation(compose.desktop.common)
7763
}
7864
}
79-
val macosMain by creating {
80-
dependsOn(commonMain)
81-
}
82-
val macosX64Main by getting {
83-
dependsOn(macosMain)
84-
}
85-
val macosArm64Main by getting {
86-
dependsOn(macosMain)
87-
}
8865
}
8966
}
9067

9168
android {
92-
compileSdk = 33
93-
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
69+
compileSdk = 34
70+
namespace = "org.jetbrains.compose.resources.demo.shared"
9471
defaultConfig {
9572
minSdk = 21
96-
targetSdk = 33
9773
}
9874
compileOptions {
99-
sourceCompatibility = JavaVersion.VERSION_1_8
100-
targetCompatibility = JavaVersion.VERSION_1_8
75+
sourceCompatibility = JavaVersion.VERSION_11
76+
targetCompatibility = JavaVersion.VERSION_11
10177
}
10278
sourceSets {
10379
named("main") {

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

-2
This file was deleted.

0 commit comments

Comments
 (0)