Stream: ibm
Topic: Packaging for utility jars
Lee Surprenant (Jan 13 2020 at 21:15):
For 4.0.1 we created the following epic for packaging our various utilities with the fhir server distribution: https://github.com/IBM/FHIR/issues/575
Lee Surprenant (Jan 13 2020 at 21:16):
now we are getting into the meat of it and we're wondering how to package them
Lee Surprenant (Jan 13 2020 at 21:17):
For fhir-persistence-schema, Paul created a shaded jar that has a final name which omits the version:
pasted image
Lee Surprenant (Jan 13 2020 at 21:18):
conversely, I used the shade plugin's default and ended up replacing the versioned jar with the single executable jar:
pasted image
Lee Surprenant (Jan 13 2020 at 21:19):
do we want to generate both shaded and non-shaded jars for these 2 module? do we want the version included in the final executable jar's name (the jar that gets packaged with the distribution)?
Lee Surprenant (Jan 13 2020 at 21:20):
for fhir-validator, it gets even more interesting, because we probably DO want both the "normal" and "uber-jar" variants for that one
Paul Bastide (Jan 13 2020 at 21:24):
rough size differences are 72K to 16M for fhir-persistence-schema
Paul Bastide (Jan 13 2020 at 21:25):
the good news in the case of persistence-schema it's bound closely to the model.
Lee Surprenant (Jan 13 2020 at 21:31):
I think my slight preference is to generate ONLY the uber jar for persistence-schema and swagger-generator, since I don't know of any re-use scenarios for those outside of just executing them
Lee Surprenant (Jan 13 2020 at 21:32):
but i couldn't really figure out how to make the shade plugin do that (in my case it just moved the 'normal' jar to original-*.jar
Paul Bastide (Jan 13 2020 at 21:32):
I'm +1 on that plan
Lee Surprenant (Jan 13 2020 at 21:32):
but i think ONLY the shaded jar gets 'attached' as the output
Lee Surprenant (Jan 13 2020 at 21:32):
so thats the only one that would end up in the maven repo
Lee Surprenant (Jan 13 2020 at 21:32):
i think
Paul Bastide (Jan 13 2020 at 21:33):
they can all end up there
Lee Surprenant (Jan 13 2020 at 21:33):
Do you have opinion on the second part; should the packaged executable jar have a version postfix or no?
Lee Surprenant (Jan 13 2020 at 21:45):
Ugh, the fhir-swagger-generator actually pulls in all of fhir-examples too, because I updated it to include examples in the generated api definitions
Lee Surprenant (Jan 13 2020 at 21:45):
so that one comes in around 65 MB
Lee Surprenant (Jan 13 2020 at 21:46):
which means the combined weight of these three utilities will increase our distribution by like 100 MB
Paul Bastide (Jan 13 2020 at 22:00):
@Lee Surprenant we can add an exclusion on that to the shadeplugin
Paul Bastide (Jan 13 2020 at 22:00):
it'll cut the size down
Lee Surprenant (Jan 13 2020 at 22:01):
the problem is its actually used during generation
Lee Surprenant (Jan 13 2020 at 22:01):
its a legit dependency of the plugin
Lee Surprenant (Jan 13 2020 at 22:01):
we don't use ALL of the examples
Lee Surprenant (Jan 13 2020 at 22:01):
but we do use some subset of them
Paul Bastide (Jan 13 2020 at 22:01):
hum... I think we can use a transformer and strip it out
Paul Bastide (Jan 13 2020 at 22:01):
tell me what you want, and I think I can remove the others
Lee Surprenant (Jan 13 2020 at 22:02):
at some future time, i was thinking of letting the user specify which examples they want
Lee Surprenant (Jan 13 2020 at 22:02):
e.g. spec examples, minimal examples, or mock examples
Paul Bastide (Jan 13 2020 at 22:03):
Excluding Resources with the DontIncludeResourceTransformer
Lee Surprenant (Jan 13 2020 at 22:03):
we NEVER want the complete-absent ones though
Paul Bastide (Jan 13 2020 at 22:03):
Paul Bastide (Jan 13 2020 at 22:03):
we can use that
Lee Surprenant (Jan 13 2020 at 22:03):
cool
Lee Surprenant (Jan 13 2020 at 22:04):
today, the only ones we use are the ones at /json/ibm/complete-mock
Lee Surprenant (Jan 13 2020 at 22:04):
and of those, only the ones with a postfix of -1
Lee Surprenant (Jan 13 2020 at 22:04):
e.g. /json/ibm/complete-mock/Patient-1.json
Lee Surprenant (Jan 13 2020 at 22:05):
btw i asked google about the version vs non-version jar and read through the answers at https://stackoverflow.com/questions/16482102/when-should-a-jar-file-name-have-a-version-number-in-it-what-are-the-pros-and-c
Lee Surprenant (Jan 13 2020 at 22:05):
so now i'm thinking of including the versions (which is also the maven and shade default)
Lee Surprenant (Jan 13 2020 at 22:08):
resulting structure will be
pasted image
Lee Surprenant (Jan 13 2020 at 22:09):
although I always wondered if we could flatten it a bit more
Lee Surprenant (Jan 13 2020 at 22:10):
@John Timm any idea why we include the fhir
and server
directories in this distribution zip?
Lee Surprenant (Jan 13 2020 at 22:10):
seems like the two directories under server
could just be added directly under fhir-server-dist
Lee Surprenant (Jan 13 2020 at 22:15):
or perhaps just replacing fhir/server
with some other name like installFiles
would help make it clearer that these are artifacts that are used by the install scripts to install the server within a new directory
John Timm (Jan 14 2020 at 14:57):
@Lee Surprenant I'm not sure why it is nested like that. That layout hasn't changed in quite a while.
Lee Surprenant (Jan 15 2020 at 13:20):
after a few different iterations, we ended up creating a "shaded" version of both fhir-swagger-generator and fhir-persistence-schema. to make their purpose more clear, I attached a classifier of "cli" to the all-in-one executable flavor of these jars. I also updated their READMEs. The PR was https://github.com/IBM/FHIR/pull/587
Last updated: Apr 12 2022 at 19:14 UTC