Skip to content

[Build/Commands] Switch SymbolGraphExtract to use build plan #7863

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

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Aug 7, 2024

Yet another step on the path to remove buildTriple from Resolved{Product, Module}.

Motivation:

Instead of trying to lookup modules in the module graph and then going the build plan for their descriptions, symbol-graph-extract should refer to the build plan directly.

Modifications:

  • Adds a new protocol ModuleBuildDescription to SPMBuildCore
  • Conforms Build.ModuleBuildDescription to SPMCore.ModuleBuildDescription
  • Adds a new field to BuildPlan and its protocol to expose build modules
  • Uses buildModules to implement symbol graph extraction as a replacement for module graph + build plan lookups.

Result:

One less place that replies on buildTriple which brings us closer to its eventual removal.

@xedin
Copy link
Contributor Author

xedin commented Aug 7, 2024

@swift-ci please test

@@ -121,7 +136,7 @@ public enum ModuleBuildDescription {

/// Determines the arguments needed to run `swift-symbolgraph-extract` for
/// this module.
package func symbolGraphExtractArguments() throws -> [String] {
public func symbolGraphExtractArguments() throws -> [String] {
Copy link
Member

Choose a reason for hiding this comment

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

why public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it’s a witness to a public protocol requirement now

@@ -216,6 +216,10 @@ public class BuildPlan: SPMBuildCore.BuildPlan {
AnySequence(self.productMap.values.map { $0 as SPMBuildCore.ProductBuildDescription })
}

public var buildModules: AnySequence<SPMBuildCore.ModuleBuildDescription> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other member uses AnySequence so I used the same for consistency.

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

Overall LGTM, but I second Rauhul's comments, and CI issues need to be resolved.

Yet another step on the path to remove `buildTriple` from `Resolved{Product, Module}`.

Instead of trying to lookup modules in the module graph and then going
the build plan for their descriptions, symbol-graph-extract should refer
to the build plan directly.
@xedin xedin force-pushed the symbol-graph-loves-build-plan branch from b8d848e to 3faf021 Compare August 7, 2024 18:02
@xedin
Copy link
Contributor Author

xedin commented Aug 7, 2024

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Aug 7, 2024

@swift-ci please test Windows platforms

@xedin xedin merged commit 392a2a9 into swiftlang:main Aug 7, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants