Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Use typesafe project accessors for project modules

Melwin Magalhaesb1266dc05aaa
diff --git a/app-nia-catalog/build.gradle.kts b/app-nia-catalog/build.gradle.kts
index 1f9ac1e2a..f4d655791 100644
--- a/app-nia-catalog/build.gradle.kts
+++ b/app-nia-catalog/build.gradle.kts
@@ -65,7 +65,7 @@ android {
}
dependencies {
- implementation(project(":core:designsystem"))
- implementation(project(":core:ui"))
+ implementation(projects.core.designsystem)
+ implementation(projects.core.ui)
implementation(libs.androidx.activity.compose)
}
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index f1ea598d7..8edb06cac 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -80,31 +80,31 @@ android {
}
dependencies {
- implementation(project(":feature:interests"))
- implementation(project(":feature:foryou"))
- implementation(project(":feature:bookmarks"))
- implementation(project(":feature:topic"))
- implementation(project(":feature:search"))
- implementation(project(":feature:settings"))
+ implementation(projects.feature.interests)
+ implementation(projects.feature.foryou)
+ implementation(projects.feature.bookmarks)
+ implementation(projects.feature.topic)
+ implementation(projects.feature.search)
+ implementation(projects.feature.settings)
- implementation(project(":core:common"))
- implementation(project(":core:ui"))
- implementation(project(":core:designsystem"))
- implementation(project(":core:data"))
- implementation(project(":core:model"))
- implementation(project(":core:analytics"))
+ implementation(projects.core.common)
+ implementation(projects.core.ui)
+ implementation(projects.core.designsystem)
+ implementation(projects.core.data)
+ implementation(projects.core.model)
+ implementation(projects.core.analytics)
- implementation(project(":sync:work"))
+ implementation(projects.sync.work)
- androidTestImplementation(project(":core:testing"))
- androidTestImplementation(project(":core:datastore-test"))
- androidTestImplementation(project(":core:data-test"))
- androidTestImplementation(project(":core:network"))
+ androidTestImplementation(projects.core.testing)
+ androidTestImplementation(projects.core.datastoreTest)
+ androidTestImplementation(projects.core.dataTest)
+ androidTestImplementation(projects.core.network)
androidTestImplementation(libs.androidx.navigation.testing)
androidTestImplementation(libs.accompanist.testharness)
androidTestImplementation(kotlin("test"))
debugImplementation(libs.androidx.compose.ui.testManifest)
- debugImplementation(project(":ui-test-hilt-manifest"))
+ debugImplementation(projects.uiTestHiltManifest)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.appcompat)
@@ -122,10 +122,10 @@ dependencies {
implementation(libs.coil.kt)
// Core functions
- testImplementation(project(":core:testing"))
- testImplementation(project(":core:datastore-test"))
- testImplementation(project(":core:data-test"))
- testImplementation(project(":core:network"))
+ testImplementation(projects.core.testing)
+ testImplementation(projects.core.datastoreTest)
+ testImplementation(projects.core.dataTest)
+ testImplementation(projects.core.network)
testImplementation(libs.androidx.navigation.testing)
testImplementation(libs.accompanist.testharness)
testImplementation(libs.work.testing)
diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts
index 491dffd80..43c8e339b 100644
--- a/core/common/build.gradle.kts
+++ b/core/common/build.gradle.kts
@@ -25,5 +25,5 @@ android {
dependencies {
implementation(libs.kotlinx.coroutines.android)
- testImplementation(project(":core:testing"))
+ testImplementation(projects.core.testing)
}
\ No newline at end of file
diff --git a/core/data-test/build.gradle.kts b/core/data-test/build.gradle.kts
index dfc224e19..99f0bc959 100644
--- a/core/data-test/build.gradle.kts
+++ b/core/data-test/build.gradle.kts
@@ -23,7 +23,7 @@ android {
}
dependencies {
- api(project(":core:data"))
- implementation(project(":core:testing"))
- implementation(project(":core:common"))
+ api(projects.core.data)
+ implementation(projects.core.testing)
+ implementation(projects.core.common)
}
diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts
index 51dfb5393..feae1a624 100644
--- a/core/data/build.gradle.kts
+++ b/core/data/build.gradle.kts
@@ -31,18 +31,18 @@ android {
}
dependencies {
- implementation(project(":core:analytics"))
- implementation(project(":core:common"))
- implementation(project(":core:database"))
- implementation(project(":core:datastore"))
- implementation(project(":core:model"))
- implementation(project(":core:network"))
- implementation(project(":core:notifications"))
+ implementation(projects.core.analytics)
+ implementation(projects.core.common)
+ implementation(projects.core.database)
+ implementation(projects.core.datastore)
+ implementation(projects.core.model)
+ implementation(projects.core.network)
+ implementation(projects.core.notifications)
implementation(libs.androidx.core.ktx)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlinx.datetime)
implementation(libs.kotlinx.serialization.json)
- testImplementation(project(":core:datastore-test"))
- testImplementation(project(":core:testing"))
+ testImplementation(projects.core.datastoreTest)
+ testImplementation(projects.core.testing)
}
diff --git a/core/database/build.gradle.kts b/core/database/build.gradle.kts
index a9c711ae3..26e5f978f 100644
--- a/core/database/build.gradle.kts
+++ b/core/database/build.gradle.kts
@@ -30,10 +30,10 @@ android {
}
dependencies {
- implementation(project(":core:model"))
+ implementation(projects.core.model)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlinx.datetime)
- androidTestImplementation(project(":core:testing"))
+ androidTestImplementation(projects.core.testing)
}
diff --git a/core/datastore-test/build.gradle.kts b/core/datastore-test/build.gradle.kts
index 193c49da7..466d657c4 100644
--- a/core/datastore-test/build.gradle.kts
+++ b/core/datastore-test/build.gradle.kts
@@ -23,10 +23,10 @@ android {
}
dependencies {
- api(project(":core:datastore"))
+ api(projects.core.datastore)
api(libs.androidx.dataStore.core)
implementation(libs.protobuf.kotlin.lite)
- implementation(project(":core:common"))
- implementation(project(":core:testing"))
+ implementation(projects.core.common)
+ implementation(projects.core.testing)
}
diff --git a/core/datastore/build.gradle.kts b/core/datastore/build.gradle.kts
index d6ca7ebcd..2f3bf4e5c 100644
--- a/core/datastore/build.gradle.kts
+++ b/core/datastore/build.gradle.kts
@@ -60,12 +60,12 @@ androidComponents.beforeVariants {
}
dependencies {
- implementation(project(":core:common"))
- implementation(project(":core:model"))
+ implementation(projects.core.common)
+ implementation(projects.core.model)
implementation(libs.androidx.dataStore.core)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.protobuf.kotlin.lite)
- testImplementation(project(":core:datastore-test"))
- testImplementation(project(":core:testing"))
+ testImplementation(projects.core.datastoreTest)
+ testImplementation(projects.core.testing)
}
diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts
index cf9873e2c..5f98988f4 100644
--- a/core/designsystem/build.gradle.kts
+++ b/core/designsystem/build.gradle.kts
@@ -27,7 +27,7 @@ android {
}
dependencies {
- lintPublish(project(":lint"))
+ lintPublish(projects.lint)
api(libs.androidx.compose.foundation)
api(libs.androidx.compose.foundation.layout)
@@ -42,5 +42,5 @@ dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.coil.kt.compose)
- androidTestImplementation(project(":core:testing"))
+ androidTestImplementation(projects.core.testing)
}
diff --git a/core/domain/build.gradle.kts b/core/domain/build.gradle.kts
index 0e3949aa3..a739cd250 100644
--- a/core/domain/build.gradle.kts
+++ b/core/domain/build.gradle.kts
@@ -24,13 +24,13 @@ android {
}
dependencies {
- implementation(project(":core:data"))
- implementation(project(":core:model"))
+ implementation(projects.core.data)
+ implementation(projects.core.model)
implementation(libs.hilt.android)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlinx.datetime)
kapt(libs.hilt.compiler)
- testImplementation(project(":core:testing"))
+ testImplementation(projects.core.testing)
}
\ No newline at end of file
diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts
index 633e2573d..f4b8bcf51 100644
--- a/core/network/build.gradle.kts
+++ b/core/network/build.gradle.kts
@@ -39,8 +39,8 @@ secrets {
}
dependencies {
- implementation(project(":core:common"))
- implementation(project(":core:model"))
+ implementation(projects.core.common)
+ implementation(projects.core.model)
implementation(libs.coil.kt)
implementation(libs.coil.kt.svg)
implementation(libs.kotlinx.coroutines.android)
@@ -50,5 +50,5 @@ dependencies {
implementation(libs.retrofit.core)
implementation(libs.retrofit.kotlin.serialization)
- testImplementation(project(":core:testing"))
+ testImplementation(projects.core.testing)
}
diff --git a/core/notifications/build.gradle.kts b/core/notifications/build.gradle.kts
index 012c6f3f3..0b0feda2e 100644
--- a/core/notifications/build.gradle.kts
+++ b/core/notifications/build.gradle.kts
@@ -24,8 +24,8 @@ android {
}
dependencies {
- implementation(project(":core:common"))
- implementation(project(":core:model"))
+ implementation(projects.core.common)
+ implementation(projects.core.model)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.androidx.browser)
diff --git a/core/testing/build.gradle.kts b/core/testing/build.gradle.kts
index 51f21355e..102e1fe76 100644
--- a/core/testing/build.gradle.kts
+++ b/core/testing/build.gradle.kts
@@ -40,12 +40,12 @@ dependencies {
debugApi(libs.androidx.compose.ui.testManifest)
- implementation(project(":core:common"))
- implementation(project(":core:data"))
- implementation(project(":core:designsystem"))
- implementation(project(":core:domain"))
- implementation(project(":core:model"))
- implementation(project(":core:notifications"))
- implementation(project(":core:analytics"))
+ implementation(projects.core.common)
+ implementation(projects.core.data)
+ implementation(projects.core.designsystem)
+ implementation(projects.core.domain)
+ implementation(projects.core.model)
+ implementation(projects.core.notifications)
+ implementation(projects.core.analytics)
implementation(libs.kotlinx.datetime)
}
diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts
index 044abedaf..cec92ea15 100644
--- a/core/ui/build.gradle.kts
+++ b/core/ui/build.gradle.kts
@@ -40,10 +40,10 @@ dependencies {
debugApi(libs.androidx.compose.ui.tooling)
- implementation(project(":core:analytics"))
- implementation(project(":core:designsystem"))
- implementation(project(":core:domain"))
- implementation(project(":core:model"))
+ implementation(projects.core.analytics)
+ implementation(projects.core.designsystem)
+ implementation(projects.core.domain)
+ implementation(projects.core.model)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.browser)
implementation(libs.androidx.core.ktx)
@@ -51,5 +51,5 @@ dependencies {
implementation(libs.coil.kt.compose)
implementation(libs.kotlinx.datetime)
- androidTestImplementation(project(":core:testing"))
+ androidTestImplementation(projects.core.testing)
}
diff --git a/feature/search/build.gradle.kts b/feature/search/build.gradle.kts
index cbaa767bc..e3d8f3df4 100644
--- a/feature/search/build.gradle.kts
+++ b/feature/search/build.gradle.kts
@@ -25,9 +25,9 @@ android {
}
dependencies {
- implementation(project(":feature:bookmarks"))
- implementation(project(":feature:foryou"))
- implementation(project(":feature:interests"))
+ implementation(projects.feature.bookmarks)
+ implementation(projects.feature.foryou)
+ implementation(projects.feature.interests)
implementation(libs.kotlinx.datetime)
}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index d0c477b3d..8a72d695a 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -31,6 +31,8 @@ dependencyResolutionManagement {
}
}
rootProject.name = "nowinandroid"
+
+enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
include(":app")
include(":app-nia-catalog")
include(":benchmarks")
diff --git a/sync/sync-test/build.gradle.kts b/sync/sync-test/build.gradle.kts
index 99909af6b..02beebe10 100644
--- a/sync/sync-test/build.gradle.kts
+++ b/sync/sync-test/build.gradle.kts
@@ -23,7 +23,7 @@ android {
}
dependencies {
- api(project(":sync:work"))
- implementation(project(":core:data"))
- implementation(project(":core:testing"))
+ api(projects.sync.work)
+ implementation(projects.core.data)
+ implementation(projects.core.testing)
}
diff --git a/sync/work/build.gradle.kts b/sync/work/build.gradle.kts
index 79902e486..14a207088 100644
--- a/sync/work/build.gradle.kts
+++ b/sync/work/build.gradle.kts
@@ -27,11 +27,11 @@ android {
}
dependencies {
- implementation(project(":core:analytics"))
- implementation(project(":core:common"))
- implementation(project(":core:data"))
- implementation(project(":core:datastore"))
- implementation(project(":core:model"))
+ implementation(projects.core.analytics)
+ implementation(projects.core.common)
+ implementation(projects.core.data)
+ implementation(projects.core.datastore)
+ implementation(projects.core.model)
implementation(libs.androidx.lifecycle.livedata.ktx)
implementation(libs.androidx.tracing.ktx)
implementation(libs.androidx.work.ktx)
@@ -41,8 +41,8 @@ dependencies {
kapt(libs.hilt.ext.compiler)
- testImplementation(project(":core:testing"))
+ testImplementation(projects.core.testing)
- androidTestImplementation(project(":core:testing"))
+ androidTestImplementation(projects.core.testing)
androidTestImplementation(libs.androidx.work.testing)
}