From 9091067e940bec34b7c4662b04ba9baf67da8449 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 18 Dec 2023 17:46:29 -0500 Subject: [PATCH 1/2] Moves the version selection from resolutionStrategy to dependencyConstraints to make sure it is exported to maven correctly. --- buildSrc/src/main/kotlin/Dependencies.kt | 183 ++++++++++++----------- catalog/build.gradle.kts | 4 - common/build.gradle.kts | 22 ++- contrib/barcode/build.gradle.kts | 9 +- datacapture/build.gradle.kts | 15 +- demo/build.gradle.kts | 4 - engine/benchmark/build.gradle.kts | 14 -- engine/build.gradle.kts | 16 +- knowledge/build.gradle.kts | 16 +- workflow-testing/build.gradle.kts | 28 +--- workflow/benchmark/build.gradle.kts | 14 +- workflow/build.gradle.kts | 19 +-- 12 files changed, 158 insertions(+), 186 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index bf3b3fd7b7..cb9819640b 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -15,6 +15,7 @@ */ import org.gradle.api.artifacts.Configuration +import org.gradle.api.artifacts.DependencyConstraint import org.gradle.kotlin.dsl.exclude object Dependencies { @@ -46,34 +47,53 @@ object Dependencies { } object HapiFhir { - const val fhirBase = "ca.uhn.hapi.fhir:hapi-fhir-base:${Versions.hapiFhir}" - const val fhirClient = "ca.uhn.hapi.fhir:hapi-fhir-client:${Versions.hapiFhir}" - const val structuresDstu2 = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2:${Versions.hapiFhir}" - const val structuresDstu3 = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu3:${Versions.hapiFhir}" - const val structuresR4 = "ca.uhn.hapi.fhir:hapi-fhir-structures-r4:${Versions.hapiFhir}" - const val structuresR4b = "ca.uhn.hapi.fhir:hapi-fhir-structures-r4b:${Versions.hapiFhir}" - const val structuresR5 = "ca.uhn.hapi.fhir:hapi-fhir-structures-r5:${Versions.hapiFhir}" - - const val validation = "ca.uhn.hapi.fhir:hapi-fhir-validation:${Versions.hapiFhir}" - const val validationDstu3 = - "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu3:${Versions.hapiFhir}" - const val validationR4 = - "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:${Versions.hapiFhir}" - const val validationR5 = - "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r5:${Versions.hapiFhir}" - - const val fhirCoreDstu2 = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2:${Versions.hapiFhirCore}" - const val fhirCoreDstu2016 = - "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may:${Versions.hapiFhirCore}" - const val fhirCoreDstu3 = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu3:${Versions.hapiFhirCore}" - const val fhirCoreR4 = "ca.uhn.hapi.fhir:org.hl7.fhir.r4:${Versions.hapiFhirCore}" - const val fhirCoreR4b = "ca.uhn.hapi.fhir:org.hl7.fhir.r4b:${Versions.hapiFhirCore}" - const val fhirCoreR5 = "ca.uhn.hapi.fhir:org.hl7.fhir.r5:${Versions.hapiFhirCore}" - const val fhirCoreUtils = "ca.uhn.hapi.fhir:org.hl7.fhir.utilities:${Versions.hapiFhirCore}" - const val fhirCoreConvertors = - "ca.uhn.hapi.fhir:org.hl7.fhir.convertors:${Versions.hapiFhirCore}" - - const val guavaCaching = "ca.uhn.hapi.fhir:hapi-fhir-caching-guava:${Versions.hapiFhir}" + const val fhirBaseModule = "ca.uhn.hapi.fhir:hapi-fhir-base" + const val fhirClientModule = "ca.uhn.hapi.fhir:hapi-fhir-client" + const val structuresDstu2Module = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2" + const val structuresDstu3Module = "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu3" + const val structuresR4Module = "ca.uhn.hapi.fhir:hapi-fhir-structures-r4" + const val structuresR4bModule = "ca.uhn.hapi.fhir:hapi-fhir-structures-r4b" + const val structuresR5Module = "ca.uhn.hapi.fhir:hapi-fhir-structures-r5" + + const val validationModule = "ca.uhn.hapi.fhir:hapi-fhir-validation" + const val validationDstu3Module = "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-dstu3" + const val validationR4Module = "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4" + const val validationR5Module = "ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r5" + + const val fhirCoreDstu2Module = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2" + const val fhirCoreDstu2016Module = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may" + const val fhirCoreDstu3Module = "ca.uhn.hapi.fhir:org.hl7.fhir.dstu3" + const val fhirCoreR4Module = "ca.uhn.hapi.fhir:org.hl7.fhir.r4" + const val fhirCoreR4bModule = "ca.uhn.hapi.fhir:org.hl7.fhir.r4b" + const val fhirCoreR5Module = "ca.uhn.hapi.fhir:org.hl7.fhir.r5" + const val fhirCoreUtilsModule = "ca.uhn.hapi.fhir:org.hl7.fhir.utilities" + const val fhirCoreConvertorsModule = "ca.uhn.hapi.fhir:org.hl7.fhir.convertors" + + const val guavaCachingModule = "ca.uhn.hapi.fhir:hapi-fhir-caching-guava" + + const val fhirBase = "$fhirBaseModule:${Versions.hapiFhir}" + const val fhirClient = "$fhirClientModule:${Versions.hapiFhir}" + const val structuresDstu2 = "$structuresDstu2Module:${Versions.hapiFhir}" + const val structuresDstu3 = "$structuresDstu3Module:${Versions.hapiFhir}" + const val structuresR4 = "$structuresR4Module:${Versions.hapiFhir}" + const val structuresR4b = "$structuresR4bModule:${Versions.hapiFhir}" + const val structuresR5 = "$structuresR5Module:${Versions.hapiFhir}" + + const val validation = "$validationModule:${Versions.hapiFhir}" + const val validationDstu3 = "$validationDstu3Module:${Versions.hapiFhir}" + const val validationR4 = "$validationR4Module:${Versions.hapiFhir}" + const val validationR5 = "$validationR5Module:${Versions.hapiFhir}" + + const val fhirCoreDstu2 = "$fhirCoreDstu2Module:${Versions.hapiFhirCore}" + const val fhirCoreDstu2016 = "$fhirCoreDstu2016Module:${Versions.hapiFhirCore}" + const val fhirCoreDstu3 = "$fhirCoreDstu3Module:${Versions.hapiFhirCore}" + const val fhirCoreR4 = "$fhirCoreR4Module:${Versions.hapiFhirCore}" + const val fhirCoreR4b = "$fhirCoreR4bModule:${Versions.hapiFhirCore}" + const val fhirCoreR5 = "$fhirCoreR5Module:${Versions.hapiFhirCore}" + const val fhirCoreUtils = "$fhirCoreUtilsModule:${Versions.hapiFhirCore}" + const val fhirCoreConvertors = "$fhirCoreConvertorsModule:${Versions.hapiFhirCore}" + + const val guavaCaching = "$guavaCachingModule:${Versions.hapiFhir}" } object Jackson { @@ -83,13 +103,22 @@ object Dependencies { private const val datatypeGroup = "$mainGroup.datatype" private const val moduleGroup = "$mainGroup.module" - const val annotations = "$coreGroup:jackson-annotations:${Versions.jackson}" - const val bom = "$mainGroup:jackson-bom:${Versions.jackson}" - const val core = "$coreGroup:jackson-core:${Versions.jacksonCore}" - const val databind = "$coreGroup:jackson-databind:${Versions.jackson}" - const val dataformatXml = "$dataformatGroup:jackson-dataformat-xml:${Versions.jackson}" - const val jaxbAnnotations = "$moduleGroup:jackson-module-jaxb-annotations:${Versions.jackson}" - const val jsr310 = "$datatypeGroup:jackson-datatype-jsr310:${Versions.jackson}" + const val annotationsBase = "$coreGroup:jackson-annotations:${Versions.jackson}" + const val bomBase = "$mainGroup:jackson-bom:${Versions.jackson}" + const val coreBase = "$coreGroup:jackson-core:${Versions.jacksonCore}" + const val databindBase = "$coreGroup:jackson-databind:${Versions.jackson}" + const val dataformatXmlBase = "$dataformatGroup:jackson-dataformat-xml:${Versions.jackson}" + const val jaxbAnnotationsBase = + "$moduleGroup:jackson-module-jaxb-annotations:${Versions.jackson}" + const val jsr310Base = "$datatypeGroup:jackson-datatype-jsr310:${Versions.jackson}" + + const val annotations = "$annotationsBase:${Versions.jackson}" + const val bom = "$bomBase:${Versions.jackson}" + const val core = "$coreBase:${Versions.jacksonCore}" + const val databind = "$databindBase:${Versions.jackson}" + const val dataformatXml = "$dataformatXmlBase:${Versions.jackson}" + const val jaxbAnnotations = "$jaxbAnnotationsBase:${Versions.jackson}" + const val jsr310 = "$jsr310Base:${Versions.jackson}" } object Kotlin { @@ -151,7 +180,10 @@ object Dependencies { const val desugarJdkLibs = "com.android.tools:desugar_jdk_libs:${Versions.desugarJdkLibs}" const val fhirUcum = "org.fhir:ucum:${Versions.fhirUcum}" const val gson = "com.google.code.gson:gson:${Versions.gson}" - const val guava = "com.google.guava:guava:${Versions.guava}" + + const val guavaModule = "com.google.guava:guava" + const val guava = "$guavaModule:${Versions.guava}" + const val httpInterceptor = "com.squareup.okhttp3:logging-interceptor:${Versions.http}" const val http = "com.squareup.okhttp3:okhttp:${Versions.http}" const val mockWebServer = "com.squareup.okhttp3:mockwebserver:${Versions.http}" @@ -235,7 +267,7 @@ object Dependencies { const val caffeine = "2.9.1" const val fhirUcum = "1.0.3" const val gson = "2.9.1" - const val guava = "32.1.2-android" + const val guava = "32.1.3-android" const val hapiFhir = "6.8.0" const val hapiFhirCore = "6.0.22" @@ -294,57 +326,38 @@ object Dependencies { exclude(group = "org.apache.httpcomponents") exclude(group = "org.antlr", module = "antlr4") exclude(group = "org.eclipse.persistence", module = "org.eclipse.persistence.moxy") - } - - fun Configuration.forceGuava() { - // Removes caffeine exclude(module = "hapi-fhir-caching-caffeine") exclude(group = "com.github.ben-manes.caffeine", module = "caffeine") - - resolutionStrategy { - force(guava) - force(HapiFhir.guavaCaching) - } } - fun Configuration.forceHapiVersion() { - // Removes newer versions of caffeine and manually imports 2.9 - // Removes newer versions of hapi and keeps on 6.0.1 - // (newer versions don't work on Android) - resolutionStrategy { - force(HapiFhir.fhirBase) - force(HapiFhir.fhirClient) - force(HapiFhir.fhirCoreConvertors) - - force(HapiFhir.fhirCoreDstu2) - force(HapiFhir.fhirCoreDstu2016) - force(HapiFhir.fhirCoreDstu3) - force(HapiFhir.fhirCoreR4) - force(HapiFhir.fhirCoreR4b) - force(HapiFhir.fhirCoreR5) - force(HapiFhir.fhirCoreUtils) - - force(HapiFhir.structuresDstu2) - force(HapiFhir.structuresDstu3) - force(HapiFhir.structuresR4) - force(HapiFhir.structuresR5) - - force(HapiFhir.validation) - force(HapiFhir.validationDstu3) - force(HapiFhir.validationR4) - force(HapiFhir.validationR5) - } - } - - fun Configuration.forceJacksonVersion() { - resolutionStrategy { - force(Jackson.annotations) - force(Jackson.bom) - force(Jackson.core) - force(Jackson.databind) - force(Jackson.jaxbAnnotations) - force(Jackson.jsr310) - force(Jackson.dataformatXml) - } + fun hapiFhirConstraints(): Map Unit> { + return mutableMapOf Unit>( + guavaModule to { version { strictly(Versions.guava) } }, + HapiFhir.fhirBaseModule to { version { strictly(Versions.hapiFhir) } }, + HapiFhir.fhirClientModule to { version { strictly(Versions.hapiFhir) } }, + HapiFhir.fhirCoreConvertorsModule to { version { strictly(Versions.hapiFhirCore) } }, + HapiFhir.fhirCoreDstu2Module to { version { strictly(Versions.hapiFhirCore) } }, + HapiFhir.fhirCoreDstu2016Module to { version { strictly(Versions.hapiFhirCore) } }, + HapiFhir.fhirCoreDstu3Module to { version { strictly(Versions.hapiFhirCore) } }, + HapiFhir.fhirCoreR4Module to { version { strictly(Versions.hapiFhirCore) } }, + HapiFhir.fhirCoreR4bModule to { version { strictly(Versions.hapiFhirCore) } }, + HapiFhir.fhirCoreR5Module to { version { strictly(Versions.hapiFhirCore) } }, + HapiFhir.fhirCoreUtilsModule to { version { strictly(Versions.hapiFhirCore) } }, + HapiFhir.structuresDstu2Module to { version { strictly(Versions.hapiFhir) } }, + HapiFhir.structuresDstu3Module to { version { strictly(Versions.hapiFhir) } }, + HapiFhir.structuresR4Module to { version { strictly(Versions.hapiFhir) } }, + HapiFhir.structuresR5Module to { version { strictly(Versions.hapiFhir) } }, + HapiFhir.validationModule to { version { strictly(Versions.hapiFhir) } }, + HapiFhir.validationDstu3Module to { version { strictly(Versions.hapiFhir) } }, + HapiFhir.validationR4Module to { version { strictly(Versions.hapiFhir) } }, + HapiFhir.validationR5Module to { version { strictly(Versions.hapiFhir) } }, + Jackson.annotationsBase to { version { strictly(Versions.jackson) } }, + Jackson.bomBase to { version { strictly(Versions.jackson) } }, + Jackson.coreBase to { version { strictly(Versions.jacksonCore) } }, + Jackson.databindBase to { version { strictly(Versions.jackson) } }, + Jackson.jaxbAnnotationsBase to { version { strictly(Versions.jackson) } }, + Jackson.jsr310Base to { version { strictly(Versions.jackson) } }, + Jackson.dataformatXmlBase to { version { strictly(Versions.jackson) } }, + ) } } diff --git a/catalog/build.gradle.kts b/catalog/build.gradle.kts index d137d0a320..e4bb7a4373 100644 --- a/catalog/build.gradle.kts +++ b/catalog/build.gradle.kts @@ -1,5 +1,3 @@ -import Dependencies.forceGuava - plugins { id(Plugins.BuildPlugins.application) id(Plugins.BuildPlugins.kotlinAndroid) @@ -42,8 +40,6 @@ android { kotlin { jvmToolchain(11) } } -configurations { all { forceGuava() } } - dependencies { androidTestImplementation(Dependencies.AndroidxTest.extJunit) androidTestImplementation(Dependencies.Espresso.espressoCore) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 0d2c90c049..7f53725c3e 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,3 +1,5 @@ +import Dependencies.removeIncompatibleDependencies + plugins { id(Plugins.BuildPlugins.androidLib) id(Plugins.BuildPlugins.kotlinAndroid) @@ -17,20 +19,10 @@ android { kotlin { jvmToolchain(11) } } -configurations { - all { - exclude(module = "xpp3") - exclude(module = "hapi-fhir-caching-caffeine") - exclude(group = "com.github.ben-manes.caffeine", module = "caffeine") - - resolutionStrategy { force("com.google.guava:guava:32.1.2-android") } - } -} +configurations { all { removeIncompatibleDependencies() } } dependencies { - // REVERT to DEPENDENCIES LATER - api("ca.uhn.hapi.fhir:hapi-fhir-structures-r4:6.8.0") - api("ca.uhn.hapi.fhir:hapi-fhir-caching-guava:6.8.0") + api(Dependencies.HapiFhir.structuresR4) implementation(Dependencies.fhirUcum) @@ -39,4 +31,10 @@ dependencies { testImplementation(Dependencies.junit) testImplementation(Dependencies.robolectric) testImplementation(Dependencies.truth) + + constraints { + Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> + api(libName, constraints) + } + } } diff --git a/contrib/barcode/build.gradle.kts b/contrib/barcode/build.gradle.kts index 2f847d9456..69790d9f7e 100644 --- a/contrib/barcode/build.gradle.kts +++ b/contrib/barcode/build.gradle.kts @@ -1,4 +1,4 @@ -import Dependencies.forceGuava +import Dependencies.removeIncompatibleDependencies plugins { id(Plugins.BuildPlugins.androidLib) @@ -46,12 +46,7 @@ android { kotlin { jvmToolchain(11) } } -configurations { - all { - exclude(module = "xpp3") - forceGuava() - } -} +configurations { all { removeIncompatibleDependencies() } } dependencies { androidTestImplementation(Dependencies.AndroidxTest.core) diff --git a/datacapture/build.gradle.kts b/datacapture/build.gradle.kts index 6e8dbee0a8..45cbbb30f1 100644 --- a/datacapture/build.gradle.kts +++ b/datacapture/build.gradle.kts @@ -1,6 +1,4 @@ -import Dependencies.forceGuava -import Dependencies.forceHapiVersion -import Dependencies.forceJacksonVersion +import Dependencies.removeIncompatibleDependencies import java.net.URL plugins { @@ -59,9 +57,7 @@ configurations { all { exclude(module = "xpp3") exclude(group = "net.sf.saxon", module = "Saxon-HE") - forceGuava() - forceHapiVersion() - forceJacksonVersion() + removeIncompatibleDependencies() } } @@ -108,6 +104,13 @@ dependencies { testImplementation(Dependencies.mockitoKotlin) testImplementation(Dependencies.robolectric) testImplementation(Dependencies.truth) + + constraints { + Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> + api(libName, constraints) + implementation(libName, constraints) + } + } } tasks.dokkaHtml.configure { diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts index 9e8718df2f..0e53d5f6ba 100644 --- a/demo/build.gradle.kts +++ b/demo/build.gradle.kts @@ -1,5 +1,3 @@ -import Dependencies.forceGuava - plugins { id(Plugins.BuildPlugins.application) id(Plugins.BuildPlugins.kotlinAndroid) @@ -40,8 +38,6 @@ android { kotlin { jvmToolchain(11) } } -configurations { all { forceGuava() } } - dependencies { androidTestImplementation(Dependencies.AndroidxTest.extJunit) androidTestImplementation(Dependencies.Espresso.espressoCore) diff --git a/engine/benchmark/build.gradle.kts b/engine/benchmark/build.gradle.kts index 42c50096c1..4ac37e5d05 100644 --- a/engine/benchmark/build.gradle.kts +++ b/engine/benchmark/build.gradle.kts @@ -1,8 +1,3 @@ -import Dependencies.forceGuava -import Dependencies.forceHapiVersion -import Dependencies.forceJacksonVersion -import Dependencies.removeIncompatibleDependencies - plugins { id(Plugins.BuildPlugins.androidLib) id(Plugins.BuildPlugins.kotlinAndroid) @@ -48,15 +43,6 @@ android { afterEvaluate { configureFirebaseTestLabForMicroBenchmark() } -configurations { - all { - removeIncompatibleDependencies() - forceGuava() - forceHapiVersion() - forceJacksonVersion() - } -} - dependencies { androidTestImplementation(Dependencies.Androidx.workRuntimeKtx) androidTestImplementation(Dependencies.AndroidxTest.benchmarkJunit) diff --git a/engine/build.gradle.kts b/engine/build.gradle.kts index 155f481ddc..0684ce3214 100644 --- a/engine/build.gradle.kts +++ b/engine/build.gradle.kts @@ -1,6 +1,3 @@ -import Dependencies.forceGuava -import Dependencies.forceHapiVersion -import Dependencies.forceJacksonVersion import codegen.GenerateSearchParamsTask import java.net.URL @@ -87,10 +84,8 @@ configurations { exclude(module = "jakarta.activation-api") exclude(module = "javax.activation") exclude(module = "jakarta.xml.bind-api") - - forceGuava() - forceHapiVersion() - forceJacksonVersion() + exclude(module = "hapi-fhir-caching-caffeine") + exclude(group = "com.github.ben-manes.caffeine", module = "caffeine") } } @@ -150,6 +145,13 @@ dependencies { testImplementation(Dependencies.mockWebServer) testImplementation(Dependencies.robolectric) testImplementation(Dependencies.truth) + + constraints { + Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> + api(libName, constraints) + implementation(libName, constraints) + } + } } tasks.dokkaHtml.configure { diff --git a/knowledge/build.gradle.kts b/knowledge/build.gradle.kts index b6a4f541f2..669b1031fb 100644 --- a/knowledge/build.gradle.kts +++ b/knowledge/build.gradle.kts @@ -1,4 +1,4 @@ -import Dependencies.forceGuava +import Dependencies.removeIncompatibleDependencies import java.net.URL plugins { @@ -67,13 +67,7 @@ android { afterEvaluate { configureFirebaseTestLabForLibraries() } -configurations { - all { - exclude(module = "xpp3") - exclude(module = "xpp3_min") - forceGuava() - } -} +configurations { all { removeIncompatibleDependencies() } } dependencies { androidTestImplementation(Dependencies.AndroidxTest.core) @@ -109,6 +103,12 @@ dependencies { testImplementation(Dependencies.mockWebServer) testImplementation(Dependencies.robolectric) testImplementation(Dependencies.truth) + + constraints { + Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> + api(libName, constraints) + } + } } tasks.dokkaHtml.configure { diff --git a/workflow-testing/build.gradle.kts b/workflow-testing/build.gradle.kts index 9d0b9b5842..dadb083443 100644 --- a/workflow-testing/build.gradle.kts +++ b/workflow-testing/build.gradle.kts @@ -1,6 +1,3 @@ -import Dependencies.forceGuava -import Dependencies.forceHapiVersion -import Dependencies.forceJacksonVersion import Dependencies.removeIncompatibleDependencies plugins { @@ -15,14 +12,7 @@ android { kotlin { jvmToolchain(11) } } -configurations { - all { - removeIncompatibleDependencies() - forceGuava() - forceHapiVersion() - forceJacksonVersion() - } -} +configurations { all { removeIncompatibleDependencies() } } dependencies { compileOnly(Dependencies.Cql.evaluator) @@ -30,19 +20,15 @@ dependencies { compileOnly(Dependencies.Cql.evaluatorFhirUtilities) compileOnly(project(":engine")) { exclude(module = "truth") } - // Forces the most recent version of jackson, ignoring what dependencies use. - // Remove these lines when HAPI 6.4 becomes available. - compileOnly(Dependencies.Jackson.annotations) - compileOnly(Dependencies.Jackson.bom) - compileOnly(Dependencies.Jackson.core) - compileOnly(Dependencies.Jackson.databind) - compileOnly(Dependencies.Jackson.dataformatXml) - compileOnly(Dependencies.Jackson.jaxbAnnotations) - compileOnly(Dependencies.Jackson.jsr310) - compileOnly(Dependencies.junit) compileOnly(Dependencies.jsonAssert) compileOnly(Dependencies.woodstox) compileOnly(Dependencies.xmlUnit) compileOnly(Dependencies.truth) + + constraints { + Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> + compileOnly(libName, constraints) + } + } } diff --git a/workflow/benchmark/build.gradle.kts b/workflow/benchmark/build.gradle.kts index 7cb5f95994..258054a8aa 100644 --- a/workflow/benchmark/build.gradle.kts +++ b/workflow/benchmark/build.gradle.kts @@ -1,4 +1,3 @@ -import Dependencies.forceGuava import Dependencies.removeIncompatibleDependencies plugins { @@ -46,12 +45,7 @@ android { afterEvaluate { configureFirebaseTestLabForMicroBenchmark() } -configurations { - all { - removeIncompatibleDependencies() - forceGuava() - } -} +configurations { all { removeIncompatibleDependencies() } } dependencies { androidTestImplementation(Dependencies.AndroidxTest.benchmarkJunit) @@ -74,4 +68,10 @@ dependencies { exclude(group = Dependencies.androidFhirGroup, module = Dependencies.androidFhirKnowledgeModule) } androidTestImplementation(project(":workflow-testing")) + + constraints { + Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> + androidTestImplementation(libName, constraints) + } + } } diff --git a/workflow/build.gradle.kts b/workflow/build.gradle.kts index 5ae54c8cb0..29b40fc2ae 100644 --- a/workflow/build.gradle.kts +++ b/workflow/build.gradle.kts @@ -1,6 +1,3 @@ -import Dependencies.forceGuava -import Dependencies.forceHapiVersion -import Dependencies.forceJacksonVersion import Dependencies.removeIncompatibleDependencies import java.net.URL @@ -76,14 +73,7 @@ android { afterEvaluate { configureFirebaseTestLabForLibraries() } -configurations { - all { - removeIncompatibleDependencies() - forceGuava() - forceHapiVersion() - forceJacksonVersion() - } -} +configurations { all { removeIncompatibleDependencies() } } dependencies { testImplementation(project(mapOf("path" to ":knowledge"))) @@ -125,6 +115,13 @@ dependencies { testImplementation(Dependencies.truth) testImplementation(Dependencies.xmlUnit) testImplementation(project(":workflow-testing")) + + constraints { + Dependencies.hapiFhirConstraints().forEach { (libName, constraints) -> + api(libName, constraints) + implementation(libName, constraints) + } + } } tasks.dokkaHtml.configure { From aa187048e2f4f35b79bc190e3a26f1881bfb5a45 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 2 Jan 2024 13:42:39 -0500 Subject: [PATCH 2/2] Removes unused dependency declarations. --- buildSrc/src/main/kotlin/Dependencies.kt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 4ddae35217..8427272ecc 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,14 +107,6 @@ object Dependencies { const val jaxbAnnotationsBase = "$moduleGroup:jackson-module-jaxb-annotations:${Versions.jackson}" const val jsr310Base = "$datatypeGroup:jackson-datatype-jsr310:${Versions.jackson}" - - const val annotations = "$annotationsBase:${Versions.jackson}" - const val bom = "$bomBase:${Versions.jackson}" - const val core = "$coreBase:${Versions.jacksonCore}" - const val databind = "$databindBase:${Versions.jackson}" - const val dataformatXml = "$dataformatXmlBase:${Versions.jackson}" - const val jaxbAnnotations = "$jaxbAnnotationsBase:${Versions.jackson}" - const val jsr310 = "$jsr310Base:${Versions.jackson}" } object Kotlin {