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

Download test repos via coursier #4066

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexarchambault
Copy link
Contributor

So that the repo archives are cached, and the tasks that use them work offline.

That's useful to build the website while being offline, for example.

So that the repo archives are cached, and the tasks that use
them work offline
val cache = FileCache()
// Uncomment when rebootstrapping Mill, to get better logging
// .withLogger(mill.util.CoursierSupport.millLogger())
val file = cache.file(Artifact(s"https://github.com/$label/archive/$commit.zip"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Noob question: I just can create a file cache and download a arbitrary file?
Where is this then cached and what is its cache key? I assume the key is the URL?

Because this seems very useful in general. I have a 'manual' cache so far.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is using the cache of coursier, which downloads dependencies in Mill (JVM ones at least). The exact cache location depends on the OS.

That doesn't support query strings, and if the artifact might change, one should call withChanging(true) on the Artifact created in the code above (then if the last check is older than a TTL, coursier will check if the file changed).

@lihaoyi
Copy link
Member

lihaoyi commented Dec 3, 2024

I think this should be part of a broader discussion in #3930. Should Coursier be the recommended way to download-and-cache stable URLs? All stable URLs or only some stable URLs? What are the considerations and alternatives here?

Obviously this PR works for this specific scenario and does what it says on the box, but we really should have a more rigorous analysis of what the options are, and if this is the recommended option then it should not be used just here but instead also makes its way into the user-facing documentation

@alexarchambault
Copy link
Contributor Author

@lihaoyi Sure

I think this should be part of a broader discussion in #3930. Should Coursier be the recommended way to download-and-cache stable URLs? All stable URLs or only some stable URLs? What are the considerations and alternatives here?

I didn't think much about alternatives, but I don't think there are that many out there 🤔 As discussed in #3930, other ecosystems tend to have caches quite tied to their ecosystem. The cache of coursier is much more generic OTOH. AFAIK, only the Nix cache offers similar features.

@alexarchambault
Copy link
Contributor Author

Letting you decide if you'd rather merge this or not, while things are being discussed in #3930

@lihaoyi
Copy link
Member

lihaoyi commented Dec 4, 2024

as I mentioned in #3930, let's hold off on this for the moment and come back after general support in Mill is in place

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.

3 participants