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

FIx Room #6

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 11 additions & 0 deletions compose-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ kotlin {

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "NewsComposeApp"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
implementation(projects.features.newsMain.ui)
Expand Down
11 changes: 11 additions & 0 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ kotlin {

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "CoreCommon"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
api(libs.kotlinx.coroutines.core)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dev.androidbroadcast.common

import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
import kotlinx.coroutines.MainCoroutineDispatcher

public class AppDispatchers(
Expand Down
11 changes: 11 additions & 0 deletions core/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ kotlin {

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "CoreData"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
implementation(libs.kotlinx.coroutines.core)
Expand Down
26 changes: 25 additions & 1 deletion core/database/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ kotlin {

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "CoreDatabase"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
implementation(libs.kotlinx.datetime)
Expand All @@ -28,6 +39,15 @@ kotlin {

androidMain.dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.sqlite.bundled)
}

jvmMain.dependencies {
implementation(libs.androidx.sqlite.bundled)
}

iosMain.dependencies {
implementation(libs.androidx.sqlite.bundled)
}
}
}
Expand Down Expand Up @@ -56,5 +76,9 @@ room {
}

dependencies {
ksp(libs.androidx.room.compiler)
add("kspJvm", libs.androidx.room.compiler)
add("kspAndroid", libs.androidx.room.compiler)
add("kspIosSimulatorArm64", libs.androidx.room.compiler)
add("kspIosX64", libs.androidx.room.compiler)
add("kspIosArm64", libs.androidx.room.compiler)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dev.androidbroadcast.news.database.models.ArticleDBO
import dev.androidbroadcast.news.database.utils.Converters
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO

class NewsDatabase internal constructor(private val database: NewsRoomDatabase) {
val articlesDao: ArticleDao
Expand Down
11 changes: 11 additions & 0 deletions core/opennews-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ kotlin {

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "CoreOpenNewsApi"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
implementation(libs.kotlinx.coroutines.core)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import io.ktor.serialization.kotlinx.json.json
import kotlinx.datetime.Instant
import kotlinx.serialization.SerialName
import kotlinx.serialization.json.Json
import kotlin.jvm.JvmSuppressWildcards

/**
* [API Documentation](https://newsapi.org/docs/get-started)
Expand Down
15 changes: 15 additions & 0 deletions core/platform/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ kotlin {

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "CorePlatform"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
api(projects.core.common)
Expand All @@ -32,6 +43,10 @@ kotlin {
jvmMain.dependencies {
implementation(libs.androidx.sqlite.bundled)
}

iosMain.dependencies {
implementation(libs.androidx.sqlite.bundled)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dev.androidbroadcast.news.core

import coil3.PlatformContext
import coil3.disk.DiskCache

internal actual fun newDiskCache(context: PlatformContext): DiskCache? {
TODO("Not yet implemented")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package dev.androidbroadcast.news.core

import androidx.room.Room
import androidx.room.RoomDatabase
import dev.androidbroadcast.common.Logger
import dev.androidbroadcast.news.database.NewsRoomDatabase
import org.koin.core.module.Module
import org.koin.dsl.module
import platform.Foundation.NSHomeDirectory

/**
* Koin Module with target platform specifics dependencies
*/
internal actual val targetKoinModule: Module = module {
factory<RoomDatabase.Builder<NewsRoomDatabase>> {
val dbFilePath = NSHomeDirectory() + "/my_room.db"
Room.databaseBuilder<NewsRoomDatabase>(
name = dbFilePath,
factory = { NewsRoomDatabase::class.instantiateImpl() }
)
}

factory<Logger> {
object : Logger {
override fun d(tag: String, message: String) {
}

override fun e(tag: String, message: String) {
}
}
}
}
11 changes: 11 additions & 0 deletions core/uikit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ kotlin {

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "CoreUiKit"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
api(compose.ui)
Expand Down
11 changes: 11 additions & 0 deletions features/news-main/ui-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ kotlin {

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "FeaturesNewsMainUiLogic"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
api(projects.core.data)
Expand Down
12 changes: 11 additions & 1 deletion features/news-main/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ kotlin {

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "FeaturesNewsMainUi"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
implementation(projects.features.newsMain.uiLogic)
Expand All @@ -33,7 +44,6 @@ kotlin {
implementation(libs.androidx.lifecycle.viewmodel)

implementation(compose.components.resources)
implementation(libs.androidx.lifecycle.viewmodel.compose)
}

androidMain.dependencies {
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache=true

kotlin.native.disableCompilerDaemon=true
3 changes: 3 additions & 0 deletions iosApp/Configuration/Config.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TEAM_ID=
BUNDLE_ID=dev.androidbroadcast.news.KotlinProject
APP_NAME=KotlinProject
Loading
Loading