-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add AsyncBuildOperation
alternative to BuildOperation
#7367
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These details should not leak outside of the SwiftPM package. In the (hopefully temporary) absence of `package` access control, we can hide build system-related APIs with `@_spi` annotations.
For now this is mostly a copy of `BuildOperation`, but with `async` entrypoints. This can be expanded to use more structured concurrency features in the future as we migrate more code. It is disabled by default, for testing purposes I'm exposing it as `swift build --experimental-async-build-system`, which creates and uses `AsyncBuildOperation` instead of blocking synchronous `BuildOperation`.
d081d46
to
ea9e940
Compare
@swift-ci test |
Due to a bug in Swift 5.9, we can't have multiple executables with `async` entrypoints linked into test products. This was the reason why we weren't able to make `swift-build` entrypoint `async`. Since we have a single `swift-package-manager` executable anyway, we can link that one into tests instead, and pass "simulated" executable name via an environment variable. This allows us to work around the bug and start using structured concurrency from `swift-build` entrypoint.
…xd/async-swift-build # Conflicts: # Sources/Commands/SwiftBuildCommand.swift # Sources/swift-build/Entrypoint.swift # Sources/swift-package-manager/SwiftPM.swift
…ge-manager into maxd/async-build-operation # Conflicts: # Sources/Commands/SwiftBuildCommand.swift # Sources/swift-build/Entrypoint.swift # Sources/swift-package-manager/SwiftPM.swift
@swift-ci test |
…xd/spi-build-system # Conflicts: # Sources/Commands/SwiftBuildCommand.swift # Sources/Commands/SwiftRunCommand.swift # Sources/Commands/SwiftTestCommand.swift # Sources/CoreCommands/BuildSystemSupport.swift # Sources/CoreCommands/SwiftCommandState.swift # Sources/swift-package-manager/SwiftPM.swift
@swift-ci test |
@swift-ci test |
@swift-ci test |
@swift-ci test windows |
MaxDesiatov
added a commit
that referenced
this pull request
Feb 26, 2024
Due to a bug in Swift 5.9, we can't have multiple executables with `async` entrypoints linked into test products. This was the reason why we weren't able to make `swift-build` entrypoint `async`. Since we have a single `swift-package-manager` executable anyway, we can link that one into tests instead, and pass "simulated" executable name via an environment variable. This allows us to work around the bug and start using structured concurrency from `swift-build` entrypoint. This change is a prerequisite for #7367.
…xd/async-build-operation # Conflicts: # Sources/swift-build/Entrypoint.swift # Sources/swift-build/main.swift # Sources/swift-run/Entrypoint.swift
@swift-ci test |
…xd/spi-build-system # Conflicts: # Sources/Commands/SwiftBuildCommand.swift # Sources/Commands/SwiftRunCommand.swift
MaxDesiatov
commented
Feb 26, 2024
…e-manager into maxd/async-build-operation
…e-manager into maxd/async-build-operation # Conflicts: # Sources/swift-bootstrap/main.swift
Marking as draft, it's currently not possible to fully implement due to |
furby-tm
pushed a commit
to wabiverse/swift-package-manager
that referenced
this pull request
May 15, 2024
Due to a bug in Swift 5.9, we can't have multiple executables with `async` entrypoints linked into test products. This was the reason why we weren't able to make `swift-build` entrypoint `async`. Since we have a single `swift-package-manager` executable anyway, we can link that one into tests instead, and pass "simulated" executable name via an environment variable. This allows us to work around the bug and start using structured concurrency from `swift-build` entrypoint. This change is a prerequisite for swiftlang#7367.
furby-tm
pushed a commit
to wabiverse/swift-package-manager
that referenced
this pull request
May 15, 2024
Due to a bug in Swift 5.9, we can't have multiple executables with `async` entrypoints linked into test products. This was the reason why we weren't able to make `swift-build` entrypoint `async`. Since we have a single `swift-package-manager` executable anyway, we can link that one into tests instead, and pass "simulated" executable name via an environment variable. This allows us to work around the bug and start using structured concurrency from `swift-build` entrypoint. This change is a prerequisite for swiftlang#7367.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
build system
Changes to interactions with build systems
concurrency
swift build
Changes impacting `swift build`
WIP
Work in progress
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on #7365.
For now this is mostly a copy of
BuildOperation
, but withasync
entrypoints. This can be expanded to use more structured concurrency features in the future as we migrate more code. It is disabled by default, for testing purposes I'm exposing it asswift build --build-system experimental-async
, which creates and usesAsyncBuildOperation
instead of blocking synchronousBuildOperation
.