Add debugging code

This commit is contained in:
Grahame Grieve 2019-12-05 16:59:09 +11:00
parent ea06dacda7
commit f008d6050f
1 changed files with 30 additions and 7 deletions

View File

@ -157,6 +157,10 @@ public class NpmPackage {
} }
public String dump() {
return name + " ("+ (folder == null ? "null" : folder.toString())+") | "+Boolean.toString(index != null)+" | "+content.size()+" | "+types.size();
}
} }
private String path; private String path;
@ -484,6 +488,7 @@ public class NpmPackage {
if (npm.has("fhirVersions")) { if (npm.has("fhirVersions")) {
return npm.getAsJsonArray("fhirVersions").get(0).getAsString(); return npm.getAsJsonArray("fhirVersions").get(0).getAsString();
} }
if (dep != null) {
// legacy simplifier support: // legacy simplifier support:
if (dep.has("simplifier.core.r4")) if (dep.has("simplifier.core.r4"))
return "4.0"; return "4.0";
@ -491,6 +496,7 @@ public class NpmPackage {
return "3.0"; return "3.0";
if (dep.has("simplifier.core.r2")) if (dep.has("simplifier.core.r2"))
return "2.0"; return "2.0";
}
throw new FHIRException("no core dependency or FHIR Version found in the Package definition"); throw new FHIRException("no core dependency or FHIR Version found in the Package definition");
} }
} }
@ -731,5 +737,22 @@ public class NpmPackage {
// FileUtils.copyDirectory(new File(path), new File(dir)); // FileUtils.copyDirectory(new File(path), new File(dir));
} }
} }
public void debugDump(String purpose) {
System.out.println("Debug Dump of Package for '"+purpose+"'. Path = "+path);
System.out.println(" npm = "+name()+"#"+version()+", canonical = "+canonical());
System.out.println(" folders = "+folders.size());
for (String s : sorted(folders.keySet())) {
NpmPackageFolder folder = folders.get(s);
System.out.println(" "+folder.dump());
}
}
private List<String> sorted(Set<String> keys) {
List<String> res = new ArrayList<String>();
res.addAll(keys);
Collections.sort(res);
return res ;
}
} }