Skip to content

Commit 73225aa

Browse files
committed
Enable the static Linux SDK build
Helps keep the codebase free of unintentional Glibc-isms. There are also some interesting testing use cases enabled by building Swift Build using the static SDK.
1 parent afc6b35 commit 73225aa

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.github/workflows/pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
linux_swift_versions: '["nightly-main", "nightly-6.2"]'
2020
windows_swift_versions: '["nightly-main"]'
2121
windows_build_command: 'swift test --no-parallel'
22+
enable_linux_static_sdk_build: true
23+
linux_static_sdk_build_command: SWIFTBUILD_STATIC_LINK=1 LLBUILD_STATIC_LINK=1 swift build
2224
cmake-smoke-test:
2325
name: cmake-smoke-test
2426
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main

Package.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let appleOS = true
2020
let appleOS = false
2121
#endif
2222

23+
let isStaticBuild = Context.environment["SWIFTBUILD_STATIC_LINK"] != nil
2324
let useLocalDependencies = Context.environment["SWIFTCI_USE_LOCAL_DEPS"] != nil
2425
let useLLBuildFramework = Context.environment["SWIFTBUILD_LLBUILD_FWK"] != nil
2526

@@ -447,6 +448,12 @@ for target in package.targets {
447448
}
448449
}
449450

451+
if isStaticBuild {
452+
package.targets = package.targets.filter { target in
453+
target.type != .test && !target.name.hasSuffix("TestSupport")
454+
}
455+
}
456+
450457
// `SWIFTCI_USE_LOCAL_DEPS` configures if dependencies are locally available to build
451458
if useLocalDependencies {
452459
package.dependencies += [

0 commit comments

Comments
 (0)