Skip to content

Commit

Permalink
Migrate the rest of androidx, kotlin, junit, and truth libraries to v…
Browse files Browse the repository at this point in the history
…ersion catalog (google#2598)
  • Loading branch information
jingtang10 authored and Santosh Pingle committed Jul 8, 2024
1 parent 9458915 commit c459c2d
Show file tree
Hide file tree
Showing 16 changed files with 156 additions and 180 deletions.
52 changes: 0 additions & 52 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,6 @@ object Dependencies {
const val jsr310Base = "$datatypeGroup:jackson-datatype-jsr310:${Versions.jackson}"
}

object Kotlin {
const val kotlinCoroutinesAndroid =
"org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.Kotlin.kotlinCoroutinesCore}"
const val kotlinCoroutinesCore =
"org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.Kotlin.kotlinCoroutinesCore}"
const val kotlinTestJunit = "org.jetbrains.kotlin:kotlin-test-junit:${Versions.Kotlin.stdlib}"
const val kotlinCoroutinesTest =
"org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.Kotlin.kotlinCoroutinesCore}"
const val kotlinCoroutinesPlay =
"org.jetbrains.kotlinx:kotlinx-coroutines-play-services:${Versions.Kotlin.kotlinCoroutinesCore}"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.Kotlin.stdlib}"
}

object Retrofit {
const val coreRetrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofit}"
const val gsonConverter = "com.squareup.retrofit2:converter-gson:${Versions.retrofit}"
Expand Down Expand Up @@ -139,35 +126,14 @@ object Dependencies {
const val zxing = "com.google.zxing:core:${Versions.zxing}"
const val nimbus = "com.nimbusds:nimbus-jose-jwt:${Versions.nimbus}"

// Dependencies for testing go here
object AndroidxTest {
const val archCore = "androidx.arch.core:core-testing:${Versions.AndroidxTest.archCore}"
const val benchmarkJunit =
"androidx.benchmark:benchmark-junit4:${Versions.AndroidxTest.benchmarkJUnit}"
const val core = "androidx.test:core:${Versions.AndroidxTest.core}"
const val extJunit = "androidx.test.ext:junit:${Versions.AndroidxTest.extJunit}"
const val extJunitKtx = "androidx.test.ext:junit-ktx:${Versions.AndroidxTest.extJunit}"
const val fragmentTesting =
"androidx.fragment:fragment-testing:${Versions.AndroidxTest.fragmentVersion}"
const val rules = "androidx.test:rules:${Versions.AndroidxTest.rules}"
const val runner = "androidx.test:runner:${Versions.AndroidxTest.runner}"
}

object Espresso {
const val espressoCore = "androidx.test.espresso:espresso-core:${Versions.espresso}"
const val espressoContrib = "androidx.test.espresso:espresso-contrib:${Versions.espresso}"
}

const val androidBenchmarkRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner"
const val androidJunitRunner = "androidx.test.runner.AndroidJUnitRunner"

// Makes Json assertions where the order of elements, tabs/whitespaces are not important.
const val jsonAssert = "org.skyscreamer:jsonassert:${Versions.jsonAssert}"
const val junit = "junit:junit:${Versions.junit}"
const val mockitoKotlin = "org.mockito.kotlin:mockito-kotlin:${Versions.mockitoKotlin}"
const val mockitoInline = "org.mockito:mockito-inline:${Versions.mockitoInline}"
const val robolectric = "org.robolectric:robolectric:${Versions.robolectric}"
const val truth = "com.google.truth:truth:${Versions.truth}"

// Makes XML assertions where the order of elements, tabs/whitespaces are not important.
const val xmlUnit = "org.xmlunit:xmlunit-core:${Versions.xmlUnit}"
Expand All @@ -178,11 +144,6 @@ object Dependencies {
const val clinicalReasoning = "3.0.0-PRE9-SNAPSHOT"
}

object Kotlin {
const val kotlinCoroutinesCore = "1.7.2"
const val stdlib = "1.9.22"
}

const val androidFhirCommon = "0.1.0-alpha05"
const val androidFhirEngine = "0.1.0-beta05"
const val androidFhirKnowledge = "0.1.0-alpha03"
Expand Down Expand Up @@ -211,7 +172,6 @@ object Dependencies {
const val gsonConverter = "2.1.0"
const val sqlcipher = "4.5.4"
const val timber = "5.0.1"
const val truth = "1.1.5"
const val woodstox = "6.5.1"
const val xerces = "2.12.2"
const val xmlUnit = "2.9.1"
Expand All @@ -220,19 +180,7 @@ object Dependencies {
const val nimbus = "9.31"

// Test dependencies
object AndroidxTest {
const val benchmarkJUnit = "1.1.1"
const val core = "1.5.0"
const val archCore = "2.2.0"
const val extJunit = "1.1.5"
const val rules = "1.5.0"
const val runner = "1.5.0"
const val fragmentVersion = "1.6.0"
}

const val espresso = "3.5.1"
const val jacoco = "0.8.10"
const val junit = "4.13.2"
const val mockitoKotlin = "3.2.0"
const val mockitoInline = "4.0.0"
const val robolectric = "4.10.3"
Expand Down
3 changes: 1 addition & 2 deletions buildSrc/src/main/kotlin/Plugins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ object Plugins {
const val androidGradlePlugin = "com.android.tools.build:gradle:${Versions.androidGradlePlugin}"
const val benchmarkGradlePlugin =
"androidx.benchmark:benchmark-gradle-plugin:${Versions.benchmarkPlugin}"
const val kotlinGradlePlugin =
"org.jetbrains.kotlin:kotlin-gradle-plugin:${Dependencies.Versions.Kotlin.stdlib}"
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
const val navSafeArgsGradlePlugin = "androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0"
const val rulerGradlePlugin = "com.spotify.ruler:ruler-gradle-plugin:1.2.1"
const val flankGradlePlugin = "com.osacky.flank.gradle:fladle:0.17.4"
Expand Down
8 changes: 4 additions & 4 deletions catalog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ android {
}

dependencies {
androidTestImplementation(Dependencies.AndroidxTest.extJunit)
androidTestImplementation(Dependencies.Espresso.espressoCore)
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.test.ext.junit)

coreLibraryDesugaring(Dependencies.desugarJdkLibs)

implementation(Dependencies.material)
implementation(Dependencies.Kotlin.stdlib)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.core)
implementation(libs.androidx.fragment)
implementation(libs.androidx.navigation.fragment)
implementation(libs.androidx.navigation.ui)
implementation(libs.kotlin.stdlib)

implementation(project(path = ":datacapture"))
implementation(project(path = ":engine"))
implementation(project(path = ":contrib:barcode"))
implementation(project(path = ":contrib:locationwidget"))

testImplementation(Dependencies.junit)
testImplementation(libs.junit)
}
8 changes: 4 additions & 4 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ dependencies {

implementation(Dependencies.fhirUcum)

testImplementation(Dependencies.Kotlin.kotlinTestJunit)
testImplementation(Dependencies.AndroidxTest.core)
testImplementation(Dependencies.junit)
testImplementation(Dependencies.robolectric)
testImplementation(Dependencies.truth)
testImplementation(libs.androidx.test.core)
testImplementation(libs.junit)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.truth)

constraints {
Dependencies.hapiFhirConstraints().forEach { (libName, constraints) ->
Expand Down
24 changes: 12 additions & 12 deletions contrib/barcode/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ android {
configurations { all { removeIncompatibleDependencies() } }

dependencies {
androidTestImplementation(Dependencies.AndroidxTest.core)
androidTestImplementation(Dependencies.AndroidxTest.extJunit)
androidTestImplementation(Dependencies.AndroidxTest.extJunitKtx)
androidTestImplementation(Dependencies.AndroidxTest.fragmentTesting)
androidTestImplementation(Dependencies.AndroidxTest.rules)
androidTestImplementation(Dependencies.AndroidxTest.runner)
androidTestImplementation(Dependencies.mockitoInline)
androidTestImplementation(Dependencies.truth)
androidTestImplementation(libs.androidx.fragment.testing)
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.ext.junit.ktx)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.truth)

implementation(project(":datacapture"))
implementation(Dependencies.Mlkit.barcodeScanning)
Expand All @@ -68,12 +68,12 @@ dependencies {
implementation(libs.androidx.core)
implementation(libs.androidx.fragment)

testImplementation(Dependencies.AndroidxTest.core)
testImplementation(Dependencies.AndroidxTest.fragmentTesting)
testImplementation(Dependencies.Kotlin.kotlinTestJunit)
testImplementation(Dependencies.junit)
testImplementation(Dependencies.mockitoInline)
testImplementation(Dependencies.mockitoKotlin)
testImplementation(Dependencies.robolectric)
testImplementation(Dependencies.truth)
testImplementation(libs.androidx.fragment.testing)
testImplementation(libs.androidx.test.core)
testImplementation(libs.junit)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.truth)
}
26 changes: 13 additions & 13 deletions contrib/locationwidget/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,26 @@ android {
configurations { all { removeIncompatibleDependencies() } }

dependencies {
androidTestImplementation(libs.androidx.fragment.testing)
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.ext.junit.ktx)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.truth)

implementation(project(":datacapture"))
implementation(Dependencies.playServicesLocation)
implementation(Dependencies.Kotlin.kotlinCoroutinesPlay)
implementation(Dependencies.material)
implementation(Dependencies.timber)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.core)
implementation(libs.androidx.fragment)
implementation(libs.kotlinx.coroutines.playservices)

testImplementation(Dependencies.AndroidxTest.fragmentTesting)
testImplementation(Dependencies.Kotlin.kotlinTestJunit)
testImplementation(Dependencies.junit)
testImplementation(Dependencies.robolectric)
testImplementation(Dependencies.truth)

androidTestImplementation(Dependencies.AndroidxTest.core)
androidTestImplementation(Dependencies.AndroidxTest.extJunit)
androidTestImplementation(Dependencies.AndroidxTest.extJunitKtx)
androidTestImplementation(Dependencies.AndroidxTest.fragmentTesting)
androidTestImplementation(Dependencies.AndroidxTest.rules)
androidTestImplementation(Dependencies.AndroidxTest.runner)
androidTestImplementation(Dependencies.truth)
testImplementation(libs.androidx.fragment.testing)
testImplementation(libs.junit)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.truth)
}
37 changes: 19 additions & 18 deletions datacapture/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,20 @@ configurations {
}

dependencies {
androidTestImplementation(Dependencies.AndroidxTest.core)
androidTestImplementation(Dependencies.AndroidxTest.extJunit)
androidTestImplementation(Dependencies.AndroidxTest.extJunitKtx)
androidTestImplementation(Dependencies.Kotlin.kotlinCoroutinesTest)
androidTestImplementation(Dependencies.AndroidxTest.rules)
androidTestImplementation(Dependencies.AndroidxTest.runner)
androidTestImplementation(Dependencies.junit)
androidTestImplementation(Dependencies.truth)
androidTestImplementation(Dependencies.Espresso.espressoCore)
androidTestImplementation(Dependencies.Espresso.espressoContrib) {
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.test.espresso.contrib) {
// build fails with error "Duplicate class found" (org.checkerframework.checker.*)
exclude(group = "org.checkerframework", module = "checker")
}
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.ext.junit.ktx)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.kotlinx.coroutines.test)
androidTestImplementation(libs.truth)

api(Dependencies.HapiFhir.structuresR4)

coreLibraryDesugaring(Dependencies.desugarJdkLibs)
Expand All @@ -89,8 +90,6 @@ dependencies {
exclude(module = "commons-logging")
exclude(module = "httpclient")
}
implementation(Dependencies.Kotlin.kotlinCoroutinesCore)
implementation(Dependencies.Kotlin.stdlib)
implementation(Dependencies.androidFhirCommon)
implementation(Dependencies.material)
implementation(Dependencies.timber)
Expand All @@ -100,19 +99,21 @@ dependencies {
implementation(libs.androidx.fragment)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.glide)
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.coroutines.core)

testImplementation(Dependencies.AndroidxTest.core)
testImplementation(Dependencies.AndroidxTest.fragmentTesting)
testImplementation(Dependencies.Kotlin.kotlinCoroutinesTest)
testImplementation(Dependencies.Kotlin.kotlinTestJunit)
testImplementation(Dependencies.junit)
testImplementation(Dependencies.mockitoInline)
testImplementation(Dependencies.mockitoKotlin)
testImplementation(Dependencies.robolectric)
testImplementation(Dependencies.truth)
testImplementation(project(":knowledge")) {
exclude(group = Dependencies.androidFhirGroup, module = Dependencies.androidFhirEngineModule)
}
testImplementation(libs.androidx.test.core)
testImplementation(libs.androidx.fragment.testing)
testImplementation(libs.junit)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.truth)

constraints {
Dependencies.hapiFhirConstraints().forEach { (libName, constraints) ->
Expand Down
12 changes: 6 additions & 6 deletions demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,11 @@ android {
}

dependencies {
androidTestImplementation(Dependencies.AndroidxTest.extJunit)
androidTestImplementation(Dependencies.Espresso.espressoCore)
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.test.ext.junit)

coreLibraryDesugaring(Dependencies.desugarJdkLibs)

implementation(Dependencies.Kotlin.kotlinCoroutinesAndroid)
implementation(Dependencies.Kotlin.kotlinCoroutinesCore)
implementation(Dependencies.Kotlin.stdlib)
implementation(Dependencies.material)
implementation(Dependencies.timber)
implementation(libs.androidx.activity)
Expand All @@ -60,10 +57,13 @@ dependencies {
implementation(libs.androidx.navigation.ui)
implementation(libs.androidx.recyclerview)
implementation(libs.androidx.work.runtime)
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlinx.coroutines.core)
implementation(project(":datacapture")) {
exclude(group = Dependencies.androidFhirGroup, module = Dependencies.androidFhirEngineModule)
}
implementation(project(":engine"))

testImplementation(Dependencies.junit)
testImplementation(libs.junit)
}
16 changes: 8 additions & 8 deletions document/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ android {
}

dependencies {
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.test.ext.junit)

coreLibraryDesugaring(Dependencies.desugarJdkLibs)

implementation(Dependencies.material)
implementation(Dependencies.androidFhirEngine)
implementation(Dependencies.Retrofit.coreRetrofit)
Expand All @@ -44,16 +49,11 @@ dependencies {
implementation(libs.androidx.appcompat)
implementation(libs.androidx.core)

coreLibraryDesugaring(Dependencies.desugarJdkLibs)

testImplementation(Dependencies.junit)
testImplementation(Dependencies.robolectric)
testImplementation(Dependencies.mockitoKotlin)
testImplementation(Dependencies.mockitoInline)
testImplementation(Dependencies.Kotlin.kotlinCoroutinesTest)
testImplementation(Dependencies.mockWebServer)
testImplementation(Dependencies.truth)

androidTestImplementation(Dependencies.AndroidxTest.extJunit)
androidTestImplementation(Dependencies.Espresso.espressoCore)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.truth)
}
12 changes: 6 additions & 6 deletions engine/benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ android {
afterEvaluate { configureFirebaseTestLabForMicroBenchmark() }

dependencies {
androidTestImplementation(Dependencies.AndroidxTest.benchmarkJunit)
androidTestImplementation(Dependencies.AndroidxTest.extJunit)
androidTestImplementation(Dependencies.AndroidxTest.runner)
androidTestImplementation(Dependencies.Kotlin.kotlinCoroutinesAndroid)
androidTestImplementation(Dependencies.Retrofit.coreRetrofit)
androidTestImplementation(Dependencies.junit)
androidTestImplementation(Dependencies.mockWebServer)
androidTestImplementation(Dependencies.truth)
androidTestImplementation(libs.androidx.benchmark.junit4)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.androidx.work.runtime)
androidTestImplementation(libs.androidx.work.testing)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.kotlinx.coroutines.android)
androidTestImplementation(libs.truth)

androidTestImplementation(project(":engine"))
// for test json files only
Expand Down
Loading

0 comments on commit c459c2d

Please sign in to comment.