From 0c755c6e25e6de7516d997c50198b925e97bcec4 Mon Sep 17 00:00:00 2001 From: Jing Tang Date: Wed, 3 Jul 2024 15:31:30 +0100 Subject: [PATCH 1/3] Migrate the rest of androidx, kotlin, junit, and truth libraries to version catalog --- buildSrc/src/main/kotlin/Dependencies.kt | 52 ------------------------ buildSrc/src/main/kotlin/Plugins.kt | 3 +- catalog/build.gradle.kts | 8 ++-- common/build.gradle.kts | 8 ++-- contrib/barcode/build.gradle.kts | 24 +++++------ contrib/locationwidget/build.gradle.kts | 24 +++++------ datacapture/build.gradle.kts | 37 +++++++++-------- demo/build.gradle.kts | 12 +++--- document/build.gradle.kts | 10 ++--- engine/benchmark/build.gradle.kts | 12 +++--- engine/build.gradle.kts | 26 ++++++------ gradle/libs.versions.toml | 34 +++++++++++++++- knowledge/build.gradle.kts | 26 ++++++------ workflow-testing/build.gradle.kts | 4 +- workflow/benchmark/build.gradle.kts | 12 +++--- workflow/build.gradle.kts | 24 +++++------ 16 files changed, 147 insertions(+), 169 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index a602784c79..8703801c12 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -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}" @@ -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}" @@ -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" @@ -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" @@ -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" diff --git a/buildSrc/src/main/kotlin/Plugins.kt b/buildSrc/src/main/kotlin/Plugins.kt index ac076028ab..1ceac54041 100644 --- a/buildSrc/src/main/kotlin/Plugins.kt +++ b/buildSrc/src/main/kotlin/Plugins.kt @@ -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" diff --git a/catalog/build.gradle.kts b/catalog/build.gradle.kts index 88cd75bdc8..9b5be6134a 100644 --- a/catalog/build.gradle.kts +++ b/catalog/build.gradle.kts @@ -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) } diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 7f53725c3e..6a8a69db54 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -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) -> diff --git a/contrib/barcode/build.gradle.kts b/contrib/barcode/build.gradle.kts index 438e766125..5a39c05853 100644 --- a/contrib/barcode/build.gradle.kts +++ b/contrib/barcode/build.gradle.kts @@ -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) @@ -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) } diff --git a/contrib/locationwidget/build.gradle.kts b/contrib/locationwidget/build.gradle.kts index ae8fa5cd33..c4c9f12e55 100644 --- a/contrib/locationwidget/build.gradle.kts +++ b/contrib/locationwidget/build.gradle.kts @@ -52,24 +52,24 @@ configurations { all { removeIncompatibleDependencies() } } dependencies { 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.play) - testImplementation(Dependencies.AndroidxTest.fragmentTesting) - testImplementation(Dependencies.Kotlin.kotlinTestJunit) - testImplementation(Dependencies.junit) testImplementation(Dependencies.robolectric) - testImplementation(Dependencies.truth) + testImplementation(libs.androidx.fragment.testing) + testImplementation(libs.junit) + testImplementation(libs.kotlin.test.junit) + testImplementation(libs.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) + 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) } diff --git a/datacapture/build.gradle.kts b/datacapture/build.gradle.kts index b5dd9edef2..a7ec78cd95 100644 --- a/datacapture/build.gradle.kts +++ b/datacapture/build.gradle.kts @@ -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) @@ -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) @@ -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) + androidTestImplementation(libs.junit) + testImplementation(libs.kotlin.test.junit) + testImplementation(libs.kotlinx.coroutines.test) + androidTestImplementation(libs.truth) constraints { Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts index c861d363a9..d48f6e6b08 100644 --- a/demo/build.gradle.kts +++ b/demo/build.gradle.kts @@ -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) @@ -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) } diff --git a/document/build.gradle.kts b/document/build.gradle.kts index 49e5df618f..304d4f77e4 100644 --- a/document/build.gradle.kts +++ b/document/build.gradle.kts @@ -46,14 +46,14 @@ dependencies { 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) + testImplementation(libs.junit) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.truth) - androidTestImplementation(Dependencies.AndroidxTest.extJunit) - androidTestImplementation(Dependencies.Espresso.espressoCore) + androidTestImplementation(libs.androidx.test.espresso.core) + androidTestImplementation(libs.androidx.test.ext.junit) } diff --git a/engine/benchmark/build.gradle.kts b/engine/benchmark/build.gradle.kts index 889040b0ff..03313f5faa 100644 --- a/engine/benchmark/build.gradle.kts +++ b/engine/benchmark/build.gradle.kts @@ -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 diff --git a/engine/build.gradle.kts b/engine/build.gradle.kts index 337f524559..86ee01fcb2 100644 --- a/engine/build.gradle.kts +++ b/engine/build.gradle.kts @@ -92,13 +92,13 @@ configurations { } dependencies { - androidTestImplementation(Dependencies.AndroidxTest.core) - androidTestImplementation(Dependencies.AndroidxTest.extJunitKtx) - androidTestImplementation(Dependencies.AndroidxTest.runner) - androidTestImplementation(Dependencies.junit) - androidTestImplementation(Dependencies.truth) androidTestImplementation(libs.androidx.room.testing) + androidTestImplementation(libs.androidx.test.core) + androidTestImplementation(libs.androidx.test.ext.junit.ktx) + androidTestImplementation(libs.androidx.test.runner) androidTestImplementation(libs.androidx.work.testing) + androidTestImplementation(libs.junit) + androidTestImplementation(libs.truth) api(Dependencies.HapiFhir.structuresR4) { exclude(module = "junit") } @@ -119,7 +119,6 @@ dependencies { exclude(module = "commons-logging") exclude(module = "httpclient") } - implementation(Dependencies.Kotlin.stdlib) implementation(Dependencies.Retrofit.coreRetrofit) implementation(Dependencies.androidFhirCommon) implementation(Dependencies.guava) @@ -127,28 +126,29 @@ dependencies { implementation(Dependencies.jsonToolsPatch) implementation(Dependencies.sqlcipher) implementation(Dependencies.timber) - implementation(Dependencies.truth) implementation(libs.androidx.datastore.preferences) implementation(libs.androidx.lifecycle.livedata) implementation(libs.androidx.room.room) implementation(libs.androidx.room.runtime) implementation(libs.androidx.sqlite) implementation(libs.androidx.work.runtime) + implementation(libs.kotlin.stdlib) + implementation(libs.truth) ksp(libs.androidx.room.compiler) - testImplementation(Dependencies.AndroidxTest.archCore) - testImplementation(Dependencies.AndroidxTest.core) - testImplementation(Dependencies.Kotlin.kotlinCoroutinesTest) - testImplementation(Dependencies.Kotlin.kotlinTestJunit) - testImplementation(Dependencies.junit) testImplementation(Dependencies.jsonAssert) testImplementation(Dependencies.mockitoInline) testImplementation(Dependencies.mockitoKotlin) testImplementation(Dependencies.mockWebServer) testImplementation(Dependencies.robolectric) - testImplementation(Dependencies.truth) + testImplementation(libs.androidx.arch.core.testing) + testImplementation(libs.androidx.test.core) testImplementation(libs.androidx.work.testing) + testImplementation(libs.junit) + testImplementation(libs.kotlin.test.junit) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.truth) constraints { Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c333ac986e..e76a0483b6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,25 +3,40 @@ [versions] androidx-acivity = "1.7.2" androidx-appcompat = "1.6.1" +androidx-arch-core = "2.2.0" +androidx-benchmark = "1.1.1" androidx-constraintlayout = "2.1.4" androidx-core = "1.10.1" -androidx-datastore-preferences = "1.0.0" +androidx-datastore = "1.0.0" +androidx-espresso = "3.5.1" androidx-fragment = "1.6.0" androidx-lifecycle = "2.6.1" androidx-navigation = "2.6.0" androidx-recyclerview = "1.3.0" androidx-room = "2.5.2" androidx-sqlite = "2.3.1" +androidx-test-core = "1.5.0" +androidx-test-ext-junit = "1.1.5" +androidx-test-rules = "1.5.0" +androidx-test-runner = "1.5.0" androidx-work = "2.8.1" glide = "4.16.0" +junit = "4.13.2" +kotlin-stdlib = "1.9.22" +kotlin-test = "1.9.22" +kotlinx-coroutines = "1.7.2" +truth = "1.1.5" [libraries] androidx-activity = { module = "androidx.activity:activity", version.ref = "androidx-acivity" } androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } +androidx-arch-core-testing = { module = "androidx.arch.core:core-testing", version.ref = "androidx-arch-core" } +androidx-benchmark-junit4 = { module = "androidx.benchmark:benchmark-junit4", version.ref = "androidx-benchmark" } androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidx-constraintlayout" } androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" } -androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "androidx-datastore-preferences" } +androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "androidx-datastore" } androidx-fragment = { module = "androidx.fragment:fragment-ktx", version.ref = "androidx-fragment" } +androidx-fragment-testing = { module = "androidx.fragment:fragment-testing", version.ref = "androidx-fragment" } androidx-lifecycle-livedata = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androidx-lifecycle" } androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime", version.ref = "androidx-lifecycle" } androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" } @@ -33,9 +48,24 @@ androidx-room-room = { module = "androidx.room:room-ktx", version.ref = "android androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "androidx-room" } androidx-room-testing = { module = "androidx.room:room-testing", version.ref = "androidx-room" } androidx-sqlite = { module = "androidx.sqlite:sqlite-ktx", version.ref = "androidx-sqlite" } +androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test-core" } +androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" } +androidx-test-espresso-contrib = { module = "androidx.test.espresso:espresso-contrib", version.ref = "androidx-espresso" } +androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-ext-junit" } +androidx-test-ext-junit-ktx = { module = "androidx.test.ext:junit-ktx", version.ref = "androidx-test-ext-junit" } +androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test-rules" } +androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" } androidx-work-runtime = { module = "androidx.work:work-runtime-ktx", version.ref = "androidx-work" } androidx-work-testing = { module = "androidx.work:work-testing", version.ref = "androidx-work" } glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-stdlib" } +kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin-test" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-play = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } +junit = { module = "junit:junit", version.ref = "junit" } +truth = { module = "com.google.truth:truth", version.ref = "truth" } [bundles] diff --git a/knowledge/build.gradle.kts b/knowledge/build.gradle.kts index d2d69ef2be..f0afac1b77 100644 --- a/knowledge/build.gradle.kts +++ b/knowledge/build.gradle.kts @@ -70,20 +70,20 @@ afterEvaluate { configureFirebaseTestLabForLibraries() } configurations { all { removeIncompatibleDependencies() } } dependencies { - androidTestImplementation(Dependencies.AndroidxTest.core) - androidTestImplementation(Dependencies.AndroidxTest.runner) - androidTestImplementation(Dependencies.AndroidxTest.extJunitKtx) - androidTestImplementation(Dependencies.Kotlin.kotlinCoroutinesTest) - androidTestImplementation(Dependencies.junit) - androidTestImplementation(Dependencies.truth) + androidTestImplementation(libs.androidx.test.core) + androidTestImplementation(libs.androidx.test.ext.junit.ktx) + androidTestImplementation(libs.androidx.test.runner) + androidTestImplementation(libs.junit) + androidTestImplementation(libs.kotlinx.coroutines.test) + androidTestImplementation(libs.truth) api(Dependencies.HapiFhir.structuresR4) { exclude(module = "junit") } api(Dependencies.HapiFhir.guavaCaching) coreLibraryDesugaring(Dependencies.desugarJdkLibs) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.Kotlin.kotlinCoroutinesCore) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.core) implementation(Dependencies.timber) implementation(Dependencies.http) implementation(Dependencies.HapiFhir.fhirCoreConvertors) @@ -94,15 +94,15 @@ dependencies { ksp(libs.androidx.room.compiler) - testImplementation(Dependencies.AndroidxTest.archCore) - testImplementation(Dependencies.AndroidxTest.core) - testImplementation(Dependencies.junit) - testImplementation(Dependencies.Kotlin.kotlinCoroutinesTest) testImplementation(Dependencies.mockitoInline) testImplementation(Dependencies.mockitoKotlin) testImplementation(Dependencies.mockWebServer) testImplementation(Dependencies.robolectric) - testImplementation(Dependencies.truth) + testImplementation(libs.androidx.arch.core.testing) + testImplementation(libs.androidx.test.core) + testImplementation(libs.junit) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.truth) constraints { Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> diff --git a/workflow-testing/build.gradle.kts b/workflow-testing/build.gradle.kts index dadb083443..41aaf1b853 100644 --- a/workflow-testing/build.gradle.kts +++ b/workflow-testing/build.gradle.kts @@ -20,11 +20,11 @@ dependencies { compileOnly(Dependencies.Cql.evaluatorFhirUtilities) compileOnly(project(":engine")) { exclude(module = "truth") } - compileOnly(Dependencies.junit) compileOnly(Dependencies.jsonAssert) compileOnly(Dependencies.woodstox) compileOnly(Dependencies.xmlUnit) - compileOnly(Dependencies.truth) + compileOnly(libs.junit) + compileOnly(libs.truth) constraints { Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> diff --git a/workflow/benchmark/build.gradle.kts b/workflow/benchmark/build.gradle.kts index b438decfdb..28a64c2647 100644 --- a/workflow/benchmark/build.gradle.kts +++ b/workflow/benchmark/build.gradle.kts @@ -48,17 +48,17 @@ afterEvaluate { configureFirebaseTestLabForMicroBenchmark() } configurations { all { removeIncompatibleDependencies() } } dependencies { - androidTestImplementation(Dependencies.AndroidxTest.benchmarkJunit) - androidTestImplementation(Dependencies.AndroidxTest.extJunit) - androidTestImplementation(Dependencies.AndroidxTest.runner) androidTestImplementation(Dependencies.Cql.evaluator) androidTestImplementation(Dependencies.Cql.evaluatorFhirJackson) androidTestImplementation(Dependencies.Cql.evaluatorFhirUtilities) - androidTestImplementation(Dependencies.junit) - androidTestImplementation(Dependencies.Kotlin.kotlinCoroutinesAndroid) - 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")) androidTestImplementation(project(":knowledge")) { exclude(group = Dependencies.androidFhirGroup, module = Dependencies.androidFhirEngineModule) diff --git a/workflow/build.gradle.kts b/workflow/build.gradle.kts index a16b9418dd..f6238eba26 100644 --- a/workflow/build.gradle.kts +++ b/workflow/build.gradle.kts @@ -78,15 +78,15 @@ configurations { all { removeIncompatibleDependencies() } } dependencies { coreLibraryDesugaring(Dependencies.desugarJdkLibs) - androidTestImplementation(Dependencies.AndroidxTest.core) - androidTestImplementation(Dependencies.AndroidxTest.extJunit) - androidTestImplementation(Dependencies.AndroidxTest.extJunitKtx) - androidTestImplementation(Dependencies.AndroidxTest.runner) androidTestImplementation(Dependencies.jsonAssert) - androidTestImplementation(Dependencies.junit) - androidTestImplementation(Dependencies.truth) androidTestImplementation(Dependencies.xmlUnit) + androidTestImplementation(libs.androidx.test.core) + androidTestImplementation(libs.androidx.test.ext.junit) + androidTestImplementation(libs.androidx.test.ext.junit.ktx) + androidTestImplementation(libs.androidx.test.runner) androidTestImplementation(libs.androidx.work.testing) + androidTestImplementation(libs.junit) + androidTestImplementation(libs.truth) androidTestImplementation(project(":workflow-testing")) api(Dependencies.HapiFhir.structuresR4) { exclude(module = "junit") } @@ -95,21 +95,21 @@ dependencies { implementation(Dependencies.Cql.evaluator) implementation(Dependencies.Cql.evaluatorFhirJackson) implementation(Dependencies.HapiFhir.guavaCaching) - implementation(Dependencies.Kotlin.kotlinCoroutinesAndroid) - implementation(Dependencies.Kotlin.kotlinCoroutinesCore) - implementation(Dependencies.Kotlin.stdlib) implementation(Dependencies.androidFhirEngine) { exclude(module = "truth") } implementation(Dependencies.androidFhirKnowledge) implementation(Dependencies.timber) implementation(Dependencies.xerces) implementation(libs.androidx.core) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) + implementation(libs.kotlinx.coroutines.core) - testImplementation(Dependencies.AndroidxTest.core) testImplementation(Dependencies.jsonAssert) - testImplementation(Dependencies.junit) testImplementation(Dependencies.robolectric) - testImplementation(Dependencies.truth) testImplementation(Dependencies.xmlUnit) + testImplementation(libs.androidx.test.core) + testImplementation(libs.junit) + testImplementation(libs.truth) testImplementation(project(mapOf("path" to ":knowledge"))) testImplementation(project(":workflow-testing")) From 45fe08d8fd90900977460b214ec1c895445ea65c Mon Sep 17 00:00:00 2001 From: Jing Tang Date: Wed, 3 Jul 2024 15:42:57 +0100 Subject: [PATCH 2/3] Correct play services dependency --- contrib/locationwidget/build.gradle.kts | 2 +- gradle/libs.versions.toml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contrib/locationwidget/build.gradle.kts b/contrib/locationwidget/build.gradle.kts index c4c9f12e55..89302ebb71 100644 --- a/contrib/locationwidget/build.gradle.kts +++ b/contrib/locationwidget/build.gradle.kts @@ -57,7 +57,7 @@ dependencies { implementation(libs.androidx.appcompat) implementation(libs.androidx.core) implementation(libs.androidx.fragment) - implementation(libs.kotlinx.coroutines.play) + implementation(libs.kotlinx.coroutines.playservices) testImplementation(Dependencies.robolectric) testImplementation(libs.androidx.fragment.testing) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e76a0483b6..9f27c2dc96 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -58,14 +58,14 @@ androidx-test-runner = { module = "androidx.test:runner", version.ref = "android androidx-work-runtime = { module = "androidx.work:work-runtime-ktx", version.ref = "androidx-work" } androidx-work-testing = { module = "androidx.work:work-testing", version.ref = "androidx-work" } glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" } -kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-stdlib" } -kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin-test" } -kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-play = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } -junit = { module = "junit:junit", version.ref = "junit" } -truth = { module = "com.google.truth:truth", version.ref = "truth" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-stdlib" } +kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin-test" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-playservices = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } +junit = { module = "junit:junit", version.ref = "junit" } +truth = { module = "com.google.truth:truth", version.ref = "truth" } [bundles] From 30a1f76670c4122b98957a1849ebdf5bf0695baa Mon Sep 17 00:00:00 2001 From: Jing Tang Date: Wed, 3 Jul 2024 17:36:57 +0100 Subject: [PATCH 3/3] Reorganize misplaced dependencies --- contrib/locationwidget/build.gradle.kts | 16 ++++++++-------- datacapture/build.gradle.kts | 4 ++-- document/build.gradle.kts | 10 +++++----- engine/build.gradle.kts | 12 +++++------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/contrib/locationwidget/build.gradle.kts b/contrib/locationwidget/build.gradle.kts index 89302ebb71..f0055c3125 100644 --- a/contrib/locationwidget/build.gradle.kts +++ b/contrib/locationwidget/build.gradle.kts @@ -50,6 +50,14 @@ 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.material) @@ -64,12 +72,4 @@ dependencies { testImplementation(libs.junit) testImplementation(libs.kotlin.test.junit) testImplementation(libs.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) } diff --git a/datacapture/build.gradle.kts b/datacapture/build.gradle.kts index a7ec78cd95..af41dea3a0 100644 --- a/datacapture/build.gradle.kts +++ b/datacapture/build.gradle.kts @@ -110,10 +110,10 @@ dependencies { } testImplementation(libs.androidx.test.core) testImplementation(libs.androidx.fragment.testing) - androidTestImplementation(libs.junit) + testImplementation(libs.junit) testImplementation(libs.kotlin.test.junit) testImplementation(libs.kotlinx.coroutines.test) - androidTestImplementation(libs.truth) + testImplementation(libs.truth) constraints { Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> diff --git a/document/build.gradle.kts b/document/build.gradle.kts index 304d4f77e4..915e103b00 100644 --- a/document/build.gradle.kts +++ b/document/build.gradle.kts @@ -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) @@ -44,8 +49,6 @@ dependencies { implementation(libs.androidx.appcompat) implementation(libs.androidx.core) - coreLibraryDesugaring(Dependencies.desugarJdkLibs) - testImplementation(Dependencies.robolectric) testImplementation(Dependencies.mockitoKotlin) testImplementation(Dependencies.mockitoInline) @@ -53,7 +56,4 @@ dependencies { testImplementation(libs.junit) testImplementation(libs.kotlinx.coroutines.test) testImplementation(libs.truth) - - androidTestImplementation(libs.androidx.test.espresso.core) - androidTestImplementation(libs.androidx.test.ext.junit) } diff --git a/engine/build.gradle.kts b/engine/build.gradle.kts index 86ee01fcb2..c036455432 100644 --- a/engine/build.gradle.kts +++ b/engine/build.gradle.kts @@ -102,19 +102,15 @@ dependencies { api(Dependencies.HapiFhir.structuresR4) { exclude(module = "junit") } + coreLibraryDesugaring(Dependencies.desugarJdkLibs) + // We have removed the dependency on Caffeine from HAPI due to conflicts with android - // Guave Caching must be individually loaded instead. + // Guava Caching must be individually loaded instead. implementation(Dependencies.HapiFhir.guavaCaching) - // Validation to load system types into FhirPath's Context // The loading happens via a ResourceStream in XML and thus // XML parsers are also necessary. implementation(Dependencies.HapiFhir.validationR4) - implementation(Dependencies.woodstox) - implementation(Dependencies.xerces) - - coreLibraryDesugaring(Dependencies.desugarJdkLibs) - implementation(Dependencies.HapiFhir.validation) { exclude(module = "commons-logging") exclude(module = "httpclient") @@ -126,6 +122,8 @@ dependencies { implementation(Dependencies.jsonToolsPatch) implementation(Dependencies.sqlcipher) implementation(Dependencies.timber) + implementation(Dependencies.woodstox) + implementation(Dependencies.xerces) implementation(libs.androidx.datastore.preferences) implementation(libs.androidx.lifecycle.livedata) implementation(libs.androidx.room.room)