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

Tweaks #277

Merged
merged 3 commits into from
Jun 10, 2021
Merged

Tweaks #277

merged 3 commits into from
Jun 10, 2021

Conversation

alexarchambault
Copy link
Contributor

@alexarchambault alexarchambault commented Jun 10, 2021

These are changes that I found useful when embedding metabrowse in a custom application (that uses native-image).

The first commit is required for native-image. It loads sources from JARs using ZipFile, rather than via a URLClassLoader that doesn't work fine from the native image.

The second commit embeds the assets directly in the server JAR, under metabrowse/server/assets/, rather than zipping them, embedding the zip in JAR, and unzipping it in a temporary directory every time upon start-up.

The third commit reverses the dependency between server and cli - the latter isn't needed when embedding metabrowse in a custom app. Thanks to it, depending on metabrowse-server doesn't pull case-app, json4s, etc.

Rather than loading the JARs in a URLClassLoader, then getting the
sources via getResource.

The former works fine in native-image in particular, unlike the latter.
Rather than putting them in a zip, then putting that zip in the JAR.

This allows not to write the assets in a temporary directory upon
startup.
Have cli depends on server, rather than the opposite.
@alexarchambault
Copy link
Contributor Author

alexarchambault commented Jun 10, 2021

It seems we can even just cut the dependency between server and cli

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@alexarchambault alexarchambault merged commit ba7df6a into scalameta:master Jun 10, 2021
@alexarchambault alexarchambault deleted the native-image-tweaks branch June 10, 2021 22:07
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.

2 participants