From f5735b3b9a4b34269583ccfdc75f8b1c4725fc0d Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Fri, 8 Jul 2022 17:02:31 -0400 Subject: [PATCH 1/7] Support `--static-stdlib` on non-Apple platforms Fixes #23. --- Makefile | 9 ++++++++- Sources/XCTestDynamicOverlay/XCTFail.swift | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4021b676..4c34a10c 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,14 @@ test-linux: -v "$(PWD):$(PWD)" \ -w "$(PWD)" \ swift:5.6.2-focal \ - bash -c "make test" + bash -c "apt-get update && apt-get install make && make test" + +test-linux-static-stdlib: + @docker run \ + -v "$(PWD):$(PWD)" \ + -w "$(PWD)" \ + swift:5.6.2-focal \ + bash -c "swift build -Xswiftc -static-stdlib" format: @swift format \ diff --git a/Sources/XCTestDynamicOverlay/XCTFail.swift b/Sources/XCTestDynamicOverlay/XCTFail.swift index e2fdacc9..1372c28a 100644 --- a/Sources/XCTestDynamicOverlay/XCTFail.swift +++ b/Sources/XCTestDynamicOverlay/XCTFail.swift @@ -65,9 +65,12 @@ dlsym(dlopen(nil, RTLD_LAZY), "_XCTFailureHandler"), to: XCTFailureHandler.self ) - #else + #elseif canImport(XCTest) // NB: It seems to be safe to import XCTest on Linux @_exported import func XCTest.XCTFail + #else + public func XCTFail(_ message: String = "") {} + public func XCTFail(_ message: String = "", file: StaticString, line: UInt) {} #endif #else /// This function generates a failure immediately and unconditionally. From ac574604e2abbd648894b64f32c534749dc0977f Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Fri, 8 Jul 2022 17:05:27 -0400 Subject: [PATCH 2/7] CI --- .github/workflows/ci.yml | 2 ++ Package.resolved | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 Package.resolved diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 111907d9..3453aa7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,3 +24,5 @@ jobs: - uses: actions/checkout@v2 - name: Run tests run: make test + - name: Build with static linking + run: swift build -Xfrontend -static-stdlib diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 00000000..3b6d58b8 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "SwiftDocCPlugin", + "repositoryURL": "https://github.com/apple/swift-docc-plugin", + "state": { + "branch": null, + "revision": "3303b164430d9a7055ba484c8ead67a52f7b74f6", + "version": "1.0.0" + } + } + ] + }, + "version": 1 +} From 8b85e0cd2e8deffdd8a9efa6253ad0a29ac9b95c Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Fri, 8 Jul 2022 17:09:19 -0400 Subject: [PATCH 3/7] wip --- .github/workflows/ci.yml | 6 ++++-- Makefile | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3453aa7e..ff3186a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,5 +24,7 @@ jobs: - uses: actions/checkout@v2 - name: Run tests run: make test - - name: Build with static linking - run: swift build -Xfrontend -static-stdlib + - name: Build with static linking (debug) + run: swift build -c debug -Xfrontend -static-stdlib + - name: Build with static linking (release) + run: swift build -c release -Xfrontend -static-stdlib diff --git a/Makefile b/Makefile index 4c34a10c..bc7af7d3 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,12 @@ test-linux-static-stdlib: -v "$(PWD):$(PWD)" \ -w "$(PWD)" \ swift:5.6.2-focal \ - bash -c "swift build -Xswiftc -static-stdlib" + bash -c "swift build -c debug -Xswiftc -static-stdlib" + @docker run \ + -v "$(PWD):$(PWD)" \ + -w "$(PWD)" \ + swift:5.6.2-focal \ + bash -c "swift build -c release -Xswiftc -static-stdlib" format: @swift format \ From 8700012139edf17f80f5502b5c665de4ec25170e Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Fri, 8 Jul 2022 17:11:08 -0400 Subject: [PATCH 4/7] wip --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff3186a6..6eb2a3d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,6 @@ jobs: - name: Run tests run: make test - name: Build with static linking (debug) - run: swift build -c debug -Xfrontend -static-stdlib + run: swift build -cdebug -Xfrontend -static-stdlib - name: Build with static linking (release) - run: swift build -c release -Xfrontend -static-stdlib + run: swift build -crelease -Xfrontend -static-stdlib From 5cb2d7e31332a645c51304ef6d90792ff793fa13 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Fri, 8 Jul 2022 17:12:42 -0400 Subject: [PATCH 5/7] wip --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6eb2a3d9..24978c54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,6 @@ jobs: - name: Run tests run: make test - name: Build with static linking (debug) - run: swift build -cdebug -Xfrontend -static-stdlib + run: swift -c debug build -Xfrontend -static-stdlib - name: Build with static linking (release) - run: swift build -crelease -Xfrontend -static-stdlib + run: swift -c release build -Xfrontend -static-stdlib From 9ef345deb63d154c5bbad4b25e56edebafeef1dc Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Fri, 8 Jul 2022 17:17:00 -0400 Subject: [PATCH 6/7] wip --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24978c54..de6edb19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,9 @@ jobs: - uses: actions/checkout@v2 - name: Run tests run: make test + # Swift complains when directly invoking the command on Ubuntu + - name: Build with static linking (Docker) + run: make test-linux-static-stdlib ubuntu: name: Ubuntu @@ -24,7 +27,3 @@ jobs: - uses: actions/checkout@v2 - name: Run tests run: make test - - name: Build with static linking (debug) - run: swift -c debug build -Xfrontend -static-stdlib - - name: Build with static linking (release) - run: swift -c release build -Xfrontend -static-stdlib From 296b3184b2a3456b580fe6edb3c91b46bc1e33c1 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Fri, 8 Jul 2022 17:18:48 -0400 Subject: [PATCH 7/7] give up --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de6edb19..111907d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,6 @@ jobs: - uses: actions/checkout@v2 - name: Run tests run: make test - # Swift complains when directly invoking the command on Ubuntu - - name: Build with static linking (Docker) - run: make test-linux-static-stdlib ubuntu: name: Ubuntu