Browse Source

Update Kotlin, dependencies and build scripts (#3835)

pull/3912/head
Konstantin 1 year 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 {
kotlin("multiplatform")
id("org.jetbrains.compose")
}
kotlin {
jvm {}
jvm()
sourceSets {
named("jvmMain") {
all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)
implementation(project(":AnimatedImage:library"))
@ -22,8 +24,4 @@ compose.desktop {
application {
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 {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -9,25 +6,22 @@ plugins {
kotlin {
jvm("desktop")
sourceSets {
named("commonMain") {
all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
val commonMain by getting {
dependencies {
api(compose.runtime)
api(compose.foundation)
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(
groupId = "org.jetbrains.compose.components",
artifactId = "components-animatedimage",

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

@ -1,5 +1,4 @@
import org.jetbrains.compose.compose
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("multiplatform")
@ -7,9 +6,15 @@ plugins {
}
kotlin {
jvm {}
jvm()
sourceSets {
named("jvmMain") {
all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)
implementation(project(":SplitPane:library"))
@ -22,8 +27,4 @@ compose.desktop {
application {
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 {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -11,21 +8,21 @@ kotlin {
jvm("desktop")
sourceSets {
named("commonMain") {
all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
val commonMain by getting {
dependencies {
api(compose.runtime)
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(
groupId = "org.jetbrains.compose.components",
artifactId = "components-splitpane",

9
components/build.gradle.kts

@ -3,15 +3,6 @@ plugins {
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 {
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.enableJetifier=true
kotlin.code.style=official
# __KOTLIN_COMPOSE_VERSION__
kotlin.version=1.8.22
# __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=1.5.10-rc01
agp.version=7.3.1
#Versions
kotlin.version=1.9.10
compose.version=1.5.3
agp.version=8.1.2
#Compose
org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.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
#Kotlin
kotlin.code.style=official
kotlin.js.compiler=ir
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
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
zipStorePath=wrapper/dists

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

@ -4,25 +4,25 @@ plugins {
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 {
compileSdk = 33
compileSdk = 34
namespace = "org.jetbrains.compose.resources.demo"
defaultConfig {
applicationId = "me.user.androidApp"
minSdk = 21
targetSdk = 33
targetSdk = 34
versionCode = 1
versionName = "1.0"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
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"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.jetbrains.compose.resources.demo">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"

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

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

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

@ -1,13 +1,21 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
plugins {
kotlin("multiplatform")
id("com.android.library")
id("org.jetbrains.compose")
}
version = "1.0-SNAPSHOT"
kotlin {
android()
@OptIn(ExperimentalKotlinGradlePluginApi::class)
targetHierarchy.default()
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "11"
}
}
}
jvm("desktop")
listOf(
iosX64(),
@ -19,19 +27,20 @@ kotlin {
isStatic = true
}
}
js(IR) {
browser()
binaries.executable()
}
macosX64 {
binaries {
executable {
entryPoint = "main"
}
js {
browser {
testTask(Action {
enabled = false
})
}
binaries.executable()
}
macosArm64 {
binaries {
listOf(
macosX64(),
macosArm64()
).forEach { macosTarget ->
macosTarget.binaries {
executable {
entryPoint = "main"
}
@ -48,56 +57,23 @@ kotlin {
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 {
dependencies {
implementation(compose.desktop.common)
}
}
val macosMain by creating {
dependsOn(commonMain)
}
val macosX64Main by getting {
dependsOn(macosMain)
}
val macosArm64Main by getting {
dependsOn(macosMain)
}
}
}
android {
compileSdk = 33
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
compileSdk = 34
namespace = "org.jetbrains.compose.resources.demo.shared"
defaultConfig {
minSdk = 21
targetSdk = 33
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
sourceSets {
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 {
kotlin("multiplatform")
@ -10,42 +10,68 @@ plugins {
val composeVersion = extra["compose.version"] as String
kotlin {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
targetHierarchy.default()
jvm("desktop")
android {
androidTarget {
publishLibraryVariants("release")
compilations.all {
kotlinOptions {
jvmTarget = "11"
}
}
}
ios()
iosX64()
iosArm64()
iosSimulatorArm64()
js(IR) {
browser()
js {
browser {
testTask(Action {
enabled = false
})
}
}
macosX64()
macosArm64()
sourceSets {
all {
languageSettings {
optIn("kotlin.RequiresOptIn")
optIn("kotlinx.cinterop.ExperimentalForeignApi")
}
}
val commonMain by getting {
dependencies {
implementation("org.jetbrains.compose.runtime:runtime:$composeVersion")
implementation("org.jetbrains.compose.foundation:foundation:$composeVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
}
}
val commonTest by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
implementation(kotlin("test"))
}
}
val commonButJSMain by creating {
dependsOn(commonMain)
}
val commonButJSTest by creating {
dependsOn(commonTest)
}
val skikoMain by creating {
dependsOn(commonMain)
}
val skikoTest by creating {
dependsOn(commonTest)
}
val jvmAndAndroidMain by creating {
dependsOn(commonMain)
}
val nativeMain by creating {
dependsOn(commonMain)
val jvmAndAndroidTest by creating {
dependsOn(commonTest)
}
val desktopMain by getting {
dependsOn(skikoMain)
@ -53,60 +79,61 @@ kotlin {
dependsOn(commonButJSMain)
}
val desktopTest by getting {
dependsOn(skikoTest)
dependsOn(jvmAndAndroidTest)
dependsOn(commonButJSTest)
dependencies {
implementation(compose.desktop.currentOs)
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 {
dependsOn(jvmAndAndroidMain)
dependsOn(commonButJSMain)
}
val androidTest by getting {
dependencies {
}
val androidInstrumentedTest by getting {
dependsOn(commonTest)
dependsOn(jvmAndAndroidTest)
dependsOn(commonButJSTest)
}
val iosMain by getting {
dependsOn(skikoMain)
dependsOn(commonButJSMain)
dependsOn(nativeMain)
}
val iosTest by getting
val iosSimulatorArm64Main by getting
iosSimulatorArm64Main.dependsOn(iosMain)
val iosSimulatorArm64Test by getting
iosSimulatorArm64Test.dependsOn(iosTest)
val iosTest by getting {
dependsOn(skikoTest)
dependsOn(commonButJSTest)
}
val jsMain by getting {
dependsOn(skikoMain)
}
val macosMain by creating {
val jsTest by getting {
dependsOn(skikoTest)
}
val macosMain by getting {
dependsOn(skikoMain)
dependsOn(commonButJSMain)
dependsOn(nativeMain)
}
val macosX64Main by getting {
dependsOn(macosMain)
}
val macosArm64Main by getting {
dependsOn(macosMain)
val macosTest by getting {
dependsOn(skikoTest)
dependsOn(commonButJSTest)
}
}
}
android {
compileSdk = 33
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
compileSdk = 34
namespace = "org.jetbrains.compose.components.resources"
defaultConfig {
minSdk = 21
targetSdk = 33
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
@Suppress("UnstableApiUsage")
testOptions {
managedDevices {
devices {
@ -118,20 +145,13 @@ android {
}
}
}
}
dependencies {
//Android integration tests
testImplementation("androidx.test:core:1.5.0")
androidTestImplementation("androidx.compose.ui:ui-test-manifest:1.3.1")
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"
dependencies {
//Android integration tests
testImplementation("androidx.test:core:1.5.0")
androidTestImplementation("androidx.compose.ui:ui-test-manifest:1.5.3")
androidTestImplementation("androidx.compose.ui:ui-test:1.5.3")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.5.3")
}
}
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 {
repositories {
google()
gradlePluginPortal()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google()
mavenLocal()
}
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:demo")
include(":AnimatedImage:library")
include("AnimatedImage:demo")
include(":AnimatedImage:demo")
include(":resources:library")
include(":resources:demo:androidApp")
include(":resources:demo:desktopApp")

Loading…
Cancel
Save