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

snapshot creates a minimal registry.dat from elm.json without network access #54

Merged
merged 8 commits into from
Sep 23, 2024

Conversation

bmillwood
Copy link
Contributor

I wrote that feature request assuming that the registry.dat file contains some metadata that elm.json doesn't have, but that turns out not to be true, so we don't even need to reach out to the package server at all: we can write registry.dat purely from elm.json. This code does that. We could probably simplify fetchElmDeps using this to just generate registry.dat at build time instead of taking it as an input, but I'll wait to see whether you have any opinions on this first.

Rather than reading the package list from the internet, this running
mode just takes elm.json as correct and writes only those packages to
registry.dat. This produces a much smaller file which is more amenable
for being included in distributions, and more importantly can run inside
network sandboxes, since it just needs the elm.json file.
@bmillwood
Copy link
Contributor Author

I also didn't update the readme in this PR; again I'll do that once I know if these changes will be accepted :)

@domenkozar
Copy link
Member

I'd just make this behavior by default and build it when we need it that's great!

@bmillwood
Copy link
Contributor Author

Do you want to keep the downloading behaviour as an option, or shall I just replace it with the new behaviour?

@domenkozar
Copy link
Member

domenkozar commented Sep 22, 2024 via email

The new one from parsing elm.json should be sufficient.

Also, add the ability to customise the paths for elm.json and
registry.dat. Inspired by me trying to test using `cabal run`, and not
knowing how to do that outside the repo working directory (where my
elm.json is).
@bmillwood bmillwood changed the title snapshot --from-elm-json can create a minimal registry.dat without network access snapshot creates a minimal registry.dat from elm.json without network access Sep 22, 2024
@domenkozar
Copy link
Member

@bmillwood I'm fine bumping stack/cabal to GHC 9.6 and dropping support for older GHCs, I don't expect this to be used as a library.

@domenkozar domenkozar merged commit 5c3fbd2 into cachix:master Sep 23, 2024
1 check passed
@bmillwood
Copy link
Contributor Author

@bmillwood I'm fine bumping stack/cabal to GHC 9.6 and dropping support for older GHCs, I don't expect this to be used as a library.

ah, I was about to ask :)

well, it works now, so I won't do that here, but doing that would have the nice side-effect of no longer needing CPP at all

@bmillwood bmillwood deleted the filtered-snapshot branch September 23, 2024 13:30
@bmillwood bmillwood restored the filtered-snapshot branch September 23, 2024 13:30
@bmillwood bmillwood deleted the filtered-snapshot branch September 23, 2024 13:30
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.

feature request: filter registry.dat to only relevant libraries
2 participants