Skip to content

Use the new SwiftPM API to load the build plan #1973

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 3 commits into from
Feb 18, 2025

Conversation

bnbarham
Copy link
Contributor

@bnbarham bnbarham commented Feb 8, 2025

We previously skipped building/running tool plugins here, which meant that the compiler arguments for a target also missed any generated sources. Use the new BuildDescription.load API from SwiftPM to address this.

Fixes #665
Resolves rdar://102242345.
Resolves rdar://144557689.

@bnbarham bnbarham requested a review from ahoppen as a code owner February 8, 2025 04:14
@bnbarham bnbarham force-pushed the generated-source-should-work branch from 3e7ca95 to 0c4c75c Compare February 8, 2025 04:15
@bnbarham
Copy link
Contributor Author

bnbarham commented Feb 8, 2025

@bnbarham
Copy link
Contributor Author

bnbarham commented Feb 8, 2025

Will need to update this to only build plugins when background indexing is enabled so that we don’t conflict with the regular build directory.

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Nice 😍

@bnbarham
Copy link
Contributor Author

@bnbarham
Copy link
Contributor Author

swiftlang/swift-package-manager#8286

@swift-ci please test Windows platform

@bnbarham bnbarham force-pushed the generated-source-should-work branch from 95e49b5 to 54a1e02 Compare February 11, 2025 21:29
@bnbarham
Copy link
Contributor Author

@bnbarham
Copy link
Contributor Author

swiftlang/swift-package-manager#8286

@swift-ci please test Windows platform

@bnbarham bnbarham force-pushed the generated-source-should-work branch 2 times, most recently from 61b34fb to d762363 Compare February 12, 2025 05:02
@bnbarham
Copy link
Contributor Author

@bnbarham
Copy link
Contributor Author

swiftlang/swift-package-manager#8286

@swift-ci please test Windows platform

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thanks. Looks good to me

@bnbarham bnbarham force-pushed the generated-source-should-work branch from d762363 to f142b5c Compare February 12, 2025 23:22
@bnbarham
Copy link
Contributor Author

@bnbarham
Copy link
Contributor Author

@bnbarham
Copy link
Contributor Author

We previously skipped building/running tool plugins here, which meant
that the compiler arguments for a target also missed any generated
sources. Use the new `BuildDescription.load` API from SwiftPM to address
this.

Resolves rdar://102242345.
This *shouldn't* be needed, but allows running plugins to be skipped if
there's any unexpected interactions with background indexing.
@bnbarham bnbarham force-pushed the generated-source-should-work branch from 5f25d6a to a534385 Compare February 18, 2025 03:14
@bnbarham
Copy link
Contributor Author

@bnbarham
Copy link
Contributor Author

swiftlang/swift-package-manager#8286

@swift-ci please test Windows platform

@bnbarham bnbarham merged commit e865120 into swiftlang:main Feb 18, 2025
3 checks passed
@bnbarham bnbarham deleted the generated-source-should-work branch February 18, 2025 23:53
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request Mar 11, 2025
Since we re-index source files if the build server sends us a `buildTarget/didChange` notification, we no longer need to wait for an up-to-date build graph when a file is modified. This resolves an issue that causes a `Scheduling tasks` progress to appear in the status bar whenever a file in the project is changed. Before swiftlang#1973, this happened fairly frequently during the initial indexing when a header file was written into the build directory. After that PR the `Scheduling Indexing` status appears a lot more frequently, namely every time the index’s database is modified, which happens quite all the time during indexing...
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request Mar 11, 2025
Since we re-index source files if the build server sends us a `buildTarget/didChange` notification, we no longer need to wait for an up-to-date build graph when a file is modified. This resolves an issue that causes a `Scheduling tasks` progress to appear in the status bar whenever a file in the project is changed. Before swiftlang#1973, this happened fairly frequently during the initial indexing when a header file was written into the build directory. After that PR the `Scheduling Indexing` status appears a lot more frequently, namely every time the index’s database is modified, which happens quite all the time during indexing...
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request Mar 11, 2025
Since we re-index source files if the build server sends us a `buildTarget/didChange` notification, we no longer need to wait for an up-to-date build graph when a file is modified. This resolves an issue that causes a `Scheduling tasks` progress to appear in the status bar whenever a file in the project is changed. Before swiftlang#1973, this happened fairly frequently during the initial indexing when a header file was written into the build directory. After that PR the `Scheduling Indexing` status appears a lot more frequently, namely every time the index’s database is modified, which happens quite all the time during indexing...
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request Mar 11, 2025
… currently happening

- **Issue**: Since swiftlang#1973, we are watching for all changes in SourceKit-LSP. This means that we get notified every time the index database is changed. Each of these modifications triggers a new task that waits for build system updates to determine if the modified file needs to be re-indexed. While this task finishes very quickly, it still causes `Scheduling indexing` to replace the `Indexing x / y` in the index status during initial indexing, which looks very noisy.
- **Explanation**: To avoid this flickering, only show `Scheduling indexing` in the index status if we aren’t already indexing any files
- **Scope**: Index progress status
- **Original PR**: This is a significantly reduced version of swiftlang#2051
- **Risk**: Low, this only changes the precedence of status messages in the indexing status
- **Testing**: Manually verified that we don’t see `Scheduling indexing` appear during initial indexing of a package
- **Reviewer**: @bnbarham
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request Mar 11, 2025
Since we re-index source files if the build server sends us a `buildTarget/didChange` notification, we no longer need to wait for an up-to-date build graph when a file is modified. This resolves an issue that causes a `Scheduling tasks` progress to appear in the status bar whenever a file in the project is changed. Before swiftlang#1973, this happened fairly frequently during the initial indexing when a header file was written into the build directory. After that PR the `Scheduling Indexing` status appears a lot more frequently, namely every time the index’s database is modified, which happens quite all the time during indexing...
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request Mar 18, 2025
Since we re-index source files if the build server sends us a `buildTarget/didChange` notification, we no longer need to wait for an up-to-date build graph when a file is modified. This resolves an issue that causes a `Scheduling tasks` progress to appear in the status bar whenever a file in the project is changed. Before swiftlang#1973, this happened fairly frequently during the initial indexing when a header file was written into the build directory. After that PR the `Scheduling Indexing` status appears a lot more frequently, namely every time the index’s database is modified, which happens quite all the time during indexing...
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.

Source generated by build plugin is ignored
2 participants