Skip to content

Commit

Permalink
use build src to externalize dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Souleymane Sidibe committed Aug 20, 2021
1 parent e254f47 commit 97dbc90
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 94 deletions.
17 changes: 0 additions & 17 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

6 changes: 6 additions & 0 deletions .idea/kotlinScripting.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 31 additions & 35 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ apply {
}

android {
compileSdk = 30
compileSdk = Versions.compileSdk
buildToolsVersion = "30.0.3"

defaultConfig {
applicationId = "com.soulesidibe.todoapp"
minSdk = 21
targetSdk = 30
minSdk = Versions.minSdk
targetSdk = Versions.compileSdk
versionCode = 1
versionName = "1.0"

Expand All @@ -39,51 +39,47 @@ android {
}
kotlinOptions {
jvmTarget = "1.8"
useIR = true

}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = rootProject.extra["compose_version"] as String
// kotlinCompilerVersion = "1.4.32"
// kotlinCompilerVersion = "1.5.10"
kotlinCompilerExtensionVersion = "1.0.0"
kotlinCompilerExtensionVersion = Versions.compose
kotlinCompilerExtensionVersion = Versions.compose
}
}

dependencies {
implementation(project(":domain"))
implementation(project(":data"))
implementation(project(":device"))
val koin_version = "3.1.2"
val compose_version = "1.0.0"

// Koin core features
implementation("io.insert-koin:koin-core:$koin_version")
// Koin test features
testImplementation("io.insert-koin:koin-test:$koin_version")
// Koin main features for Android (Scope,ViewModel ...)
implementation("io.insert-koin:koin-android:$koin_version")
implementation(Deps.koin_core)
implementation(Deps.koin_android)
implementation(Deps.androidx_core_ktx)
implementation(Deps.androidx_app_compat)
implementation(Deps.material)
implementation(Deps.androidx_compose_constraint_layout)
implementation(Deps.androidx_compose_navigation)
implementation(Deps.androidx_compose_material)
implementation(Deps.androidx_compose_ui)
implementation(Deps.androidx_compose_tooling)
implementation(Deps.androidx_compose_compiler)
implementation(Deps.androidx_compose_material_icons_core)
implementation(Deps.androidx_compose_material_icons_extended)
implementation(Deps.accompanist_system_ui_controller)

implementation("androidx.core:core-ktx:1.6.0")
implementation("androidx.appcompat:appcompat:1.3.1")
implementation("com.google.android.material:material:1.4.0")
implementation("androidx.constraintlayout:constraintlayout-compose:1.0.0-beta02")
implementation("androidx.navigation:navigation-compose:2.4.0-alpha06")
implementation("androidx.compose.material:material:${compose_version}")
implementation("androidx.compose.ui:ui:${compose_version}")
implementation("androidx.compose.ui:ui-tooling:${compose_version}")
implementation("androidx.compose.compiler:compiler:${compose_version}")
implementation("androidx.compose.material:material-icons-core:${compose_version}")
implementation("androidx.compose.material:material-icons-extended:${compose_version}")
implementation("com.google.accompanist:accompanist-systemuicontroller:0.16.1")
implementation(Deps.androidx_lifecycle_runtime)
implementation(Deps.androidx_compose_activity)
// Koin test features
androidTestImplementation(Deps.androidx_junit)
androidTestImplementation(Deps.androidx_espresso)
androidTestImplementation(Deps.androidx__compose_junit)

implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha03")
implementation("androidx.activity:activity-compose:1.3.1")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:${compose_version}")
testImplementation(Deps.junit)
testImplementation(Deps.coroutines_test)
testImplementation(Deps.hamcrest)
testImplementation(Deps.mockito)
testImplementation(Deps.mockk)
testImplementation(Deps.koin_test)
}
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
val compose_version by extra("1.0.0")
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.0")
classpath("com.android.tools.build:gradle:7.0.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10")

// NOTE: Do not place your application dependencies here; they belong
Expand Down
9 changes: 9 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
kotlin("jvm") version "1.5.0"
}

repositories {
google()
gradlePluginPortal()
mavenCentral()
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pluginManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
}
}
39 changes: 39 additions & 0 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
object Deps {
const val kotlin = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}"
const val coroutines_android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1"
const val koin_core = "io.insert-koin:koin-core:${Versions.koin}"
const val koin_android = "io.insert-koin:koin-android:${Versions.koin}"
const val material = "com.google.android.material:material:1.4.0"
const val accompanist_system_ui_controller =
"com.google.accompanist:accompanist-systemuicontroller:0.16.1"

const val androidx_core_ktx = "androidx.core:core-ktx:1.6.0"
const val androidx_app_compat = "androidx.appcompat:appcompat:1.3.1"
const val androidx_room_runtime = "androidx.room:room-runtime:${Versions.room}"
const val androidx_room_ktx = "androidx.room:room-ktx:${Versions.room}"
const val androidx_room_compiler = "androidx.room:room-compiler:${Versions.room}"
const val androidx_lifecycle_runtime = "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha03"

const val androidx_compose_constraint_layout =
"androidx.constraintlayout:constraintlayout-compose:1.0.0-beta02"
const val androidx_compose_navigation = "androidx.navigation:navigation-compose:2.4.0-alpha06"
const val androidx_compose_material = "androidx.compose.material:material:${Versions.compose}"
const val androidx_compose_ui = "androidx.compose.ui:ui:${Versions.compose}"
const val androidx_compose_tooling = "androidx.compose.ui:ui-tooling:${Versions.compose}"
const val androidx_compose_compiler = "androidx.compose.compiler:compiler:${Versions.compose}"
const val androidx_compose_material_icons_core =
"androidx.compose.material:material-icons-core:${Versions.compose}"
const val androidx_compose_material_icons_extended =
"androidx.compose.material:material-icons-extended:${Versions.compose}"
const val androidx_compose_activity = "androidx.activity:activity-compose:1.3.1"

const val junit = "junit:junit:4.13.2"
const val androidx__compose_junit = "androidx.compose.ui:ui-test-junit4:${Versions.compose}"
const val androidx_junit = "androidx.test.ext:junit:1.1.3"
const val androidx_espresso = "androidx.test.espresso:espresso-core:3.4.0"
const val coroutines_test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1"
const val hamcrest = "org.hamcrest:hamcrest-all:1.3"
const val mockito = "org.mockito:mockito-core:3.9.0"
const val mockk = "io.mockk:mockk:1.12.0"
const val koin_test = "io.insert-koin:koin-test:${Versions.koin}"
}
8 changes: 8 additions & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
object Versions {
const val minSdk = 21
const val compileSdk = 30
const val compose = "1.0.0"
const val room = "2.3.0"
const val koin = "3.1.2"
const val kotlin = "1.5.10"
}
18 changes: 9 additions & 9 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ java {

dependencies {
implementation project(":domain")
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.10"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1"
implementation("io.insert-koin:koin-core:3.1.2")
implementation(Deps.kotlin)
implementation(Deps.coroutines_android)
implementation(Deps.koin_core)

testImplementation("junit:junit:4.13.2")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1")
testImplementation("org.hamcrest:hamcrest-all:1.3")
testImplementation("org.mockito:mockito-core:3.9.0")
testImplementation("io.mockk:mockk:1.10.0")
testImplementation("io.insert-koin:koin-test:3.1.2")
testImplementation(Deps.junit)
testImplementation(Deps.coroutines_test)
testImplementation(Deps.hamcrest)
testImplementation(Deps.mockito)
testImplementation(Deps.mockk)
testImplementation(Deps.koin_test)
}
43 changes: 21 additions & 22 deletions device/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@ android {
defaultConfig {
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"

javaCompileOptions {
annotationProcessorOptions {
arguments += [
"room.schemaLocation":"$projectDir/schemas".toString(),
"room.incremental":"true",
"room.expandProjection":"true"]
"room.schemaLocation" : "$projectDir/schemas".toString(),
"room.incremental" : "true",
"room.expandProjection": "true"]
}
}

Expand All @@ -48,25 +46,26 @@ android {
dependencies {
implementation project(":data")

implementation("io.insert-koin:koin-core:3.1.2")
implementation "io.insert-koin:koin-android:3.1.2"
implementation(Deps.koin_core)
implementation(Deps.koin_android)
implementation(Deps.material)

implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation(Deps.androidx_core_ktx)
implementation(Deps.androidx_app_compat)
implementation(Deps.material)

def room_version = "2.3.0"
implementation("androidx.room:room-runtime:$room_version")
implementation("androidx.room:room-ktx:$room_version")
kapt("androidx.room:room-compiler:$room_version")
implementation(Deps.androidx_room_runtime)
implementation(Deps.androidx_room_ktx)
kapt(Deps.androidx_room_compiler)

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1")
testImplementation("org.hamcrest:hamcrest-all:1.3")
testImplementation("org.mockito:mockito-core:3.9.0")
testImplementation("io.mockk:mockk:1.10.0")
testImplementation("io.insert-koin:koin-test:3.1.2")
testImplementation Deps.junit
testImplementation(Deps.coroutines_test)
testImplementation(Deps.hamcrest)
testImplementation(Deps.mockito)
testImplementation(Deps.mockk)
testImplementation(Deps.koin_test)

androidTestImplementation Deps.androidx_junit
androidTestImplementation Deps.androidx_espresso
}
18 changes: 9 additions & 9 deletions domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ java {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.10"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1"
implementation("io.insert-koin:koin-core:3.1.2")
implementation(Deps.kotlin)
implementation(Deps.coroutines_android)
implementation(Deps.koin_core)

testImplementation("junit:junit:4.13.2")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1")
testImplementation("org.hamcrest:hamcrest-all:1.3")
testImplementation("org.mockito:mockito-core:3.9.0")
testImplementation("io.mockk:mockk:1.10.0")
testImplementation("io.insert-koin:koin-test:3.1.2")
testImplementation(Deps.junit)
testImplementation(Deps.coroutines_test)
testImplementation(Deps.hamcrest)
testImplementation(Deps.mockito)
testImplementation(Deps.mockk)
testImplementation(Deps.koin_test)
}

0 comments on commit 97dbc90

Please sign in to comment.