Skip to content

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

/// 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

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
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