-
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
improve and simplify validation of target based dependencies #3280
Conversation
@swift-ci please smoke test |
macOS CI broken due to swift-driver cc @artemcm |
@@ -1255,4 +1263,551 @@ class PackageGraphTests: XCTestCase { | |||
let store = try PinsStore(pinsFile: AbsolutePath("/pins"), fileSystem: fs) | |||
XCTAssertThrows(StringError("duplicated entry for package \"Yams\""), { try store.restore(from: json) }) | |||
} | |||
|
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.
@neonichu @abertelrud would love to get your review on the different permutations captured in these new tests 😅 and hear your opinion on:
- the diagnostics make sense and are better than before, I think they are!
- the backward compatibility 5.2 < 5.4 looks reasonable - we allow users to use dependency::name but no longer encourage it
- do we need to capture more permutations?
@swift-ci please smoke test macOS |
DiagnosticsEngineTester(diagnostics, ignoreNotes: true) { result in | ||
result.check( | ||
diagnostic: """ | ||
product 'Unknown' not found. it is required by package 'Foo' target 'Foo'. |
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.
Not specific to this test, but does this kind of message now become ambiguous? It feels like conceptually we could now be referring to Package.name
or to the last path component of the URL since we are treating them equally, even when they differ. I wonder if for remote packages, we should instead emit the URL here.
In terms of test coverage, I think we should also cover cases where there are multiple conflicting options:
I think none of these care covered, yet, but I may have missed something. There are a lot of tests which is great 👍 |
motivation: SwiftPM 5.2 introduced target based dependencies which added complexity at code level and to users, this PR tries to both simplify the "rules" and the code changes: * allow target dependency in the form of ".product(name:, package:)" where package parameter is the last segment of the dependecy URL, which is the most intuitive choice * change validation code to encourage the above from instead of encouraging adding "name" attibute to the dependency decleration, as we want to get away from adding this attribute in the long run * add several tests that capture the numerous permutations we are coding for
a7f7ced
to
58dbc24
Compare
@swift-ci please smoke test |
motivation: SwiftPM 5.2 introduced target based dependencies which added complexity at code level and to users, this PR tries to both simplify the "rules" and the code
changes:
rdar://65048461