Skip to content

Commit

Permalink
Merge pull request #297 from wealthfront/version-catalog
Browse files Browse the repository at this point in the history
Use Gradle version catalog
  • Loading branch information
cmathew authored Apr 22, 2024
2 parents 29f6584 + 4f3c8c1 commit c077916
Show file tree
Hide file tree
Showing 16 changed files with 228 additions and 276 deletions.
20 changes: 5 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
google()
}
dependencies {
classpath(Plugins.kotlinGradle)
classpath(Plugins.kotlinterGradle)
classpath(Plugins.kotlinAllOpen)
classpath(Plugins.detekt)
}
plugins {
alias(libs.plugins.kotlin.gradle).apply(false)
alias(libs.plugins.kotlinter.gradle).apply(false)
alias(libs.plugins.kotlin.allopen).apply(false)
alias(libs.plugins.detekt)
}

apply plugin: 'io.gitlab.arturbosch.detekt'

allprojects {
apply from: "$rootDir/gradle/static-analysis.gradle"
apply plugin: "kotlin-allopen"
Expand Down
99 changes: 0 additions & 99 deletions buildSrc/src/main/java/Libs.kt

This file was deleted.

39 changes: 0 additions & 39 deletions buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,4 @@ object Versions {
const val compileSdkVersion = 30
const val minSdkVersion = 21
const val targetSdkVersion = 30

const val kotlinVersion = "1.8.21"
const val kotlinterVersion = "3.9.0"
const val detektVersion = "1.19.0"
const val supportLibVersion = "1.3.1"
const val constraintLayoutVersion = "2.1.0"
const val robolectricVersion = "4.8"
const val archVersion = "2.1.0"
const val lifecycleVersion = "2.2.0"
const val androidXCoreVersion = "1.6.0"
const val butterKnifeVersion = "10.0.0"
const val daggerVersion = "2.48"
const val javaInject = "1"
const val retrofitVersion = "2.9.0"
const val glideVersion = "4.11.0"
const val rxjavaVersion = "1.3.8"
const val rxjava2Version = "2.2.19"
const val rxjavaAdapterVersion = "2.3.0"
const val rxandroidVersion = "1.2.1"
const val rxAndroid2Version = "2.1.1"
const val jacksonVersion = "2.7.2"
const val okhttpVersion = "4.4.0"
const val jodaTimeVersion = "2.10.9.1"
const val javaInjectVersion = "1"
const val materialVersion = "1.4.0"
const val recyclerViewVersion = "1.2.1"
const val coroutinesVersion = "1.6.4"

const val testCoreVersion = "1.4.0"
const val junitVersion = "4.13.2"
const val junitTestExtVersion = "1.1.3"
const val truthVersion = "1.0"
const val mockitoVersion = "2.23.4"
const val mockKVersion = "1.12.5"
const val testRunnerVersion = "1.4.0"
const val uiAutomatorVersion = "2.2.0"
const val espressoVersion = "3.4.0"

const val lintVersion = "30.0.2"
}
100 changes: 100 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
[versions]
kotlin = "1.8.22"
kotlinter = "3.9.0"
detekt = "1.19.0"
supportLib = "1.3.1"
constraintLayout = "2.1.0"
robolectric = "4.8"
arch = "2.1.0"
lifecycle = "2.2.0"
androidXCore = "1.6.0"
butterKnife = "10.0.0"
dagger = "2.48"
javaInject = "1"
retrofit = "2.9.0"
glide = "4.11.0"
rxjava = "1.3.8"
rxjava2 = "2.2.19"
rxjavaAdapter = "2.3.0"
rxandroid = "1.2.1"
rxAndroid2 = "2.1.1"
jackson = "2.7.2"
okhttp = "4.4.0"
jodaTime = "2.10.9.1"
javainject = "1"
material = "1.4.0"
recyclerView = "1.2.1"
coroutines = "1.6.4"

testCore = "1.4.0"
junit = "4.13.2"
junitTestExt = "1.1.3"
truth = "1.0"
mockito = "2.23.4"
mockK = "1.12.5"
testRunner = "1.4.0"
uiAutomator = "2.2.0"
espresso = "3.4.0"

lint = "30.0.2"


[libraries]
appCompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "supportLib" }
constraintLayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintLayout" }
lifecycle = { group = "androidx.lifecycle", name = "lifecycle-common-java8", version.ref = "lifecycle" }
androidXCore = { group = "androidx.core", name = "core-ktx", version.ref = "androidXCore" }

material = { group = "com.google.android.material", name = "material", version.ref = "material" }
recyclerView = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerView" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
truth = { group = "com.google.truth", name = "truth", version.ref = "truth" }
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
mockitoAndroid = { group = "org.mockito", name = "mockito-android", version.ref = "mockito" }
mockK = { group = "io.mockk", name = "mockk", version.ref = "mockK" }
archTesting = { group = "androidx.arch.core", name = "core-testing", version.ref = "arch" }
robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" }
butterknife = { group = "com.jakewharton", name = "butterknife", version.ref = "butterKnife" }
butterknifeCompiler = { group = "com.jakewharton", name = "butterknife-compiler", version.ref = "butterKnife" }
dagger = { group = "com.google.dagger", name = "dagger", version.ref = "dagger" }
daggerCompiler = { group = "com.google.dagger", name = "dagger-compiler", version.ref = "dagger" }
inject = { group = "javax.inject", name = "javax.inject", version.ref = "javainject" }
coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
coroutinesAndroid = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }
coroutinesTest = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }

glide = { group = "com.github.bumptech.glide", name = "glide", version.ref = "glide" }
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
retrofitMock = { group = "com.squareup.retrofit2", name = "retrofit-mock", version.ref = "retrofit" }
rxjavaAdapter = { group = "com.squareup.retrofit2", name = "adapter-rxjava", version.ref = "rxjavaAdapter" }
rxJava2Adapter = { group = "com.squareup.retrofit2", name = "adapter-rxjava2", version.ref = "rxjavaAdapter" }
rxjava = { group = "io.reactivex", name = "rxjava", version.ref = "rxjava" }
rxjava2 = { group = "io.reactivex.rxjava2", name = "rxjava", version.ref = "rxjava2" }
rxandroid = { group = "io.reactivex", name = "rxandroid", version.ref = "rxandroid" }
rxAndroid2 = { group = "io.reactivex.rxjava2", name = "rxandroid", version.ref = "rxAndroid2" }
jackson = { group = "com.squareup.retrofit2", name = "converter-jackson", version.ref = "jackson" }
okhttp = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
jodaTime = { group = "net.danlew", name = "android.joda", version.ref = "jodaTime" }

testCore = { group = "androidx.test", name = "core", version.ref = "testCore" }
testCoreKtx = { group = "androidx.test", name = "core-ktx", version.ref = "testCore" }
testRunner = { group = "androidx.test", name = "runner", version.ref = "testRunner" }
testRules = { group = "com.android.support.test", name = "rules", version.ref = "testRunner" }
uiAutomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "uiAutomator" }
extJunit = { group = "androidx.test.ext", name = "junit", version.ref = "junitTestExt" }
extJunitKtx = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "junitTestExt" }
espressoCore = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" }
espressoContrib = { group = "androidx.test.espresso", name = "espresso-contrib", version.ref = "espresso" }
rx2idler = { group = "com.squareup.rx.idler", name = "rx2-idler", version = "0.11.0" }

lintApi = { group = "com.android.tools.lint", name = "lint-api", version.ref = "lint" }
lintChecks = { group = "com.android.tools.lint", name = "lint-checks", version.ref = "lint" }
lint = { group = "com.android.tools.lint", name = "lint", version.ref = "lint" }
lintTests = { group = "com.android.tools.lint", name = "lint-tests", version.ref = "lint" }
testUtils = { group = "com.android.tools", name = "testutils", version.ref = "lint" }

[plugins]
kotlin-gradle = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinter-gradle = { id = "org.jmailen.kotlinter", version.ref = "kotlinter" }
kotlin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
2 changes: 1 addition & 1 deletion gradle/static-analysis.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ kotlinter {
}

detekt {
toolVersion = Versions.detektVersion
toolVersion = "1.19.0"
config = files("$rootDir/config/detekt/detekt-config.yml")
parallel = true
autoCorrect = true
Expand Down
4 changes: 2 additions & 2 deletions internal-test-support/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ dependencies {
implementation project(':magellan-library')
implementation project(':magellan-legacy')

implementation Libs.inject
implementation Libs.appCompat
implementation libs.inject
implementation libs.appCompat
}
18 changes: 9 additions & 9 deletions magellan-legacy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
dependencies {
implementation project(':magellan-library')

implementation Libs.appCompat
implementation Libs.inject
implementation Libs.coroutines
implementation Libs.coroutinesAndroid
implementation libs.appCompat
implementation libs.inject
implementation libs.coroutines
implementation libs.coroutinesAndroid

testImplementation project(':internal-test-support')
testImplementation Libs.testCore
testImplementation Libs.junit
testImplementation Libs.truth
testImplementation Libs.mockito
testImplementation Libs.robolectric
testImplementation libs.testCore
testImplementation libs.junit
testImplementation libs.truth
testImplementation libs.mockito
testImplementation libs.robolectric
}

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
30 changes: 15 additions & 15 deletions magellan-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
}

dependencies {
implementation Libs.appCompat
implementation Libs.lifecycle
implementation Libs.inject
implementation Libs.coroutines
implementation Libs.coroutinesAndroid
implementation libs.appCompat
implementation libs.lifecycle
implementation libs.inject
implementation libs.coroutines
implementation libs.coroutinesAndroid

testImplementation project(':internal-test-support')
testImplementation Libs.testCore
testImplementation Libs.testCoreKtx
testImplementation Libs.junit
testImplementation Libs.extJunitKtx
testImplementation Libs.truth
testImplementation Libs.mockito
testImplementation Libs.mockK
testImplementation Libs.archTesting
testImplementation Libs.robolectric
testImplementation Libs.coroutinesTest
testImplementation libs.testCore
testImplementation libs.testCoreKtx
testImplementation libs.junit
testImplementation libs.extJunitKtx
testImplementation libs.truth
testImplementation libs.mockito
testImplementation libs.mockK
testImplementation libs.archTesting
testImplementation libs.robolectric
testImplementation libs.coroutinesTest

// Bug in AGP: Follow this issue - https://issuetracker.google.com/issues/141840950
// lintPublish project(':magellan-lint')
Expand Down
16 changes: 8 additions & 8 deletions magellan-lint/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ lintOptions {
}

dependencies {
compileOnly Libs.lintApi
compileOnly Libs.lintChecks
compileOnly libs.lintApi
compileOnly libs.lintChecks

testImplementation Libs.junit
testImplementation Libs.truth
testImplementation Libs.lint
testImplementation Libs.lintTests
testImplementation Libs.testUtils
testImplementation(Libs.truth) {
testImplementation libs.junit
testImplementation libs.truth
testImplementation libs.lint
testImplementation libs.lintTests
testImplementation libs.testUtils
testImplementation(libs.truth) {
exclude group: 'com.google.guava', module: 'guava'
}
}
Expand Down
Loading

0 comments on commit c077916

Please sign in to comment.