Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin 2.0 + related dependencies #13

Merged
merged 1 commit into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@ Any updates to `boardStatus` or `boardGuesses` will trigger our SwiftUI UI to be
![Simulator Screen Shot - iPhone 13 Pro - 2022-01-08 at 22 38 11](https://user-images.githubusercontent.com/6302/148663064-3ed57b1f-c1a3-4e39-b2c2-2ddb3fb09ed9.png)

![Screenshot_1641682073](https://user-images.githubusercontent.com/6302/148663060-c1047266-425c-4b14-bdaf-b7177a1fa332.png)

## Full set of Kotlin Multiplatform/Compose/SwiftUI samples

* PeopleInSpace (https://github.com/joreilly/PeopleInSpace)
* GalwayBus (https://github.com/joreilly/GalwayBus)
* Confetti (https://github.com/joreilly/Confetti)
* BikeShare (https://github.com/joreilly/BikeShare)
* FantasyPremierLeague (https://github.com/joreilly/FantasyPremierLeague)
* ClimateTrace (https://github.com/joreilly/ClimateTraceKMP)
* GeminiKMP (https://github.com/joreilly/GeminiKMP)
* MortyComposeKMM (https://github.com/joreilly/MortyComposeKMM)
* StarWars (https://github.com/joreilly/StarWars)
* WordMasterKMP (https://github.com/joreilly/WordMasterKMP)
* Chip-8 (https://github.com/joreilly/chip-8)
42 changes: 14 additions & 28 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
plugins {
id("com.android.application")
kotlin("android")
alias(libs.plugins.compose.compiler)
}

android {
namespace = "dev.johnoreilly.wordmaster.androidApp"

compileSdk = AndroidSdk.compile
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
//applicationId = "dev.johnoreilly.wordle.androidApp"
minSdk = AndroidSdk.min
targetSdk = AndroidSdk.target
minSdk = libs.versions.android.minSdk.get().toInt()
compileSdk = libs.versions.android.targetSdk.get().toInt()

versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}


buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = Versions.composeCompiler
}

buildTypes {
getByName("release") {
isMinifyEnabled = false
Expand All @@ -43,26 +38,17 @@ android {
}



dependencies {
implementation(project(":shared"))

with (Compose) {
implementation(compiler)
implementation(ui)
implementation(uiGraphics)
implementation(uiTooling)
implementation(foundationLayout)
implementation(material)
implementation(navigation)
}

with(Test) {
testImplementation(junit)
androidTestImplementation(composeUiTest)
androidTestImplementation(composeUiTestJUnit)
debugImplementation(composeUiTestManifest)
}

implementation(Google.Accompanist.insets)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.foundation)
implementation(libs.androidx.compose.foundation.layout)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.runtime)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.compose.material3)
implementation(libs.accompanist.insets)
}
53 changes: 31 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven(url = "https://androidx.dev/storage/compose-compiler/repository")
}

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlinVersion}")
classpath("com.android.tools.build:gradle:8.2.0")
classpath("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:2.0.0-Beta1-1.0.15")
classpath("com.rickclephas.kmp:kmp-nativecoroutines-gradle-plugin:${Versions.kmpNativeCoroutines}")
}
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.kmpNativeCoroutines) apply false
}

allprojects {
repositories {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
maven(url = "https://androidx.dev/storage/compose-compiler/repository")
}
}
//buildscript {
// repositories {
// gradlePluginPortal()
// google()
// mavenCentral()
// maven(url = "https://androidx.dev/storage/compose-compiler/repository")
// }
//
// dependencies {
// classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlinVersion}")
// classpath("com.android.tools.build:gradle:8.2.0")
// classpath("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:2.0.0-Beta1-1.0.15")
// classpath("com.rickclephas.kmp:kmp-nativecoroutines-gradle-plugin:${Versions.kmpNativeCoroutines}")
// }
//}
//
//allprojects {
// repositories {
// google()
// mavenCentral()
// maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
// maven(url = "https://androidx.dev/storage/compose-compiler/repository")
// }
//}
1 change: 0 additions & 1 deletion buildSrc/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions buildSrc/build.gradle.kts

This file was deleted.

63 changes: 0 additions & 63 deletions buildSrc/src/main/java/Dependencies.kt

This file was deleted.

12 changes: 2 additions & 10 deletions compose-desktop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
plugins {
kotlin("jvm")
id("org.jetbrains.compose") version Versions.composeDesktopWeb
application
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.compose.compiler)
}

group = "me.joreilly"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

dependencies {
implementation(compose.desktop.currentOs)
implementation(project(":shared"))
Expand All @@ -21,7 +17,3 @@ application {
mainClass.set("MainKt")
}

compose {
kotlinCompilerPlugin.set("1.5.4-dev1-kt2.0.0-Beta1")
kotlinCompilerPluginArgs.add("suppressKotlinVersionCompatibilityCheck=2.0.0-Beta1")
}
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#Gradle
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"


kotlin.code.style=official
android.useAndroidX=true

Expand Down
42 changes: 42 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[versions]
kotlin = "2.0.0"
ksp = "2.0.0-1.0.21"
kotlinx-coroutines = "1.8.1"


agp = "8.4.1"
android-compileSdk = "34"
android-minSdk = "24"
android-targetSdk = "34"
androidx-activityCompose = "1.9.0"
androidxComposeBom = "2024.05.00"
compose-plugin = "1.6.10"
accompanist = "0.26.2-beta"
kmp-nativecoroutines = "1.0.0-ALPHA-31"
okio = "3.9.0"

[libraries]
kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }

androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" }
androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" }
androidx-compose-foundation-layout = { group = "androidx.compose.foundation", name = "foundation-layout" }
androidx-compose-material = { group = "androidx.compose.material", name = "material" }
androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" }
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
accompanist-insets = { module = "com.google.accompanist:accompanist-insets", version.ref = "accompanist" }
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }


[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kmpNativeCoroutines = { id = "com.rickclephas.kmp.nativecoroutines", version.ref = "kmp-nativecoroutines" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Jan 21 13:46:25 GMT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
12 changes: 10 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ pluginManagement {
google()
gradlePluginPortal()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
}
rootProject.name = "WordMasterKMP"

dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}



rootProject.name = "WordMasterKMP"
include(":androidApp", ":shared", "compose-desktop")

23 changes: 11 additions & 12 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
kotlin("multiplatform")
id("com.android.library")
id("com.google.devtools.ksp")
id("com.rickclephas.kmp.nativecoroutines")
alias(libs.plugins.ksp)
alias(libs.plugins.kmpNativeCoroutines)
}

kotlin {
Expand All @@ -21,15 +21,15 @@ kotlin {

sourceSets {
commonMain.dependencies {
api(Kotlinx.coroutinesCore)
implementation(Square.okio)
implementation(libs.kotlinx.coroutines)
implementation(libs.okio)
}

// commonTest.dependencies {
// implementation(Kotlinx.coroutinesTest)
// implementation(kotlin("test-common"))
// implementation(kotlin("test-annotations-common"))
// }
commonTest.dependencies {
implementation(libs.kotlinx.coroutines.test)
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}

val androidUnitTest by getting {
dependencies {
Expand All @@ -43,11 +43,10 @@ kotlin {
android {
namespace = "dev.johnoreilly.wordmaster.shared"

compileSdk = AndroidSdk.compile
compileSdk = libs.versions.android.compileSdk.get().toInt()
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = AndroidSdk.min
targetSdk = AndroidSdk.target
minSdk = libs.versions.android.minSdk.get().toInt()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
Expand Down
Loading