From f468142d2842ae507a35312dd5dcbcc3b10f726d Mon Sep 17 00:00:00 2001 From: Yang Date: Sun, 12 Nov 2023 20:17:53 +1100 Subject: [PATCH] Rename modules. --- android/app/build.gradle.kts | 10 +++--- .../kstreamlined/android/di/EdgeDataModule.kt | 12 +++---- .../android/di/CloudDataModule.kt | 12 +++---- .../android/di/NetworkingModule.kt | 2 +- .../kstreamlined/android/di/MockDataModule.kt | 12 +++---- .../common}/build.gradle.kts | 4 +-- .../common}/src/main/AndroidManifest.xml | 0 .../common}/src/main/res/values/strings.xml | 0 .../kstreamlined/kmp/data/feed/FeedRepo.kt | 16 --------- .../common}/build.gradle.kts | 0 .../kmp/datasource/FeedDataSource.kt | 16 +++++++++ .../kmp/datasource}/model/FeedEntry.kt | 2 +- .../kmp/datasource}/model/FeedSource.kt | 2 +- .../kmp/datasource}/util/ApiErrorChecker.kt | 2 +- .../runtime-cloud}/build.gradle.kts | 2 +- .../kstreamlined/graphql/FeedEntries.graphql | 0 .../kstreamlined/graphql/FeedSources.graphql | 0 .../kstreamlined/graphql/schema.graphqls | 0 .../kmp/datasource/CloudFeedDataSource.kt} | 14 ++++---- .../datasource}/mapper/FeedEntryMappers.kt | 4 +-- .../datasource}/mapper/FeedSourceMappers.kt | 4 +-- .../networking/ApolloClientConfigs.kt | 2 +- .../networking/DefaultFetchPolicy.kt | 2 +- .../datasource}/util/ApolloApiErrorChecker.kt | 2 +- .../datasource/CloudFeedDataSourceTest.kt} | 34 +++++++++---------- .../mapper/FeedEntryMappersTest.kt | 4 +-- .../mapper/FeedSourceMappersTest.kt | 4 +-- .../util/ApolloApiErrorCheckerTest.kt | 2 +- .../runtime-edge}/build.gradle.kts | 2 +- .../kmp/datasource/EdgeFeedDataSource.kt} | 8 ++--- .../datasource}/util/KtorApiErrorChecker.kt | 2 +- .../testing}/build.gradle.kts | 2 +- .../kmp/datasource}/FakeFeedData.kt | 6 ++-- .../kmp/datasource/FakeFeedDataSource.kt} | 8 ++--- .../datasource}/util/NoOpApiErrorChecker.kt | 2 +- .../kmp/datasource/FakeFeedDataSourceTest.kt} | 22 ++++++------ settings.gradle.kts | 10 +++--- 37 files changed, 112 insertions(+), 114 deletions(-) rename android/{ui/ui-common => feature/common}/build.gradle.kts (89%) rename android/{ui/ui-common => feature/common}/src/main/AndroidManifest.xml (100%) rename android/{ui/ui-common => feature/common}/src/main/res/values/strings.xml (100%) delete mode 100644 kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FeedRepo.kt rename kmp/{data-common => datasource/common}/build.gradle.kts (100%) create mode 100644 kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FeedDataSource.kt rename kmp/{data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed => datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/model/FeedEntry.kt (94%) rename kmp/{data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed => datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/model/FeedSource.kt (77%) rename kmp/{data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data => datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/util/ApiErrorChecker.kt (76%) rename kmp/{data-runtime-cloud => datasource/runtime-cloud}/build.gradle.kts (95%) rename kmp/{data-runtime-cloud => datasource/runtime-cloud}/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedEntries.graphql (100%) rename kmp/{data-runtime-cloud => datasource/runtime-cloud}/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedSources.graphql (100%) rename kmp/{data-runtime-cloud => datasource/runtime-cloud}/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/schema.graphqls (100%) rename kmp/{data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/CloudFeedRepo.kt => datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/CloudFeedDataSource.kt} (69%) rename kmp/{data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed => datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/mapper/FeedEntryMappers.kt (93%) rename kmp/{data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed => datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/mapper/FeedSourceMappers.kt (88%) rename kmp/{data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data => datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/networking/ApolloClientConfigs.kt (89%) rename kmp/{data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data => datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/networking/DefaultFetchPolicy.kt (86%) rename kmp/{data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data => datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/util/ApolloApiErrorChecker.kt (91%) rename kmp/{data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/CloudFeedRepoTest.kt => datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/CloudFeedDataSourceTest.kt} (86%) rename kmp/{data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed => datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/mapper/FeedEntryMappersTest.kt (97%) rename kmp/{data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed => datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/mapper/FeedSourceMappersTest.kt (92%) rename kmp/{data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data => datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/util/ApolloApiErrorCheckerTest.kt (98%) rename kmp/{data-runtime-edge => datasource/runtime-edge}/build.gradle.kts (88%) rename kmp/{data-runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/EdgeFeedRepo.kt => datasource/runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/EdgeFeedDataSource.kt} (50%) rename kmp/{data-runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data => datasource/runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/util/KtorApiErrorChecker.kt (67%) rename kmp/{data-testing => datasource/testing}/build.gradle.kts (87%) rename kmp/{data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed => datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/FakeFeedData.kt (94%) rename kmp/{data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedRepo.kt => datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedDataSource.kt} (68%) rename kmp/{data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data => datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource}/util/NoOpApiErrorChecker.kt (64%) rename kmp/{data-testing/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedRepoTest.kt => datasource/testing/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedDataSourceTest.kt} (57%) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 438f6c7a..a023a388 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -225,12 +225,12 @@ androidComponents { } dependencies { - mockImplementation(project(":kmp:data-testing")) - devImplementation(project(":kmp:data-runtime-cloud")) - demoImplementation(project(":kmp:data-runtime-edge")) - prodImplementation(project(":kmp:data-runtime-cloud")) + mockImplementation(project(":kmp:datasource:testing")) + devImplementation(project(":kmp:datasource:runtime-cloud")) + demoImplementation(project(":kmp:datasource:runtime-edge")) + prodImplementation(project(":kmp:datasource:runtime-cloud")) - implementation(project(":ui-common")) + implementation(project(":feature:common")) // Firebase releaseImplementation(libs.firebase.perf) diff --git a/android/app/src/demo/java/io/github/reactivecircus/kstreamlined/android/di/EdgeDataModule.kt b/android/app/src/demo/java/io/github/reactivecircus/kstreamlined/android/di/EdgeDataModule.kt index ef20f47f..895b211a 100644 --- a/android/app/src/demo/java/io/github/reactivecircus/kstreamlined/android/di/EdgeDataModule.kt +++ b/android/app/src/demo/java/io/github/reactivecircus/kstreamlined/android/di/EdgeDataModule.kt @@ -4,10 +4,10 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent -import io.github.reactivecircus.kstreamlined.kmp.data.feed.EdgeFeedRepo -import io.github.reactivecircus.kstreamlined.kmp.data.feed.FeedRepo -import io.github.reactivecircus.kstreamlined.kmp.data.util.ApiErrorChecker -import io.github.reactivecircus.kstreamlined.kmp.data.util.KtorApiErrorChecker +import io.github.reactivecircus.kstreamlined.kmp.datasource.EdgeFeedDataSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.FeedDataSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.util.ApiErrorChecker +import io.github.reactivecircus.kstreamlined.kmp.datasource.util.KtorApiErrorChecker import javax.inject.Singleton @Module @@ -16,8 +16,8 @@ object EdgeDataModule { @Provides @Singleton - fun feedRepo(): FeedRepo { - return EdgeFeedRepo() + fun feedDataSource(): FeedDataSource { + return EdgeFeedDataSource() } @Provides diff --git a/android/app/src/devAndProd/java/io/github/reactivecircus/kstreamlined/android/di/CloudDataModule.kt b/android/app/src/devAndProd/java/io/github/reactivecircus/kstreamlined/android/di/CloudDataModule.kt index 64afe776..f39ba2bb 100644 --- a/android/app/src/devAndProd/java/io/github/reactivecircus/kstreamlined/android/di/CloudDataModule.kt +++ b/android/app/src/devAndProd/java/io/github/reactivecircus/kstreamlined/android/di/CloudDataModule.kt @@ -5,10 +5,10 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent -import io.github.reactivecircus.kstreamlined.kmp.data.feed.CloudFeedRepo -import io.github.reactivecircus.kstreamlined.kmp.data.feed.FeedRepo -import io.github.reactivecircus.kstreamlined.kmp.data.util.ApiErrorChecker -import io.github.reactivecircus.kstreamlined.kmp.data.util.ApolloApiErrorChecker +import io.github.reactivecircus.kstreamlined.kmp.datasource.CloudFeedDataSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.FeedDataSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.util.ApiErrorChecker +import io.github.reactivecircus.kstreamlined.kmp.datasource.util.ApolloApiErrorChecker import javax.inject.Singleton @Module @@ -17,8 +17,8 @@ object CloudDataModule { @Provides @Singleton - fun feedRepo(apolloClient: ApolloClient): FeedRepo { - return CloudFeedRepo(apolloClient) + fun feedDataSource(apolloClient: ApolloClient): FeedDataSource { + return CloudFeedDataSource(apolloClient) } @Provides diff --git a/android/app/src/devAndProd/java/io/github/reactivecircus/kstreamlined/android/di/NetworkingModule.kt b/android/app/src/devAndProd/java/io/github/reactivecircus/kstreamlined/android/di/NetworkingModule.kt index 62062e8d..2d665d31 100644 --- a/android/app/src/devAndProd/java/io/github/reactivecircus/kstreamlined/android/di/NetworkingModule.kt +++ b/android/app/src/devAndProd/java/io/github/reactivecircus/kstreamlined/android/di/NetworkingModule.kt @@ -9,7 +9,7 @@ import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import io.github.reactivecircus.kstreamlined.android.BuildConfig -import io.github.reactivecircus.kstreamlined.kmp.data.networking.ApolloClientConfigs +import io.github.reactivecircus.kstreamlined.kmp.datasource.networking.ApolloClientConfigs import javax.inject.Singleton import kotlin.time.DurationUnit import kotlin.time.toDuration diff --git a/android/app/src/mock/java/io/github/reactivecircus/kstreamlined/android/di/MockDataModule.kt b/android/app/src/mock/java/io/github/reactivecircus/kstreamlined/android/di/MockDataModule.kt index 769d8dcb..92a8ed69 100644 --- a/android/app/src/mock/java/io/github/reactivecircus/kstreamlined/android/di/MockDataModule.kt +++ b/android/app/src/mock/java/io/github/reactivecircus/kstreamlined/android/di/MockDataModule.kt @@ -4,10 +4,10 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent -import io.github.reactivecircus.kstreamlined.kmp.data.feed.FakeFeedRepo -import io.github.reactivecircus.kstreamlined.kmp.data.feed.FeedRepo -import io.github.reactivecircus.kstreamlined.kmp.data.util.ApiErrorChecker -import io.github.reactivecircus.kstreamlined.kmp.data.util.NoOpApiErrorChecker +import io.github.reactivecircus.kstreamlined.kmp.datasource.FakeFeedDataSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.FeedDataSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.util.ApiErrorChecker +import io.github.reactivecircus.kstreamlined.kmp.datasource.util.NoOpApiErrorChecker import javax.inject.Singleton @Module @@ -16,8 +16,8 @@ object MockDataModule { @Provides @Singleton - fun feedRepo(): FeedRepo { - return FakeFeedRepo() + fun feedDataSource(): FeedDataSource { + return FakeFeedDataSource() } @Provides diff --git a/android/ui/ui-common/build.gradle.kts b/android/feature/common/build.gradle.kts similarity index 89% rename from android/ui/ui-common/build.gradle.kts rename to android/feature/common/build.gradle.kts index 2ce550ca..c3e1e6e5 100644 --- a/android/ui/ui-common/build.gradle.kts +++ b/android/feature/common/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } android { - namespace = "io.github.reactivecircus.kstreamlined.android.ui.common" + namespace = "io.github.reactivecircus.kstreamlined.android.feature.common" buildFeatures { androidResources = true } @@ -20,8 +20,6 @@ androidComponents { } dependencies { - api(project(":kmp:data-common")) - // AndroidX api(libs.androidx.core) diff --git a/android/ui/ui-common/src/main/AndroidManifest.xml b/android/feature/common/src/main/AndroidManifest.xml similarity index 100% rename from android/ui/ui-common/src/main/AndroidManifest.xml rename to android/feature/common/src/main/AndroidManifest.xml diff --git a/android/ui/ui-common/src/main/res/values/strings.xml b/android/feature/common/src/main/res/values/strings.xml similarity index 100% rename from android/ui/ui-common/src/main/res/values/strings.xml rename to android/feature/common/src/main/res/values/strings.xml diff --git a/kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FeedRepo.kt b/kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FeedRepo.kt deleted file mode 100644 index e28af660..00000000 --- a/kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FeedRepo.kt +++ /dev/null @@ -1,16 +0,0 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed - -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedEntry -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedSource - -interface FeedRepo { - - suspend fun loadFeedSources( - refresh: Boolean = false - ): List - - suspend fun loadFeedEntries( - filters: List? = null, - refresh: Boolean = false, - ): List -} diff --git a/kmp/data-common/build.gradle.kts b/kmp/datasource/common/build.gradle.kts similarity index 100% rename from kmp/data-common/build.gradle.kts rename to kmp/datasource/common/build.gradle.kts diff --git a/kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FeedDataSource.kt b/kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FeedDataSource.kt new file mode 100644 index 00000000..d58b41fb --- /dev/null +++ b/kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FeedDataSource.kt @@ -0,0 +1,16 @@ +package io.github.reactivecircus.kstreamlined.kmp.datasource + +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedEntry +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedSource + +interface FeedDataSource { + + suspend fun loadFeedSources( + refresh: Boolean = false + ): List + + suspend fun loadFeedEntries( + filters: List? = null, + refresh: Boolean = false, + ): List +} diff --git a/kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/model/FeedEntry.kt b/kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/model/FeedEntry.kt similarity index 94% rename from kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/model/FeedEntry.kt rename to kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/model/FeedEntry.kt index eaf0f024..3675da5c 100644 --- a/kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/model/FeedEntry.kt +++ b/kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/model/FeedEntry.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed.model +package io.github.reactivecircus.kstreamlined.kmp.datasource.model sealed interface FeedEntry { val id: String diff --git a/kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/model/FeedSource.kt b/kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/model/FeedSource.kt similarity index 77% rename from kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/model/FeedSource.kt rename to kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/model/FeedSource.kt index 4db9dcd3..80f07757 100644 --- a/kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/model/FeedSource.kt +++ b/kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/model/FeedSource.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed.model +package io.github.reactivecircus.kstreamlined.kmp.datasource.model data class FeedSource( val key: Key, diff --git a/kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/ApiErrorChecker.kt b/kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/ApiErrorChecker.kt similarity index 76% rename from kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/ApiErrorChecker.kt rename to kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/ApiErrorChecker.kt index ec21b14b..d85dec4f 100644 --- a/kmp/data-common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/ApiErrorChecker.kt +++ b/kmp/datasource/common/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/ApiErrorChecker.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.util +package io.github.reactivecircus.kstreamlined.kmp.datasource.util interface ApiErrorChecker { diff --git a/kmp/data-runtime-cloud/build.gradle.kts b/kmp/datasource/runtime-cloud/build.gradle.kts similarity index 95% rename from kmp/data-runtime-cloud/build.gradle.kts rename to kmp/datasource/runtime-cloud/build.gradle.kts index 55ac2d22..a96872e6 100644 --- a/kmp/data-runtime-cloud/build.gradle.kts +++ b/kmp/datasource/runtime-cloud/build.gradle.kts @@ -23,7 +23,7 @@ kotlin { sourceSets { commonMain { dependencies { - api(project(":kmp:data-common")) + api(project(":kmp:datasource:common")) api(libs.apollo.runtime) api(libs.apollo.normalizedCache) implementation(libs.kotlinx.coroutines.core) diff --git a/kmp/data-runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedEntries.graphql b/kmp/datasource/runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedEntries.graphql similarity index 100% rename from kmp/data-runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedEntries.graphql rename to kmp/datasource/runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedEntries.graphql diff --git a/kmp/data-runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedSources.graphql b/kmp/datasource/runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedSources.graphql similarity index 100% rename from kmp/data-runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedSources.graphql rename to kmp/datasource/runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/FeedSources.graphql diff --git a/kmp/data-runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/schema.graphqls b/kmp/datasource/runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/schema.graphqls similarity index 100% rename from kmp/data-runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/schema.graphqls rename to kmp/datasource/runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/schema.graphqls diff --git a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/CloudFeedRepo.kt b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/CloudFeedDataSource.kt similarity index 69% rename from kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/CloudFeedRepo.kt rename to kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/CloudFeedDataSource.kt index 88ab90b7..0565e5e7 100644 --- a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/CloudFeedRepo.kt +++ b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/CloudFeedDataSource.kt @@ -1,17 +1,17 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed +package io.github.reactivecircus.kstreamlined.kmp.datasource import co.touchlab.kermit.Logger import com.apollographql.apollo3.ApolloClient import com.apollographql.apollo3.api.Optional import io.github.reactivecircus.kstreamlined.graphql.FeedEntriesQuery import io.github.reactivecircus.kstreamlined.graphql.FeedSourcesQuery -import io.github.reactivecircus.kstreamlined.kmp.data.feed.mapper.toApollo -import io.github.reactivecircus.kstreamlined.kmp.data.feed.mapper.toModel -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedEntry -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedSource -import io.github.reactivecircus.kstreamlined.kmp.data.networking.defaultFetchPolicy +import io.github.reactivecircus.kstreamlined.kmp.datasource.mapper.toApollo +import io.github.reactivecircus.kstreamlined.kmp.datasource.mapper.toModel +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedEntry +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.networking.defaultFetchPolicy -class CloudFeedRepo(private val apolloClient: ApolloClient) : FeedRepo { +class CloudFeedDataSource(private val apolloClient: ApolloClient) : FeedDataSource { override suspend fun loadFeedSources(refresh: Boolean): List { return runCatching { diff --git a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedEntryMappers.kt b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedEntryMappers.kt similarity index 93% rename from kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedEntryMappers.kt rename to kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedEntryMappers.kt index 33e7ed62..7a313452 100644 --- a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedEntryMappers.kt +++ b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedEntryMappers.kt @@ -1,7 +1,7 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed.mapper +package io.github.reactivecircus.kstreamlined.kmp.datasource.mapper import io.github.reactivecircus.kstreamlined.graphql.FeedEntriesQuery -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedEntry +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedEntry internal fun FeedEntriesQuery.FeedEntry.toModel(): FeedEntry { return when (this) { diff --git a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedSourceMappers.kt b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedSourceMappers.kt similarity index 88% rename from kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedSourceMappers.kt rename to kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedSourceMappers.kt index f7868cb5..b7c521c4 100644 --- a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedSourceMappers.kt +++ b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedSourceMappers.kt @@ -1,8 +1,8 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed.mapper +package io.github.reactivecircus.kstreamlined.kmp.datasource.mapper import io.github.reactivecircus.kstreamlined.graphql.FeedSourcesQuery import io.github.reactivecircus.kstreamlined.graphql.type.FeedSourceKey -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedSource internal fun FeedSource.Key.toApollo(): FeedSourceKey { return when (this) { diff --git a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/networking/ApolloClientConfigs.kt b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/networking/ApolloClientConfigs.kt similarity index 89% rename from kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/networking/ApolloClientConfigs.kt rename to kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/networking/ApolloClientConfigs.kt index e59e8fc3..bccc4b62 100644 --- a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/networking/ApolloClientConfigs.kt +++ b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/networking/ApolloClientConfigs.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.networking +package io.github.reactivecircus.kstreamlined.kmp.datasource.networking import com.apollographql.apollo3.cache.normalized.ApolloStore import com.apollographql.apollo3.cache.normalized.api.MemoryCacheFactory diff --git a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/networking/DefaultFetchPolicy.kt b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/networking/DefaultFetchPolicy.kt similarity index 86% rename from kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/networking/DefaultFetchPolicy.kt rename to kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/networking/DefaultFetchPolicy.kt index 996920b0..e45e02fc 100644 --- a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/networking/DefaultFetchPolicy.kt +++ b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/networking/DefaultFetchPolicy.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.networking +package io.github.reactivecircus.kstreamlined.kmp.datasource.networking import com.apollographql.apollo3.ApolloCall import com.apollographql.apollo3.api.Operation diff --git a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/ApolloApiErrorChecker.kt b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/ApolloApiErrorChecker.kt similarity index 91% rename from kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/ApolloApiErrorChecker.kt rename to kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/ApolloApiErrorChecker.kt index 49468398..9be15fde 100644 --- a/kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/ApolloApiErrorChecker.kt +++ b/kmp/datasource/runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/ApolloApiErrorChecker.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.util +package io.github.reactivecircus.kstreamlined.kmp.datasource.util import com.apollographql.apollo3.exception.ApolloNetworkException import com.apollographql.apollo3.exception.NoDataException diff --git a/kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/CloudFeedRepoTest.kt b/kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/CloudFeedDataSourceTest.kt similarity index 86% rename from kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/CloudFeedRepoTest.kt rename to kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/CloudFeedDataSourceTest.kt index b104f52b..730ec388 100644 --- a/kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/CloudFeedRepoTest.kt +++ b/kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/CloudFeedDataSourceTest.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed +package io.github.reactivecircus.kstreamlined.kmp.datasource import com.apollographql.apollo3.ApolloClient import com.apollographql.apollo3.annotations.ApolloExperimental @@ -15,7 +15,7 @@ import io.github.reactivecircus.kstreamlined.graphql.FeedSourcesQuery import io.github.reactivecircus.kstreamlined.graphql.type.buildFeedSource import io.github.reactivecircus.kstreamlined.graphql.type.buildKotlinBlog import io.github.reactivecircus.kstreamlined.graphql.type.buildKotlinYouTube -import io.github.reactivecircus.kstreamlined.kmp.data.feed.mapper.toModel +import io.github.reactivecircus.kstreamlined.kmp.datasource.mapper.toModel import io.github.reactivecircus.kstreamlined.kmp.test.utils.runTest import kotlin.test.Test import kotlin.test.assertEquals @@ -23,11 +23,11 @@ import kotlin.test.assertFailsWith import kotlin.test.assertTrue @ApolloExperimental -class CloudFeedRepoTest { +class CloudFeedDataSourceTest { private lateinit var mockServer: MockServer - private lateinit var cloudFeedRepo: CloudFeedRepo + private lateinit var cloudFeedDataSource: CloudFeedDataSource private val dummyFeedSources = FeedSourcesQuery.Data { feedSources = listOf( @@ -53,7 +53,7 @@ class CloudFeedRepoTest { private suspend fun setUp() { mockServer = MockServer() - cloudFeedRepo = CloudFeedRepo( + cloudFeedDataSource = CloudFeedDataSource( apolloClient = ApolloClient.Builder() .serverUrl(mockServer.url()) .normalizedCache(MemoryCacheFactory()) @@ -71,7 +71,7 @@ class CloudFeedRepoTest { mockServer.enqueueData( FeedSourcesQuery.Data(feedSources = dummyFeedSources) ) - val actual = cloudFeedRepo.loadFeedSources(refresh = true) + val actual = cloudFeedDataSource.loadFeedSources(refresh = true) assertEquals(dummyFeedSources.map { it.toModel() }, actual) } @@ -80,7 +80,7 @@ class CloudFeedRepoTest { runTest(before = { setUp() }, after = { tearDown() }) { mockServer.enqueueString(statusCode = 404) val exception = assertFailsWith { - cloudFeedRepo.loadFeedSources(refresh = true) + cloudFeedDataSource.loadFeedSources(refresh = true) } assertEquals(404, (exception.cause as ApolloHttpException).statusCode) } @@ -91,7 +91,7 @@ class CloudFeedRepoTest { mockServer.enqueueData( FeedSourcesQuery.Data(feedSources = dummyFeedSources) ) - val actual = cloudFeedRepo.loadFeedSources(refresh = false) + val actual = cloudFeedDataSource.loadFeedSources(refresh = false) assertEquals(dummyFeedSources.map { it.toModel() }, actual) } @@ -102,11 +102,11 @@ class CloudFeedRepoTest { mockServer.enqueueData( FeedSourcesQuery.Data(feedSources = dummyFeedSources) ) - cloudFeedRepo.loadFeedSources(refresh = false) + cloudFeedDataSource.loadFeedSources(refresh = false) // 2nd request to consume cache mockServer.enqueueString(statusCode = 404) - val actual = cloudFeedRepo.loadFeedSources(refresh = false) + val actual = cloudFeedDataSource.loadFeedSources(refresh = false) assertEquals(dummyFeedSources.map { it.toModel() }, actual) } @@ -115,7 +115,7 @@ class CloudFeedRepoTest { runTest(before = { setUp() }, after = { tearDown() }) { mockServer.enqueueString(statusCode = 404) val exception = assertFailsWith { - cloudFeedRepo.loadFeedSources(refresh = false) + cloudFeedDataSource.loadFeedSources(refresh = false) } assertTrue(exception.cause is CacheMissException) } @@ -126,7 +126,7 @@ class CloudFeedRepoTest { mockServer.enqueueData( FeedEntriesQuery.Data(feedEntries = dummyFeedEntries) ) - val actual = cloudFeedRepo.loadFeedEntries( + val actual = cloudFeedDataSource.loadFeedEntries( filters = null, refresh = true, ) @@ -138,7 +138,7 @@ class CloudFeedRepoTest { runTest(before = { setUp() }, after = { tearDown() }) { mockServer.enqueueString(statusCode = 404) val exception = assertFailsWith { - cloudFeedRepo.loadFeedEntries( + cloudFeedDataSource.loadFeedEntries( filters = null, refresh = true, ) @@ -152,7 +152,7 @@ class CloudFeedRepoTest { mockServer.enqueueData( FeedEntriesQuery.Data(feedEntries = dummyFeedEntries) ) - val actual = cloudFeedRepo.loadFeedEntries( + val actual = cloudFeedDataSource.loadFeedEntries( filters = null, refresh = false, ) @@ -166,14 +166,14 @@ class CloudFeedRepoTest { mockServer.enqueueData( FeedEntriesQuery.Data(feedEntries = dummyFeedEntries) ) - cloudFeedRepo.loadFeedEntries( + cloudFeedDataSource.loadFeedEntries( filters = null, refresh = false, ) // 2nd request to consume cache mockServer.enqueueString(statusCode = 404) - val actual = cloudFeedRepo.loadFeedEntries( + val actual = cloudFeedDataSource.loadFeedEntries( filters = null, refresh = false, ) @@ -185,7 +185,7 @@ class CloudFeedRepoTest { runTest(before = { setUp() }, after = { tearDown() }) { mockServer.enqueueString(statusCode = 404) val exception = assertFailsWith { - cloudFeedRepo.loadFeedEntries( + cloudFeedDataSource.loadFeedEntries( filters = null, refresh = false, ) diff --git a/kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedEntryMappersTest.kt b/kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedEntryMappersTest.kt similarity index 97% rename from kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedEntryMappersTest.kt rename to kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedEntryMappersTest.kt index 0401f64f..190bec23 100644 --- a/kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedEntryMappersTest.kt +++ b/kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedEntryMappersTest.kt @@ -1,11 +1,11 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed.mapper +package io.github.reactivecircus.kstreamlined.kmp.datasource.mapper import io.github.reactivecircus.kstreamlined.graphql.FeedEntriesQuery import io.github.reactivecircus.kstreamlined.graphql.type.buildKotlinBlog import io.github.reactivecircus.kstreamlined.graphql.type.buildKotlinWeekly import io.github.reactivecircus.kstreamlined.graphql.type.buildKotlinYouTube import io.github.reactivecircus.kstreamlined.graphql.type.buildTalkingKotlin -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedEntry +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedEntry import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedSourceMappersTest.kt b/kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedSourceMappersTest.kt similarity index 92% rename from kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedSourceMappersTest.kt rename to kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedSourceMappersTest.kt index 7e84b04e..5c76863c 100644 --- a/kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/mapper/FeedSourceMappersTest.kt +++ b/kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/mapper/FeedSourceMappersTest.kt @@ -1,8 +1,8 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed.mapper +package io.github.reactivecircus.kstreamlined.kmp.datasource.mapper import io.github.reactivecircus.kstreamlined.graphql.FeedSourcesQuery import io.github.reactivecircus.kstreamlined.graphql.type.FeedSourceKey -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedSource import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith diff --git a/kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/ApolloApiErrorCheckerTest.kt b/kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/ApolloApiErrorCheckerTest.kt similarity index 98% rename from kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/ApolloApiErrorCheckerTest.kt rename to kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/ApolloApiErrorCheckerTest.kt index 5e38c246..c44d0eaa 100644 --- a/kmp/data-runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/ApolloApiErrorCheckerTest.kt +++ b/kmp/datasource/runtime-cloud/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/ApolloApiErrorCheckerTest.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.util +package io.github.reactivecircus.kstreamlined.kmp.datasource.util import com.apollographql.apollo3.exception.ApolloGraphQLException import com.apollographql.apollo3.exception.ApolloNetworkException diff --git a/kmp/data-runtime-edge/build.gradle.kts b/kmp/datasource/runtime-edge/build.gradle.kts similarity index 88% rename from kmp/data-runtime-edge/build.gradle.kts rename to kmp/datasource/runtime-edge/build.gradle.kts index ab8c31d5..a9c6def9 100644 --- a/kmp/data-runtime-edge/build.gradle.kts +++ b/kmp/datasource/runtime-edge/build.gradle.kts @@ -7,7 +7,7 @@ kotlin { sourceSets { commonMain { dependencies { - api(project(":kmp:data-common")) + api(project(":kmp:datasource:common")) implementation(libs.kotlinx.coroutines.core) implementation(libs.kermit) } diff --git a/kmp/data-runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/EdgeFeedRepo.kt b/kmp/datasource/runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/EdgeFeedDataSource.kt similarity index 50% rename from kmp/data-runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/EdgeFeedRepo.kt rename to kmp/datasource/runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/EdgeFeedDataSource.kt index 1c10caa2..fcf5fae2 100644 --- a/kmp/data-runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/EdgeFeedRepo.kt +++ b/kmp/datasource/runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/EdgeFeedDataSource.kt @@ -1,9 +1,9 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed +package io.github.reactivecircus.kstreamlined.kmp.datasource -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedEntry -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedEntry +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedSource -class EdgeFeedRepo : FeedRepo { +class EdgeFeedDataSource : FeedDataSource { override suspend fun loadFeedSources(refresh: Boolean): List { TODO() diff --git a/kmp/data-runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/KtorApiErrorChecker.kt b/kmp/datasource/runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/KtorApiErrorChecker.kt similarity index 67% rename from kmp/data-runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/KtorApiErrorChecker.kt rename to kmp/datasource/runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/KtorApiErrorChecker.kt index eb18a165..acb3a182 100644 --- a/kmp/data-runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/KtorApiErrorChecker.kt +++ b/kmp/datasource/runtime-edge/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/KtorApiErrorChecker.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.util +package io.github.reactivecircus.kstreamlined.kmp.datasource.util object KtorApiErrorChecker : ApiErrorChecker { override fun isNetworkError(throwable: Throwable?): Boolean { diff --git a/kmp/data-testing/build.gradle.kts b/kmp/datasource/testing/build.gradle.kts similarity index 87% rename from kmp/data-testing/build.gradle.kts rename to kmp/datasource/testing/build.gradle.kts index 71369632..1c482fc9 100644 --- a/kmp/data-testing/build.gradle.kts +++ b/kmp/datasource/testing/build.gradle.kts @@ -7,7 +7,7 @@ kotlin { sourceSets { commonMain { dependencies { - api(project(":kmp:data-common")) + api(project(":kmp:datasource:common")) implementation(libs.kotlinx.coroutines.core) } } diff --git a/kmp/data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedData.kt b/kmp/datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedData.kt similarity index 94% rename from kmp/data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedData.kt rename to kmp/datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedData.kt index 6cc20bf0..bfb35ea1 100644 --- a/kmp/data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedData.kt +++ b/kmp/datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedData.kt @@ -1,9 +1,9 @@ @file:Suppress("MaximumLineLength", "MaxLineLength") -package io.github.reactivecircus.kstreamlined.kmp.data.feed +package io.github.reactivecircus.kstreamlined.kmp.datasource -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedEntry -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedEntry +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedSource val FakeFeedSources = listOf( FeedSource( diff --git a/kmp/data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedRepo.kt b/kmp/datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedDataSource.kt similarity index 68% rename from kmp/data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedRepo.kt rename to kmp/datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedDataSource.kt index b56548d2..4207850f 100644 --- a/kmp/data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedRepo.kt +++ b/kmp/datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedDataSource.kt @@ -1,9 +1,9 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed +package io.github.reactivecircus.kstreamlined.kmp.datasource -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedEntry -import io.github.reactivecircus.kstreamlined.kmp.data.feed.model.FeedSource +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedEntry +import io.github.reactivecircus.kstreamlined.kmp.datasource.model.FeedSource -class FakeFeedRepo : FeedRepo { +class FakeFeedDataSource : FeedDataSource { var nextFeedSourcesResponse: suspend () -> List = { FakeFeedSources diff --git a/kmp/data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/NoOpApiErrorChecker.kt b/kmp/datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/NoOpApiErrorChecker.kt similarity index 64% rename from kmp/data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/NoOpApiErrorChecker.kt rename to kmp/datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/NoOpApiErrorChecker.kt index 52e224c1..c44f1062 100644 --- a/kmp/data-testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/util/NoOpApiErrorChecker.kt +++ b/kmp/datasource/testing/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/util/NoOpApiErrorChecker.kt @@ -1,4 +1,4 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.util +package io.github.reactivecircus.kstreamlined.kmp.datasource.util object NoOpApiErrorChecker : ApiErrorChecker { override fun isNetworkError(throwable: Throwable?): Boolean = false diff --git a/kmp/data-testing/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedRepoTest.kt b/kmp/datasource/testing/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedDataSourceTest.kt similarity index 57% rename from kmp/data-testing/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedRepoTest.kt rename to kmp/datasource/testing/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedDataSourceTest.kt index 97bedc44..ddad3fb2 100644 --- a/kmp/data-testing/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/FakeFeedRepoTest.kt +++ b/kmp/datasource/testing/src/commonTest/kotlin/io/github/reactivecircus/kstreamlined/kmp/datasource/FakeFeedDataSourceTest.kt @@ -1,49 +1,49 @@ -package io.github.reactivecircus.kstreamlined.kmp.data.feed +package io.github.reactivecircus.kstreamlined.kmp.datasource import kotlinx.coroutines.test.runTest import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith -class FakeFeedRepoTest { +class FakeFeedDataSourceTest { - private val fakeFeedRepo = FakeFeedRepo() + private val fakeFeedDataSource = FakeFeedDataSource() @Test fun `returns expected response when nextFeedSourcesResponse succeeds`() = runTest { - fakeFeedRepo.nextFeedSourcesResponse = { + fakeFeedDataSource.nextFeedSourcesResponse = { FakeFeedSources } assertEquals( FakeFeedSources, - fakeFeedRepo.loadFeedSources(), + fakeFeedDataSource.loadFeedSources(), ) } @Test fun `throws exception when nextFeedSourcesResponse fails`() = runTest { - fakeFeedRepo.nextFeedSourcesResponse = { throw IllegalStateException() } + fakeFeedDataSource.nextFeedSourcesResponse = { throw IllegalStateException() } assertFailsWith { - fakeFeedRepo.loadFeedSources() + fakeFeedDataSource.loadFeedSources() } } @Test fun `returns expected response when nextFeedEntriesResponse succeeds`() = runTest { - fakeFeedRepo.nextFeedEntriesResponse = { + fakeFeedDataSource.nextFeedEntriesResponse = { FakeFeedEntries } assertEquals( FakeFeedEntries, - fakeFeedRepo.loadFeedEntries(), + fakeFeedDataSource.loadFeedEntries(), ) } @Test fun `throws exception when nextFeedEntriesResponse fails`() = runTest { - fakeFeedRepo.nextFeedEntriesResponse = { throw IllegalStateException() } + fakeFeedDataSource.nextFeedEntriesResponse = { throw IllegalStateException() } assertFailsWith { - fakeFeedRepo.loadFeedEntries() + fakeFeedDataSource.loadFeedEntries() } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 40a4349e..e84e0624 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -59,10 +59,10 @@ plugins { rootProject.name = "kstreamlined-mobile" // KMP -include(":kmp:data-common") -include(":kmp:data-runtime-cloud") -include(":kmp:data-runtime-edge") -include(":kmp:data-testing") +include(":kmp:datasource:common") +include(":kmp:datasource:runtime-cloud") +include(":kmp:datasource:runtime-edge") +include(":kmp:datasource:testing") include(":kmp:core-utils") include(":kmp:test-utils") @@ -70,7 +70,7 @@ val isXCFrameworkBuild = startParameter.taskNames.any { it.endsWith("XCFramework if (!isXCFrameworkBuild) { // Android includeProject(":app", "android/app") - includeProject(":ui-common", "android/ui/ui-common") + includeProject(":feature:common", "android/feature/common") } fun includeProject(name: String, filePath: String) {