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

Allow users to customize coursier ResolutionParams #3949

Merged
merged 7 commits into from
Nov 20, 2024

Conversation

alexarchambault
Copy link
Contributor

@alexarchambault alexarchambault commented Nov 12, 2024

This adds a JavaModule#resolutionParams task, allowing users to customize coursier's ResolutionParams. These allow to customize some aspects of dependency resolution.

In particular, ResolutionParams#enableDependencyOverrides, when set to Some(false), disables the recent BOM changes added (and enabled by default) in coursier 2.1.17. This might be useful, if ever users aren't happy with the versions it selects, or want to wait a bit before enabling that, or if they find out performance suffers because of it for them.

The new task is anonymous (it's not a target, it's not serialized on disk), as ResolutionParams has a field that doesn't easily lend itself to serialization (rules, because of the Rule type, which is an open abstract class).

@lihaoyi lihaoyi requested a review from lefou November 13, 2024 00:19
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

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

I think you should move the resolutionParams task into CoursierModule, since that the place where it should be used. This would also avoid the introduction of new resolutionParams parameter which the default parameter in various places.

@lefou
Copy link
Member

lefou commented Nov 13, 2024

The new task should definitely come with some documentation, since some other customizations seem to affect the final ResolutionParams as well. What overrides what?

@alexarchambault
Copy link
Contributor Author

What overrides what?

What do you mean?

@alexarchambault
Copy link
Contributor Author

What do you mean?

Oh, I think I see

@alexarchambault
Copy link
Contributor Author

(seems the CI error is a flake)

Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

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

Looks good to me. I restarted the failed test to see, if it was flakyness.

They can be called in a legit fashion if the newly added non-mandatory
argument isn't passed
@lihaoyi lihaoyi merged commit 0026944 into com-lihaoyi:main Nov 20, 2024
27 checks passed
@alexarchambault alexarchambault deleted the coursier-resolution-params branch November 20, 2024 14:05
@lefou lefou added this to the 0.12.3 milestone Nov 21, 2024
lihaoyi pushed a commit that referenced this pull request Nov 22, 2024
coursier
[`2.1.18`](https://github.com/coursier/coursier/releases/tag/v2.1.18)
takes Maven "BOMs" better into account, which can sometimes
significantly change the versions (or even the dependencies) selected by
coursier (see also the
[`2.1.17`](https://github.com/coursier/coursier/releases/tag/v2.1.17)
release notes).

#3949 offers a way to disable
the new way of processing BOMs, if ever that's needed, with
```scala
def resolutionParams = Task.Anon {
  super.resolutionParams().withEnableDependencyOverrides(Some(false))
}
```

coursier-interface is bumped along the way just in case. Its `1.0.24`
version uses coursier `2.1.18` under-the-hood (in a hidden proguarded
fashion).
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