Skip to content

Sever the package dependency if using SwiftBuild Framework #8434

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

Conversation

bkhouri
Copy link
Contributor

@bkhouri bkhouri commented Apr 1, 2025

The SwiftBuild project has a dependency on Swift Driver, which has a dependency on Swift Tools Support Core (STSC). Swift Package Manager (SwiftPM) executable targets also have a dependency on STSC.

Sever SwiftPM package depenedency on STSC if the
SWIFTPM_SWBUILD_FRAMEWORK environment variable is set so we can indirectly pull the STCS dependency on the dynamic library that will be pulled in via SwiftDriver.

The SwiftBuild project has a dependency on Swift Driver, which has a
dependency on Swift Tools Support Core (STSC).  Swift Package Manager
(SwiftPM) executable targets also have a dependency on STSC.

Sever SwiftPM package depenedency on STSC if the
SWIFTPM_SWBUILD_FRAMEWORK environment variable is set so we can
indirectly pull the STCS dependency on the dynamic libray that will be
pulled in via SwiftDriver.
@bkhouri
Copy link
Contributor Author

bkhouri commented Apr 1, 2025

@swift-ci please test

@bkhouri
Copy link
Contributor Author

bkhouri commented Apr 1, 2025

@swift-ci please test self hosted windows

@bkhouri bkhouri marked this pull request as ready for review April 1, 2025 02:24
@bkhouri bkhouri enabled auto-merge (squash) April 1, 2025 02:24
@bkhouri bkhouri merged commit 3f949d8 into swiftlang:main Apr 1, 2025
6 checks passed
Comment on lines +90 to +93
private func useSwiftBuildPackageDependency() -> Bool {
return (ProcessInfo.processInfo.environment["SWIFTPM_SWBUILD_FRAMEWORK"] == nil &&
ProcessInfo.processInfo.environment["SWIFTPM_NO_SWBUILD_DEPENDENCY"] == nil)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a particular reason this uses a function instead of a simple let binding? I also don't think private is needed here, there's no chance this function could be used accidentally elsewhere, since multi-file package manifest is not a thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is used in two places, so instead of duplicating the logic, I opted to put it in a function call.

Copy link
Contributor

@MaxDesiatov MaxDesiatov Apr 1, 2025

Choose a reason for hiding this comment

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

But is there a need to duplicate the logic with a let binding? With a function the computation is duplicated since the function is invoked twice, while with a let binding it would be computed only once.

@bkhouri bkhouri deleted the t/main/sever_swift-support-core_dependency branch April 1, 2025 14:48
bkhouri added a commit that referenced this pull request Apr 1, 2025
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