Skip to content

[BuildPlan] Add a way to traverse the graph and compute destinations for all modules #7868

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 2 commits into from
Aug 9, 2024

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Aug 8, 2024

Motivation:

This is going to be used by sourcekit-lsp to build a graph/dictionary
of all the targets and depths they appear during package loading and
replaces the need for topological sort and buildTriple.

Modifications:

  • Introduces a new depthFirstSearch variant which traverses all of the nodes in the graph.
  • Adds a new method to BuildPlan - traverseModules which goes over the graph, computes destinations and returns modules with their parents and depths they appear at (the method looks though products).

Result:

This make it possible to switch sourcekit-lsp away from using topological sort and relying on buildTriple.

Paired with swiftlang/sourcekit-lsp#1621

@xedin
Copy link
Contributor Author

xedin commented Aug 8, 2024

swiftlang/sourcekit-lsp#1621
@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Aug 8, 2024

swiftlang/sourcekit-lsp#1621
@swift-ci please test macOS platform

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Aug 9, 2024

swiftlang/sourcekit-lsp#1621
@swift-ci please test macOS platform

@xedin xedin force-pushed the build-plan-traverse-modules branch from ed2e021 to e3b64f9 Compare August 9, 2024 05:03
@xedin
Copy link
Contributor Author

xedin commented Aug 9, 2024

swiftlang/sourcekit-lsp#1621
@swift-ci please test macOS platform

@xedin
Copy link
Contributor Author

xedin commented Aug 9, 2024

swiftlang/sourcekit-lsp#1621
@swift-ci please test Linux platform

@xedin
Copy link
Contributor Author

xedin commented Aug 9, 2024

swiftlang/sourcekit-lsp#1621
@swift-ci please test Windows platform

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Aug 9, 2024

swiftlang/sourcekit-lsp#1621
@swift-ci please test Windows platform

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.

LGTM, only coding style, typo, and test organization nits.

xedin added 2 commits August 9, 2024 11:09
…for all modules

This is going to be used by sourcekit-lsp to build a graph/dictionary
of all the targets and depths they appear during package loading and
replaces the need for topological sort and `buildTriple`.
@xedin xedin force-pushed the build-plan-traverse-modules branch from e3b64f9 to 1b352ac Compare August 9, 2024 18:48
@xedin
Copy link
Contributor Author

xedin commented Aug 9, 2024

swiftlang/sourcekit-lsp#1621
@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Aug 9, 2024

swiftlang/sourcekit-lsp#1621
@swift-ci please test Windows platform

@xedin xedin merged commit 74f06f8 into swiftlang:main Aug 9, 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.

2 participants