Skip to content

Commit

Permalink
Update versions + fix build (#44)
Browse files Browse the repository at this point in the history
* Update versions

* Remove deprecated properties

* Fix ios build

* Select xcode version

* Update Fruitties.yaml

* Remove pods + use xcodeproj

* Revert daemon

* Disable native toolchain
  • Loading branch information
mlykotom authored Jan 20, 2025
1 parent a35df69 commit f2a4eb3
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 83 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/Fruitties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ jobs:
name: Build iOS app
runs-on: macos-latest
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Checkout
uses: actions/checkout@v3

Expand All @@ -48,12 +52,6 @@ jobs:
distribution: 'zulu'
java-version: 17

- name: Initialize pods
working-directory: ./Fruitties
run: |
cd iosApp
pod install --verbose
- name: Build app
working-directory: ./Fruitties
run: xcodebuild -workspace iosApp/iosApp.xcworkspace -configuration Debug -scheme iosApp -sdk iphonesimulator
run: xcodebuild -project iosApp/iosApp.xcodeproj -configuration Debug -scheme iosApp -sdk iphonesimulator
1 change: 1 addition & 0 deletions Fruitties/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.spotless) apply false
alias(libs.plugins.androidKmpLibrary) apply false
}

subprojects {
Expand Down
5 changes: 2 additions & 3 deletions Fruitties/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ android.useAndroidX=true
android.nonTransitiveRClass=true

#KMP
kotlin.mpp.androidGradlePluginCompatibility.nowarn=true
# Disabled due to https://youtrack.jetbrains.com/issue/KT-65761
kotlin.native.disableCompilerDaemon = true
# Disabled due to https://youtrack.jetbrains.com/issue/KT-74278/
kotlin.native.toolchain.enabled=false
51 changes: 30 additions & 21 deletions Fruitties/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,33 @@
# limitations under the License.

[versions]
agp = "8.5.2"
androidx-activityCompose = "1.9.1"
androidx-paging = "3.3.2"
androidx-room = "2.7.0-alpha07"
androidx-lifecycle = "2.9.0-alpha01"
atomicfu = "0.23.1"
compose = "1.7.0-rc01"
compose-material3 = "1.2.1"
dataStoreVersion = "1.1.1"
kotlin = "2.0.10"
kotlinx-coroutines = "1.8.0"
kotlinxDatetime = "0.6.0-RC.2"
ksp = "2.0.10-1.0.24"
ktorVersion = "2.3.8"
pagingComposeAndroid = "3.3.2"
skie = "0.8.4"
sqlite = "2.5.0-alpha07"
spotless = "6.19.0"
agp = "8.8.0"
androidx-activityCompose = "1.10.0"
androidx-paging = "3.3.5"
androidx-room = "2.7.0-alpha12"
androidx-lifecycle = "2.9.0-alpha08"
atomicfu = "0.27.0"
compose = "1.7.6"
compose-material3 = "1.3.1"
dataStore = "1.1.2"
kotlin = "2.1.0"
kotlinx-coroutines = "1.10.1"
kotlinxDatetime = "0.6.1"
ksp = "2.1.0-1.0.29"
ktorVersion = "2.3.13"
pagingComposeAndroid = "3.3.5"
skie = "0.10.0"
sqlite = "2.5.0-alpha12"
spotless = "7.0.2"
okio = "3.10.2"
runner = "1.6.2"
core = "1.6.1"
junit = "1.2.1"

[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
androidx-datastore-core-okio = { group = "androidx.datastore", name = "datastore-core-okio", version.ref = "dataStoreVersion" }
androidx-datastore-preferences-core = { group = "androidx.datastore", name = "datastore-preferences-core", version.ref = "dataStoreVersion" }
androidx-datastore-core-okio = { group = "androidx.datastore", name = "datastore-core-okio", version.ref = "dataStore" }
androidx-datastore-preferences-core = { group = "androidx.datastore", name = "datastore-preferences-core", version.ref = "dataStore" }
androidx-paging-common = { module = "androidx.paging:paging-common", version.ref = "androidx-paging" }
androidx-paging-compose-android = { group = "androidx.paging", name = "paging-compose-android", version.ref = "pagingComposeAndroid" }
androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "androidx-room" }
Expand All @@ -59,15 +63,20 @@ ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktorVer
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktorVersion" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktorVersion" }
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktorVersion" }
okio = "com.squareup.okio:okio:3.9.0"
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
skie-annotations = { module = "co.touchlab.skie:configuration-annotations", version.ref = "skie" }
sqlite-bundled = { module = "androidx.sqlite:sqlite-bundled", version.ref = "sqlite" }
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
androidx-runner = { group = "androidx.test", name = "runner", version.ref = "runner" }
androidx-core = { group = "androidx.test", name = "core", version.ref = "core" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junit" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
androidKmpLibrary = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" }
kotlinCocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Expand Down
2 changes: 1 addition & 1 deletion Fruitties/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 3 additions & 2 deletions Fruitties/iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */;
buildPhases = (
7555FFB5242A651A00829871 /* ShellScript */,
7555FFB5242A651A00829871 /* Compile Kotlin Multiplatform */,
7555FF77242A565900829871 /* Sources */,
7555FF78242A565900829871 /* Frameworks */,
7555FF79242A565900829871 /* Resources */,
Expand Down Expand Up @@ -161,7 +161,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
7555FFB5242A651A00829871 /* ShellScript */ = {
7555FFB5242A651A00829871 /* Compile Kotlin Multiplatform */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -170,6 +170,7 @@
);
inputPaths = (
);
name = "Compile Kotlin Multiplatform";
outputFileListPaths = (
);
outputPaths = (
Expand Down
1 change: 1 addition & 0 deletions Fruitties/shared/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
151 changes: 102 additions & 49 deletions Fruitties/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,127 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.androidKmpLibrary)
alias(libs.plugins.kotlinxSerialization)
alias(libs.plugins.skie)
alias(libs.plugins.ksp)
alias(libs.plugins.room)
}

kotlin {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
androidTarget {
// compilerOptions DSL: https://kotl.in/u1r8ln
compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8)

// Target declarations - add or remove as needed below. These define
// which platforms this KMP module supports.
// See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets
androidLibrary {
namespace = "com.example.fruitties"
compileSdk = 35
minSdk = 26

withHostTestBuilder {
}

withDeviceTestBuilder {
sourceSetTreeName = "test"
}.configure {
instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
).forEach {
it.binaries.framework {
baseName = "shared"
isStatic = true

// For iOS targets, this is also where you should
// configure native binary output. For more information, see:
// https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#build-xcframeworks

// A step-by-step guide on how to include this library in an XCode
// project can be found here:
// https://developer.android.com/kotlin/multiplatform/migrate
val xcfName = "shared"

iosX64 {
binaries.framework {
baseName = xcfName
}
}

iosArm64 {
binaries.framework {
baseName = xcfName
}
}
sourceSets.all {
languageSettings.optIn("kotlin.experimental.ExperimentalObjCName")

iosSimulatorArm64 {
binaries.framework {
baseName = xcfName
}
}

// Source set declarations.
// Declaring a target automatically creates a source set with the same name. By default, the
// Kotlin Gradle Plugin creates additional source sets that depend on each other, since it is
// common to share sources between related targets.
// See: https://kotlinlang.org/docs/multiplatform-hierarchy.html
sourceSets {
commonMain.dependencies {
// put your multiplatform dependencies here
implementation(libs.kotlinx.datetime)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.skie.annotations)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.paging.common)
implementation(libs.androidx.room.runtime)
implementation(libs.sqlite.bundled)
implementation(libs.kotlinx.atomicfu)
api(libs.androidx.datastore.preferences.core)
api(libs.androidx.datastore.core.okio)
implementation(libs.okio)
all {
languageSettings.optIn("kotlin.experimental.ExperimentalObjCName")
}
commonTest.dependencies {

commonMain {
dependencies {
implementation(libs.kotlin.stdlib)
// Add KMP dependencies here
implementation(libs.kotlinx.datetime)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.skie.annotations)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.paging.common)
implementation(libs.androidx.room.runtime)
implementation(libs.sqlite.bundled)
implementation(libs.kotlinx.atomicfu)
api(libs.androidx.datastore.preferences.core)
api(libs.androidx.datastore.core.okio)
implementation(libs.okio)
}
}
androidMain.dependencies {
implementation(libs.ktor.client.okhttp)
implementation(libs.androidx.room.paging)

commonTest {
dependencies {
implementation(libs.kotlin.test)
}
}
iosMain.dependencies {
implementation(libs.ktor.client.darwin)

androidMain {
dependencies {
// Add Android-specific dependencies here. Note that this source set depends on
// commonMain by default and will correctly pull the Android artifacts of any KMP
// dependencies declared in commonMain.
implementation(libs.ktor.client.okhttp)
implementation(libs.androidx.room.paging)
}
}
}
}

android {
namespace = "com.example.fruitties"
compileSdk = 34
defaultConfig {
minSdk = 26
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
getByName("androidDeviceTest") {
dependencies {
implementation(libs.androidx.runner)
implementation(libs.androidx.core)
implementation(libs.androidx.junit)
}
}

iosMain {
dependencies {
// Add iOS-specific dependencies here. This a source set created by Kotlin Gradle
// Plugin (KGP) that each specific iOS target (e.g., iosX64) depends on as
// part of KMP’s default source set hierarchy. Note that this source set depends
// on common by default and will correctly pull the iOS artifacts of any
// KMP dependencies declared in commonMain.
implementation(libs.ktor.client.darwin)
}
}
}

}

dependencies {
Expand Down
4 changes: 4 additions & 0 deletions Fruitties/shared/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>

0 comments on commit f2a4eb3

Please sign in to comment.