Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested NPM package support #1149

Merged
merged 9 commits into from
May 2, 2023
Merged

Nested NPM package support #1149

merged 9 commits into from
May 2, 2023

Conversation

c-schuler
Copy link
Contributor

Just seeing if this passes CI build for now. Still needs cleanup and hardening

@c-schuler
Copy link
Contributor Author

Ready for review.

Resolution for #847

@ktarasenko feel free to validate this logic with any testing you have locally

@ktarasenko
Copy link

Thanks, will give it a try!

Copy link

@ktarasenko ktarasenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for cleaning up, looks much better now!

@@ -3,4 +3,6 @@
dependencies {
implementation project(':cql-to-elm')
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.1'
implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.20'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where you are using these dependencies

}

@Override
public void logMessage(String message) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing the logger!

@@ -40,7 +39,7 @@ public Library readLibrary(InputStream stream) throws FHIRFormatError, IOExcepti
VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50());
return (Library) versionConvertor_40_50.convertResource(res);
} else if (VersionUtilities.isR5Ver(version)) {
return (Library) new JsonParser().parse(stream);
return (Library) new org.hl7.fhir.r5.formats.JsonParser().parse(stream);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is it intenional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is needed to avoid org.objectweb.asm.ClassTooLargeException: Class too large: org/hl7/fhir/r5/formats/JsonParser. See this PR for more information on why that is required.

import org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.formats.FormatUtilities;
import ca.uhn.fhir.model.primitive.IdDt;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the difference between this and IdType?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IdDt is not model-specific

private static final Logger logger = LoggerFactory.getLogger(NpmPackageManager.class);
private final ImplementationGuide sourceIg;
private final FilesystemPackageCacheManager fspcm;
private final List<NpmPackage> npmList;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be initialized here


try {
// userMode indicates whether the packageCache is within the working directory or in the user home
fspcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I ask you to go an extra mile and add a way to inject FilesystemPackageCacheManager (but keep the existing manager as the default) ?
This will solve two problems:

  • allow to provide a fake package manager to have better tests (like the test that verifies that dependencies were actually loaded, similar to what i did here )
  • use the same class with more android friendly version FilesystemPackageCacheManager

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in latest commit

Copy link
Member

@brynrhodes brynrhodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, builds locally, tests pass. Also verified CQF Tooling still builds and tests pass correctly with this snapshot build

@JPercival JPercival merged commit 0b2e13e into master May 2, 2023
1 check passed
@JPercival JPercival deleted the 847-npm-nested-deps branch May 2, 2023 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants