Skip to content

Commit

Permalink
Enable iOS to include KMP resources
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Jul 29, 2024
1 parent ff9ec20 commit f3ddce5
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class KmpComposePlugin : Plugin<Project> {
}
val compose = extensions.get("compose") as org.jetbrains.compose.ComposeExtension
compose.extensions.configure<ResourcesExtension> {
publicResClass = false
publicResClass = true
}
kotlin {
with(sourceSets) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,25 @@ class KmpSkiePlugin : Plugin<Project> {

project.extensions.configure(co.touchlab.skie.plugin.configuration.SkieExtension::class.java) {
features {
// Workaround for the error of
// static member 'shared' cannot be used on instance of type 'Res'
// https://slack-chats.kotlinlang.org/t/18882065/should-skie-work-with-the-multiplatform-resources-functional#60c3f44d-5e92-430c-9f05-3e3b34bb30a0
val resourceClasses = listOf(
"conference_app_2024.feature.about.generated.resources.Res",
"conference_app_2024.feature.contributors.generated.resources.Res",
"conference_app_2024.feature.eventmap.generated.resources.Res",
"conference_app_2024.feature.main.generated.resources.Res",
"conference_app_2024.feature.profilecard.generated.resources.Res",
"conference_app_2024.feature.sessions.generated.resources.Res",
"conference_app_2024.feature.staff.generated.resources.Res",
"conference_app_2024.core.designsystem.generated.resources.Res",
"conference_app_2024.core.data.generated.resources.Res",
"conference_app_2024.core.model.generated.resources.Res",
"conference_app_2024.appiosshared.generated.resources.Res",
)
resourceClasses.forEach { resourceClass ->
group(resourceClass) {
SuspendInterop.Enabled(false)
}
}

group {
coroutinesInterop.set(true)
SuspendInterop.Enabled(true)
FlowInterop.Enabled(true)
// DefaultArgumentInterop.Enabled(true)
SealedInterop.Enabled(true)
}
// Workaround for the error of
// static member 'shared' cannot be used on instance of type 'Res'
// https://slack-chats.kotlinlang.org/t/18882065/should-skie-work-with-the-multiplatform-resources-functional#60c3f44d-5e92-430c-9f05-3e3b34bb30a0
rootProject.allprojects {
val project = this
val resClassName = "conference_app_2024" + project.path
.replace(":", ".")
.replace("-", "_") + ".generated.resources.Res"
group(resClassName) {
SuspendInterop.Enabled(false)
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.droidkaigi.confsched.designsystem

import conference_app_2024.core.designsystem.generated.resources.Res

internal object DesignSystemRes {
object DesignSystemRes {
val drawable = Res.drawable
val string = Res.string
val font = Res.font
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.droidkaigi.confsched.about

import conference_app_2024.feature.about.generated.resources.Res

internal object AboutRes {
object AboutRes {
val string = Res.string
val drawable = Res.drawable
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.droidkaigi.confsched.contributors

import conference_app_2024.feature.contributors.generated.resources.Res

internal object ContributorsRes {
object ContributorsRes {
val drawable = Res.drawable
val string = Res.string
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.droidkaigi.confsched.eventmap

import conference_app_2024.feature.eventmap.generated.resources.Res

internal object EventMapRes {
object EventMapRes {
val drawable = Res.drawable
val string = Res.string
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.droidkaigi.confsched.main

import conference_app_2024.feature.main.generated.resources.Res

internal object MainRes {
object MainRes {
val drawable = Res.drawable
val string = Res.string
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.droidkaigi.confshed.profilecard

import conference_app_2024.feature.profilecard.generated.resources.Res

internal object ProfileCardRes {
object ProfileCardRes {
val drawable = Res.drawable
val string = Res.string
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.droidkaigi.confsched.sessions

import conference_app_2024.feature.sessions.generated.resources.Res

internal object SessionsRes {
object SessionsRes {
val string = Res.string
val drawable = Res.drawable
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.droidkaigi.confsched.staff

import conference_app_2024.feature.staff.generated.resources.Res

internal object StaffRes {
object StaffRes {
val drawable = Res.drawable
val string = Res.string
}

0 comments on commit f3ddce5

Please sign in to comment.