From 3b2ce3e4bbec58307980e4fbd40ebec8e75c920d Mon Sep 17 00:00:00 2001 From: Brian Kaney Date: Fri, 17 Jan 2025 15:29:15 -0500 Subject: [PATCH] Hacky POC of fixing FHIR package transitive dependency problem This was a problem discovered when trying to refer to dependant CQL libraries in external FHIR packages. The npm list was not including transitive dependencies. --- .../hl7/fhir/igtools/publisher/Publisher.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/Publisher.java b/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/Publisher.java index fee9022c..7047b1dc 100644 --- a/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/Publisher.java +++ b/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/Publisher.java @@ -4239,8 +4239,23 @@ private void loadIg(String name, String packageId, String igver, String uri, int private void loadIGPackage(String name, String canonical, String packageId, String igver, NpmPackage pi, boolean loadDeps) throws IOException { - if (pi != null) + if (pi != null) { npmList.add(pi); + if (loadDeps) { + for (String dep : pi.dependencies()) { + if (!context.hasPackage(dep)) { + String fdep = fixPackageReference(dep); + String coreVersion = VersionUtilities.getVersionForPackage(fdep); + if (coreVersion != null) { + log("Ignore Dependency on Core FHIR " + fdep + ", from package '" + pi.name() + "#" + pi.version() + "'"); + } else { + NpmPackage dpi = pcm.loadPackage(fdep); + npmList.add(dpi); + } + } + } + } + } logDebugMessage(LogCategory.INIT, "Load "+name+" ("+canonical+") from "+packageId+"#"+igver);