Skip to content

Commit

Permalink
[build]: some final improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
F0x1d committed Jul 8, 2024
1 parent 38342ed commit c9e41a8
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 39 deletions.
18 changes: 0 additions & 18 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ android {
}

dependencies {
implementation(project(":data"))
implementation(project(":strings"))

implementation(project(":core:core-arch"))
implementation(project(":core:core-context"))
implementation(project(":core:core-database"))
implementation(project(":core:core-datetime"))
implementation(project(":core:core-intents"))
implementation(project(":core:core-io"))
implementation(project(":core:core-navigation"))
implementation(project(":core:core-preferences"))
implementation(project(":core:core-terminals"))
implementation(project(":core:core-ui"))
implementation(project(":core:core-ui-compose"))

implementation(project(":feature:feature-crashes"))
implementation(project(":feature:feature-crashes-core"))
implementation(project(":feature:feature-filters"))
Expand Down Expand Up @@ -57,7 +42,4 @@ dependencies {
implementation(libs.material)

implementation(libs.bundles.androidx.navigation)

androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.espresso.core)
}
27 changes: 27 additions & 0 deletions build-logic/convention/src/main/kotlin/extensions/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@ package extensions

import org.gradle.api.artifacts.Dependency
import org.gradle.kotlin.dsl.DependencyHandlerScope
import org.gradle.kotlin.dsl.project

internal fun DependencyHandlerScope.coreDependencies(withCompose: Boolean = true) {
implementation(project(":data"))
implementation(project(":strings"))

implementation(project(":core:core-arch"))
implementation(project(":core:core-context"))
implementation(project(":core:core-database"))
implementation(project(":core:core-datetime"))
implementation(project(":core:core-intents"))
implementation(project(":core:core-io"))
implementation(project(":core:core-navigation"))
implementation(project(":core:core-preferences"))
implementation(project(":core:core-terminals"))
implementation(project(":core:core-ui"))

if (withCompose) {
implementation(project(":core:core-ui-compose"))
testImplementation(project(":core:core-tests"))
}
}

internal fun DependencyHandlerScope.implementation(dependency: Any): Dependency? = add(
configurationName = "implementation",
Expand All @@ -18,6 +40,11 @@ internal fun DependencyHandlerScope.testImplementation(dependency: Any): Depende
dependencyNotation = dependency,
)

internal fun DependencyHandlerScope.androidTestImplementation(dependency: Any): Dependency? = add(
configurationName = "androidTestImplementation",
dependencyNotation = dependency,
)

internal fun DependencyHandlerScope.implementation(bundle: List<Any>): List<Dependency?> = bundle.map {
add(
configurationName = "implementation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package main
import com.android.build.api.dsl.ApplicationExtension
import extensions.configureKotlinAndroid
import extensions.configureRobolectric
import extensions.coreDependencies
import extensions.pluginId
import extensions.version
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies

class AndroidApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) = with(target) {
Expand Down Expand Up @@ -64,5 +66,7 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
}
}
}

dependencies { coreDependencies() }
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main.feature

import extensions.implementation
import extensions.testImplementation
import extensions.coreDependencies
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
Expand All @@ -14,10 +13,6 @@ class AndroidComposeFeatureConventionPlugin : Plugin<Project> {
apply("logfox.android.unitTests")
}

dependencies {
implementation(project(":core:core-ui-compose"))

testImplementation(project(":core:core-tests"))
}
dependencies { coreDependencies() }
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package main.feature

import extensions.bundle
import extensions.coreDependencies
import extensions.implementation
import extensions.ksp
import extensions.library
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.project

class AndroidFeatureConventionPlugin : Plugin<Project> {
override fun apply(target: Project) = with(target) {
Expand All @@ -17,19 +17,7 @@ class AndroidFeatureConventionPlugin : Plugin<Project> {
}

dependencies {
implementation(project(":data"))
implementation(project(":strings"))

implementation(project(":core:core-arch"))
implementation(project(":core:core-context"))
implementation(project(":core:core-database"))
implementation(project(":core:core-datetime"))
implementation(project(":core:core-intents"))
implementation(project(":core:core-io"))
implementation(project(":core:core-navigation"))
implementation(project(":core:core-preferences"))
implementation(project(":core:core-terminals"))
implementation(project(":core:core-ui"))
coreDependencies(withCompose = false)

implementation(library("material"))
implementation(bundle("androidx"))
Expand Down

0 comments on commit c9e41a8

Please sign in to comment.