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

Alias withLatestSnapshots to withCachedSnapshots #425

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

mdedetrich
Copy link
Contributor

The main reason behind this change is the current naming isn't really clear (even as a native english speaker) and its already caused confusion (see apache/pekko-connectors#239 (comment) as an example).

The suggested name change at least in my view makes a lot more clear whats going on, i.e. sbt will cache snapshots versions so they don't re-resolve. I am not too fussed about this name specifically, there are others as well i.e.

  • withAlwaysRefreshSnasphots
  • withAlwaysCheckSnasphots

If this PR gets merged I will also update the core sbt build/documentation to reflect this

@mdedetrich mdedetrich force-pushed the alias-with-latest-snapshots-to-with-cached-snapshots branch from 8f0a35c to c959cdf Compare September 1, 2023 13:57
@mdedetrich mdedetrich force-pushed the alias-with-latest-snapshots-to-with-cached-snapshots branch from c959cdf to 1162c57 Compare September 10, 2023 23:05
@mdedetrich mdedetrich force-pushed the alias-with-latest-snapshots-to-with-cached-snapshots branch from 1162c57 to 712a5b9 Compare September 10, 2023 23:18
@mdedetrich
Copy link
Contributor Author

I have just updated the PR so that it compiles properly (there were some basic issues beforehand).

One thing to note is that I did not reliaze that we serialize UpdateOptions to JSON. The PR handles this so that we don't have regressions however I left a note indicating that we might be able to remove the workarounds in sbt 2.x.x (i.e. if sbt 2.x.x happens to serliaize this data in another folder, not sure if this is the case or not).

@eed3si9n
Copy link
Member

It's not the opposite of withCachedSnapshots, but rather it's the opposite of withFirstSnapshotFound.

According to the release note section that likely I wrote in https://github.com/sbt/sbt/releases/tag/v0.13.6

sbt 0.13.6 adds a new setting key called updateOptions for customizing the details of managed dependency resolution with update task. One of its flags is called lastestSnapshots, which controls the behavior of the chained resolver. Up until 0.13.6, sbt was picking the first -SNAPSHOT revision it found along the chain. When latestSnapshots is enabled (default: true), it will look into all resolvers on the chain, and compare them using the publish date.

The tradeoff is probably a longer resolution time if you have many remote repositories on the build or you live away from the severs. So here's how to disable it:

updateOptions := updateOptions.value.withLatestSnapshots(false)

Also I think this only works for Ivy.

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