Skip to content

Commit

Permalink
Fix CI (#265)
Browse files Browse the repository at this point in the history
* fix android

* import kotlin.reflect.KClass

* fixed following JetBrains/compose-multiplatform#4831 (comment)
JetBrains/compose-multiplatform#4831

* isStatic = true

* macos-13

* Update standalone-sample.yml
  • Loading branch information
hoc081098 authored May 30, 2024
1 parent 88f90b0 commit 6885bf9
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/standalone-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
kmpviewmodel-compose-sample-android:
strategy:
matrix:
os: [ macos-11 ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
kmpviewmodel-compose-sample-ios:
strategy:
matrix:
os: [ macos-12 ]
os: [ macos-14 ]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
defaults:
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ compose-rules-detekt = "0.4.1"
androidx-lifecycle = "2.8.0"
androidx-annotation = "1.8.0"
androidx-activity = "1.9.0"
androidx-compose-compiler = "1.5.14-dev-k1.9.24-50022def4af" # TODO: back to stable version
androidx-compose-compiler = "1.5.14" # TODO: back to stable version
androidx-navigation = "2.7.7"
android-gradle = "8.4.0"

Expand Down
1 change: 1 addition & 0 deletions sample/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ kotlin {
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "shared"
isStatic = true

export(projects.viewmodel)
export(projects.viewmodelSavedstate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.android.app)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.multiplatform)
}

compose {
kotlinCompilerPlugin.set(libs.versions.jetbrains.compose.compiler)
}

kotlin {
androidTarget {
compilations.configureEach {
compilerOptions.configure {
jvmTarget.set(JvmTarget.fromTarget(libs.versions.java.target.get()))
}
}
}
}

repositories {
jcenter()
}
Expand Down Expand Up @@ -47,10 +57,6 @@ android {
}
}

kotlinOptions {
jvmTarget = JvmTarget.fromTarget(libs.versions.java.target.get()).target
}

buildFeatures {
buildConfig = true
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.hoc081098.kmp.viewmodel

import androidx.lifecycle.ViewModelProvider
import kotlin.reflect.KClass

public fun <VM : ViewModel> ViewModelFactory<VM>.toAndroidX(): ViewModelProvider.Factory =
object : ViewModelProvider.Factory {
override fun <T : androidx.lifecycle.ViewModel> create(modelClass: Class<T>, extras: CreationExtras): T {
override fun <T : androidx.lifecycle.ViewModel> create(modelClass: KClass<T>, extras: CreationExtras): T {
@Suppress("UNCHECKED_CAST")
return this@toAndroidX.create(extras) as T
}
Expand Down

0 comments on commit 6885bf9

Please # to comment.