-
-
Notifications
You must be signed in to change notification settings - Fork 632
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
Add documentation for coursier usage #5382
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good to me, a part from one bit of duplication.
'-A', 'jar,bundle,test-jar,maven-plugin,src,doc,aar' | ||
] | ||
|
||
[cache.resolve.coursier] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you've got cach.resolve.coursier in here twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah thanks. corrected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that we're exposing all of coursier's options right out of the box, as that seems likely to get us in the same situation we were in with ivy, where if someone had a custom config, it was very difficult to validate that it didn't break certain rules like the ivy_cache_dir location.
If it wouldn't be too restrictive, would consider starting with something like a --maven-resolvers
list option, and then expanding the options we expose as we go. Maybe with an escape hatch for "--extra-coursier-options
", or something.
[resolve.coursier] | ||
# jvm option in case of large resolves | ||
jvm_options: ['-Xmx4g', '-XX:MaxMetaspaceSize=256m'] | ||
# The opposite of resolve.ivy.soft_excludes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we have #4437 outstanding, is it too late to make soft_excludes the default for coursier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I made the default behavior consistent with ivy in oss 35e711f#diff-0b873245a3a9ee84a1f817502a221652R52
If you think we are not crossing release boundary yet (not sure if 1.4.0rc0 counts), I can just put a patch to flip the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be happy to cherry pick that in.
'-r', 'https://repo1.maven.org/maven2/', | ||
'-r', 'https://dl.google.com/dl/android/maven2/', | ||
|
||
# Quiet mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the output consumed by the workunit? Is quiet required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be consumed by the workunit, but it's good to turn on sometimes to visualize the resolve on pants server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is consumed by workunit. but sometimes printing into workunit and viewing from pants server helps debugging.
# Do not use default public maven repo. | ||
'--no-default', | ||
|
||
# Concurrent workers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like something pants should set by inspecting available cores (or just letting coursier do that... presumably this value has a default?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filed #5384
# Concurrent workers | ||
'-n', '10', | ||
|
||
# Specify the type of artifacts to fetch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto... this feels like something that the task should set.
@@ -211,6 +211,57 @@ Toolchain | |||
Pants uses [Ivy](http://ant.apache.org/ivy/) to resolve `jar` dependencies. To change how Pants | |||
resolves these, configure `resolve.ivy`. | |||
|
|||
Starting release `1.4.0.dev26`, Pants added an option to pick [coursier](https://github.com/coursier/coursier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: s/Starting release/At release/
|
||
fetch_options: [ | ||
# Specify maven repos | ||
'-r', 'https://repo1.maven.org/maven2/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there examples for custom repo URL formats using placeholders? The equivalent of this in an ivysettings:
<url name="foo.bar">
<artifact pattern="https://foo.com/bar/[organisation]/[artifact]/[revision]/[artifact]-[revision].[ext]" />
</url>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, I just tried to emulate that with this:
'-r', 'ivy:https://foo.com/bar/[organisation]/[artifact]/[revision]/[artifact]-[revision].[ext]'
But unfortunately it replaces the [artifact]
placeholder with the string "ivy", instead of with the name of my artifact. So maybe ivy emulation is broken?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out that [artifact] should be replaced with [module]. So this is an example of the kind of thing that should go into a "how to migrate from ivy" tutorial!!
Update: it's actually a bit more complicated than that - module and artifact are two distinct ivy concepts, both of which appear to map to maven "artifact", at least for the purpose of placeholder substitution. Not sure why Coursier would decide that artifact should be "ivy", maybe because it's looking for "ivy.xml"...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But unfortunately it replaces the [artifact] placeholder with the string "ivy", instead of with the name of my artifact. So maybe ivy emulation is broken?
if you suspect resolving against ivy repo is broken, please file a ticket at https://github.com/coursier/coursier with a minimal repro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh but there are still other issues. For example, it appears to insist on the presence of an ivy.xml file, which Ivy itself does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, the behavior is weird. It assumes that your pattern ends with /[artifact].[ext]
so that it can substitute artifact=ivy, ext=xml and fetch an ivy.xml. But if your pattern doesn't end with those, it'll still do the substitution and try to fetch the file . So, e.g., if your pattern ends with /[module].jar
it'll fetch the jar and then try to parse it as XML...
Ivy deals with this by having two separate patterns in the settings - one for the artifacts and one for the ivy.xml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow_global_excludes: False | ||
|
||
[cache.resolve.coursier] | ||
# In order to enable remote caching, need to relativize the classpath entries serialized. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show how to turn off remote caching but leave local caching? Is that even possible on a cache-by-cache basis? I don't remember any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjyw : Yea, it's possible.
but...
@wisechengyi : Is this code even writing to the cache? If not, these settings shouldn't be relevant. If it is, you should probably just disable cache writing for now?
I honestly think that invalidation (without caching) might be sufficient for coursier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that --cache-ignore
would even skip fingerprinting which coursier resolve needs, so if there is a way to still do fingerprinting but disabling cache checking, that'll be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline: if the code doesn't write to the cache, then these settings don't matter.
And I think that we should almost certainly do our first caching of coursier via #4397, rather than via the v1 Task caching.
fetch_options: [ | ||
# Specify maven repos | ||
'-r', 'https://repo1.maven.org/maven2/', | ||
'-r', 'https://dl.google.com/dl/android/maven2/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this with with local filesystem repos? If so, an example would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Stu that maybe we don't need to expose all coursier options? At least not in the documentation. People can always go read the coursier docs for those.
But what's still missing for me is a "here's how to migrate from ivy" tutorial. Specifically, how to convert your ivysettings.xml to coursier options.
Is there an equivalent of an ivy report for coursier? Its error messages are not very helpful, in general. E.g.,
|
I'd love to switch to Coursier, because Ivy is so painful and over-engineered and complex. But so far Coursier seems to be not great at dealing with anything other than "download from a standard Maven-style repo"... |
BTW while banging on Coursier I noticed a minor issue around workunits in the resolve task. Filed an issue. |
Thanks @baroquebobcat @stuhood @benjyw. Let me summarize and see if there's anything missing.
|
Yea, sounds about right. Thanks.
I think that this boils down to either describing or scripting conversion of the most commonly configured bits of ivy: basically, resolvers.
Yea. Some equivalent of |
Closed in favor of #5675 |
Address points from #5382 * Extract the following coursier options and assign sensible defaults * artifact types * cache dir * fetch options * repos * Add `--report` flag to show coursier output * Add documentation
No description provided.