Skip to content

Commit

Permalink
Swap up dependency loading code
Browse files Browse the repository at this point in the history
  • Loading branch information
JPercival committed May 17, 2024
1 parent fc3c1d8 commit 4c9e916
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ private void loadCorePackage() {
}

private void loadIg(ImplementationGuide.ImplementationGuideDependsOnComponent dep, int index) throws IOException {
logger.info("Loading IG Dependency {}#{}", dep.getUri(), dep.getVersion());
String name = dep.getId();
if (!dep.hasId()) {
logger.info("Dependency '{}' has no id, so can't be referred to in markdown in the IG", idForDep(dep));
logger.warn("Dependency '{}' has no id, so can't be referred to in markdown in the IG", idForDep(dep));
name = "u" + Utilities.makeUuidLC().replace("-", "");
}
if (!isValidIGToken(name)) {
Expand All @@ -155,10 +156,9 @@ private void loadIg(ImplementationGuide.ImplementationGuideDependsOnComponent de
throw new IllegalArgumentException(
"You must specify a version for the IG " + packageId + " (" + canonical + ")");

NpmPackage pi = packageId == null ? null : pcm.loadPackageFromCacheOnly(packageId, igver);
if (pi != null)
npmList.add(pi);
NpmPackage pi = pcm.loadPackage(packageId, igver);
if (pi == null) {
logger.warn("Dependency " + name + " (" + canonical + ") not found by FilesystemPackageCacheManager");
pi = resolveDependency(canonical, packageId, igver);
if (pi == null) {
if (Utilities.noString(packageId))
Expand All @@ -169,6 +169,8 @@ private void loadIg(ImplementationGuide.ImplementationGuideDependsOnComponent de
}
}

npmList.add(pi);

logger.debug(
"Load " + name + " (" + canonical + ") from " + packageId + "#" + igver);

Expand Down

0 comments on commit 4c9e916

Please sign in to comment.