From e17d87f35749715946a96dc0e654792227c6722d Mon Sep 17 00:00:00 2001 From: Theodoro Loureiro mota Date: Tue, 23 Jan 2024 09:35:58 -0300 Subject: [PATCH] Adding Type-safe project accessors (#194) * replace the windowInsetsPadding for navigationBarsPadding + statusBarsPadding * Enabling TYPESAFE_PROJECT_ACCESSORS * Adding typesafe project accessors in the app module * Adding typesafe project accessors in the core module * Adding typesafe project accessors in the core-metadata module * Adding typesafe project accessors in the data module * Adding typesafe project accessors in the domain module * Adding typesafe project accessors in the presentation-core module * Adding typesafe project accessors in the presentation-widget module * Adding typesafe project accessors in the source-local module * Adding typesafe project accessors in the source-api module * Rolling back * Changing TYPESAFE_PROJECT_ACCESSORS line * Removing extra spaces --- app/build.gradle.kts | 18 +++++++++--------- core-metadata/build.gradle.kts | 2 +- core/build.gradle.kts | 2 +- data/build.gradle.kts | 6 +++--- domain/build.gradle.kts | 4 ++-- presentation-core/build.gradle.kts | 4 ++-- presentation-widget/build.gradle.kts | 8 ++++---- settings.gradle.kts | 2 ++ source-api/build.gradle.kts | 2 +- source-local/build.gradle.kts | 10 +++++----- 10 files changed, 30 insertions(+), 28 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ca5acb919..291377779 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -139,15 +139,15 @@ android { } dependencies { - implementation(project(":i18n")) - implementation(project(":core")) - implementation(project(":core-metadata")) - implementation(project(":source-api")) - implementation(project(":source-local")) - implementation(project(":data")) - implementation(project(":domain")) - implementation(project(":presentation-core")) - implementation(project(":presentation-widget")) + implementation(projects.i18n) + implementation(projects.core) + implementation(projects.coreMetadata) + implementation(projects.sourceApi) + implementation(projects.sourceLocal) + implementation(projects.data) + implementation(projects.domain) + implementation(projects.presentationCore) + implementation(projects.presentationWidget) // Compose implementation(platform(compose.bom)) diff --git a/core-metadata/build.gradle.kts b/core-metadata/build.gradle.kts index 43b8846ab..5c8605879 100644 --- a/core-metadata/build.gradle.kts +++ b/core-metadata/build.gradle.kts @@ -14,7 +14,7 @@ android { } dependencies { - implementation(project(":source-api")) + implementation(projects.sourceApi) implementation(kotlinx.bundles.serialization) } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index e90a1fd06..841217152 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -17,7 +17,7 @@ android { } dependencies { - implementation(project(":i18n")) + implementation(projects.i18n) api(libs.logcat) diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 4b2532e8c..2d86bf577 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -24,9 +24,9 @@ android { } dependencies { - implementation(project(":source-api")) - implementation(project(":domain")) - implementation(project(":core")) + implementation(projects.sourceApi) + implementation(projects.domain) + implementation(projects.core) api(libs.bundles.sqldelight) } diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index 425551ca0..949de1f8e 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -14,8 +14,8 @@ android { } dependencies { - implementation(project(":source-api")) - implementation(project(":core")) + implementation(projects.sourceApi) + implementation(projects.core) implementation(platform(kotlinx.coroutines.bom)) implementation(kotlinx.bundles.coroutines) diff --git a/presentation-core/build.gradle.kts b/presentation-core/build.gradle.kts index 31d10bdbd..f36ca3857 100644 --- a/presentation-core/build.gradle.kts +++ b/presentation-core/build.gradle.kts @@ -21,8 +21,8 @@ android { } dependencies { - api(project(":core")) - api(project(":i18n")) + api(projects.core) + api(projects.i18n) // Compose implementation(platform(compose.bom)) diff --git a/presentation-widget/build.gradle.kts b/presentation-widget/build.gradle.kts index b5124f50b..d3e56e373 100644 --- a/presentation-widget/build.gradle.kts +++ b/presentation-widget/build.gradle.kts @@ -21,10 +21,10 @@ android { } dependencies { - implementation(project(":core")) - implementation(project(":domain")) - implementation(project(":presentation-core")) - api(project(":i18n")) + implementation(projects.core) + implementation(projects.domain) + implementation(projects.presentationCore) + api(projects.i18n) implementation(compose.glance) lintChecks(compose.lintchecks) diff --git a/settings.gradle.kts b/settings.gradle.kts index 5aafcad34..42b473db8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -35,6 +35,8 @@ dependencyResolutionManagement { } } +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + rootProject.name = "Mihon" include(":app") include(":i18n") diff --git a/source-api/build.gradle.kts b/source-api/build.gradle.kts index f8c78fb19..125252def 100644 --- a/source-api/build.gradle.kts +++ b/source-api/build.gradle.kts @@ -17,7 +17,7 @@ kotlin { } val androidMain by getting { dependencies { - implementation(project(":core")) + implementation(projects.core) api(libs.preferencektx) // Workaround for https://youtrack.jetbrains.com/issue/KT-57605 diff --git a/source-local/build.gradle.kts b/source-local/build.gradle.kts index 98eb4d55a..75739a8d7 100644 --- a/source-local/build.gradle.kts +++ b/source-local/build.gradle.kts @@ -8,8 +8,8 @@ kotlin { sourceSets { val commonMain by getting { dependencies { - implementation(project(":source-api")) - api(project(":i18n")) + implementation(projects.sourceApi) + api(projects.i18n) implementation(libs.unifile) implementation(libs.junrar) @@ -17,11 +17,11 @@ kotlin { } val androidMain by getting { dependencies { - implementation(project(":core")) - implementation(project(":core-metadata")) + implementation(projects.core) + implementation(projects.coreMetadata) // Move ChapterRecognition to separate module? - implementation(project(":domain")) + implementation(projects.domain) implementation(kotlinx.bundles.serialization) }