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

Fix create symbol graph plugin entrypoint #7629

Closed
wants to merge 1 commit into from

Conversation

rauhul
Copy link
Member

@rauhul rauhul commented Jun 3, 2024

The functionality of createSymbolGraphForPlugin broke when the internal SwiftPM build graph was split into target and host graphs. A client running createSymbolGraphForPlugin on a host target would fail with unspecified("could not find a target named “<Target-Name>”")

This PR fixes the plugin entry point to search for targets in the host build graph if not found in the target graph.

This PR also includes a cosmetic fix for the above error so it renders as Unspecified: Could not find a target named “MMIOMacros”.

The functionality of `createSymbolGraphForPlugin` broke when the
internal SwiftPM build graph was split into target and host graphs. A
client running `createSymbolGraphForPlugin` on a host target would fail
with `unspecified("could not find a target named “<Target-Name>”")`

This PR fixes the plugin entry point to search for targets in the host
build graph if not found in the target graph.

This PR also includes a cosmetic fix for the above error so it renders
as `Unspecified: Could not find a target named “MMIOMacros”.`
@rauhul rauhul force-pushed the swift-symbolgraph-extract-target-selection branch from 73a84d3 to cfe1c75 Compare June 3, 2024 19:29
@rauhul
Copy link
Member Author

rauhul commented Jun 3, 2024

@swift-ci test

1 similar comment
@rauhul
Copy link
Member Author

rauhul commented Jun 3, 2024

@swift-ci test


let buildParameters: BuildParameters = try if destination == .target {
buildSystem.buildPlan.destinationBuildParameters
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation looks off here

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is correct for if expressions. swift-format depending on options can reformat this to:

let buildParameters: BuildParameters =
  try if destination == .target {
    buildSystem.buildPlan.destinationBuildParameters
  } else {
    buildSystem.buildPlan.toolsBuildParameters
  }

// FIXME: dynamic graph
// This should work by requesting a build for a target w/ destination:
// .destination and generating the graph needed on demand instead of
// looking for a preexisting matching target.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should add a func buildsetFor(target: String) throws -> Buildset to BuildSystem protocol which would encapsulate most of the logic here and allow you to select appropriate build parameters based on resulting buildset.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the client should be able to request any module built for the target/destination platform and we should create the graph that does that. Is that what you're suggesting here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, client would pass a name and we'd start with .destination and if that doesn't exist produce a .host if it's appropriate.

xedin added a commit to xedin/swift-package-manager that referenced this pull request Jun 7, 2024
xedin added a commit to xedin/swift-package-manager that referenced this pull request Jun 7, 2024
xedin added a commit that referenced this pull request Jun 7, 2024
@xedin
Copy link
Contributor

xedin commented Jun 10, 2024

Superseded by #7646

@xedin xedin closed this Jun 10, 2024
auto-merge was automatically disabled June 10, 2024 19:52

Pull request was closed

@rauhul rauhul deleted the swift-symbolgraph-extract-target-selection branch June 13, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants