-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 --show-dependencies option to dump external dependencies #302
Conversation
|
Hi @bhargavg, great stuff! In the example, I would only expect the Vapor dependency and its dependency tree to be shown. AFAI understand the output, you're actually printing the dependency tree of all the leaf dependencies. So I'd only expect this to be output: Or what was the Package.swift of the example above? |
|
Also, I think it would be valuable to print the allowed version range, instead of the resolved version in each dependency. That's so that if there's a version conflict, it'd be obvious which two versions are clashing. Does that make sense? |
|
Would it be too "magic" to hide the URL string if a package is already depended upon by something earlier in the graph? I think this would make it easier to read and see shared dependencies. |
|
@ddunbar I actually wanted to see the full URLs so that I can easily spot conflicting forks of the same project. |
| pkgVersion = version.description | ||
| } else { | ||
| pkgVersion = "unspecified" | ||
| } |
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.
how about small code simplification?
let pkgVersion = package.version?.description ?? "unspecified"
Good catch, I was actually printing all the leaf dependencies, which is wrong. Modified it to start the graph from root external dependencies. Now for the second point you mentioned:
I think, there are few issues with this approach:
IMHO, indicating the version conflicts can be handled differently. When there are unsolvable version requirements, we show an error message as follows: This error doesn't give enough info as to which all dependencies caused the failure. If we can modify the error as follows, I think it will better help user in finding the problematic dependencies: So, I suggest, we modify error reporting code rather than modifying |
406dc94
to
7e05898
Compare
|
@bhargavg Awesome! Yeah you make a good point, better diagnostics in the dependency clashes would probably solve the problem even better. On the other hand, the dependency range is what each package requires, not a specific version. As I see it the dependencies should represent what the packages "want" (version range), not what they "get" (resolved version). |
| import PackageType | ||
| import struct PackageDescription.Version | ||
|
|
||
| final class ShowDependencies { |
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.
Do we need ShowDependencies class here? I think we can make dumpDependenciesOf a free function. It would be nicer to call it. ShowDependencies.dumpDependenciesOf( vs dumpDependenciesOf(
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.
Done
@czechboy0 If i understand you correctly, you are talking about the modified error output I proposed right? Yeah, that error message should have the range or explicit version specified in |
|
@bhargavg I actually meant in the dump dependencies function. That I'd expect the representation of the wanted version range instead of the resolved function. But it's definitely something to discuss, we can change that later. |
|
@czechboy0 I don't think you should be allowed to have two versions of the same package name in a graph, so conflicting forks shouldn't be possible (unless someone renamed it in the fork, which would then show up). I thought we currently enforced this (pretty sure it will fail to build, even if we don't). |
|
Lovely! |
|
If we'd like it to be more readable already (IMO this is fine to merge and we can tweak the usability after we've used it in real world settings), then I'd go with hiding the URLs unless there is a flag specified, same for ranges. But this is a really great addition, thanks. |
|
Will merge unless there are objections. I may change the mode to |
|
@mxcl, the reason why this is not yet merged is, there is no decision made on whether this option should print resolved dependencies -or- the dependent ranges for each dependency as mentioned in their Package.swift Also, @czechboy0 brought up a case when the graph is unresolvable, how best this option helps the user in identifying the conflicting dependencies. |
|
I don't think it is necessary to solve those issues before merging this PR. We will learn better what we need with this base functionality there to guide us. |
|
Cool...!!! Can't wait to see this get merged. |
28380fa
to
4868efd
Compare
Currently only plain text option is supported. But infrastructure is written to support additional formats like Dot and JSON.
4868efd
to
50e5ba1
Compare
|
Huh. I think swift ci only available for me on my PRs? |
|
@swift-ci please test |
|
Seems like CI is not started, @mxcl Could you please start CI on this and merge if no modifications are needed? |
|
@swift-ci Please test |
|
@aciidb0mb3r Can you please try again when you get a chance? Thanks! |
|
@swift-ci please test |
|
@shahmishal tried again, din work |
|
The test failures were unrelated, merging. |
Add support for configuring the build system scheduler
Dump the external dependencies (along with their dependencies) to console.
Sample output for Vapor (v0.7.0):
Only plain text option is supported as of now. Code is extensible to support additional formats like Dot and JSON.
Will add support for other formats in my next PRs.