-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Build/PackageGraph] Sink fallback logic for macro/plugin/test products and packages identification into ModulesGraph
#7646
Conversation
…ts and packages identification into `ModulesGraph` This is a temporary fix until we can figure out a proper way to handle situations were all we get is a name of a product or a target. Resolves: rdar://129400066
@swift-ci please test |
// a macro, plugin, or a test. Ideally we'd ask a build system for a`BuildSubset` | ||
// and get the destination from there but there are other places that need | ||
// refactoring in that way as well. | ||
let buildParameters = if target.buildTriple == .tools { |
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.
@rauhul FYI, I also fixed problem in symbol graph creation.
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.
Thank you!
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.
Feel free to close #7629 when this merges!
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.
Will do!
…t builds Supersedes swiftlang#7629
@swift-ci please test |
@swift-ci please test Windows platform |
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.
IIUC this can be covered in BuildPlanTests
, or in SwiftCommandStateTests
otherwise?
Yeah, I need to figure out where to put the tests for this… |
@MaxDesiatov I added tests to cross-compilation suite and build operation. While doing that I had an idea:
WDYT? |
@swift-ci please test |
SGTM |
@xedin would you be able to confirm that this issue is fixed in this PR? rdar://129400066 |
@MaxDesiatov Indeed it does! |
…stination:)` behavior
🤦 forgot to stage |
@swift-ci please test |
@MaxDesiatov I'll follow-up with optional |
@swift-ci please test Windows platform |
…`Modu… (#7668) …lesGraph.{product, target}(...)` to use optional destination - Explanation: Follow-up to #7646 This is mostly NFC change. It makes more sense to default `destination` to "undefined" when applicable because it's not always possible to know intended destination based on user input. This kind of design makes more sense for internal APIs, instead of having users to pass `.destination` even though it might not be always correct. - Main Branch PRs: #7650 - Risk: Very Low - Reviewed By: @MaxDesiatov - Testing: Existing test-cases were modified and new tests were added.
This is a temporary fix until we can figure out a proper way to
handle situations were all we get is a name of a product or a
target.
Motivation:
Callers or
ModulesGraph.{product, target}(for:destination:)
cannot always know the rightdestination
to use at the moment because i.e. for test products and targets its contextual. We need a proper fix for this at the level or BuildSystem but for now sinking the logic down intoModulesGraph
is the safest option.Modifications:
ModulesGraph.{product, target}(for:destination:)
can handle fallback if product/target turn out to be a macro, a plugin or a test.Result:
--target
and--product
options should work correctly regardless of underlying product/target kind.Resolves: rdar://129400066