From ebf3e53e0fe56e67ca08a659a06bfcfb5935a3d6 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sun, 11 May 2025 23:46:10 +0800 Subject: [PATCH] Add -no-verify-emitted-module-interface --- .github/workflows/compatibility_tests.yml | 2 -- .github/workflows/macos.yml | 4 ---- Package.swift | 5 +++-- Scripts/{og_swiftinterface.sh => build_swiftinterface.sh} | 6 +++--- 4 files changed, 6 insertions(+), 11 deletions(-) rename Scripts/{og_swiftinterface.sh => build_swiftinterface.sh} (61%) diff --git a/.github/workflows/compatibility_tests.yml b/.github/workflows/compatibility_tests.yml index eb20b1ce..0e127baf 100644 --- a/.github/workflows/compatibility_tests.yml +++ b/.github/workflows/compatibility_tests.yml @@ -36,8 +36,6 @@ jobs: - name: Swift version run: swift --version - name: Run tests against Apple's AttributeGraph on macOS via SwiftPM - env: - OPENGRAPH_LIBRARY_EVOLUTION: 0 run: | swift test \ --build-path .build-compatibility-test-debug diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 18fdca4e..f299b1c8 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -35,8 +35,6 @@ jobs: - name: Swift version run: swift --version - name: Build and run tests in debug mode with coverage - env: - OPENGRAPH_LIBRARY_EVOLUTION: 0 run: | swift test \ -c debug \ @@ -47,8 +45,6 @@ jobs: .build-test-debug/debug/OpenGraphPackageTests.xctest/Contents/MacOS/OpenGraphPackageTests \ > coverage.txt - name: Build and run tests in release mode - env: - OPENGRAPH_LIBRARY_EVOLUTION: 0 run: | swift test \ -c release \ diff --git a/Package.swift b/Package.swift index 3394cf49..40871f9a 100644 --- a/Package.swift +++ b/Package.swift @@ -119,8 +119,9 @@ let libraryEvolutionCondition = envEnable("OPENGRAPH_LIBRARY_EVOLUTION") #endif if libraryEvolutionCondition { - // NOTE: -enable-library-evolution is not supported on `swift build` yet. - sharedSwiftSettings.append(.unsafeFlags(["-enable-library-evolution"])) + // NOTE: -enable-library-evolution will cause module verify failure for `swift build`. + // Either set OPENGRAPH_LIBRARY_EVOLUTION=0 or add `-Xswiftc -no-verify-emitted-module-interface` after `swift build` + sharedSwiftSettings.append(.unsafeFlags(["-enable-library-evolution", "-no-verify-emitted-module-interface"])) } // MARK: - Targets diff --git a/Scripts/og_swiftinterface.sh b/Scripts/build_swiftinterface.sh similarity index 61% rename from Scripts/og_swiftinterface.sh rename to Scripts/build_swiftinterface.sh index 12a3817e..0fe8dfd5 100755 --- a/Scripts/og_swiftinterface.sh +++ b/Scripts/build_swiftinterface.sh @@ -5,8 +5,8 @@ filepath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" } -OG_ROOT="$(dirname $(dirname $(filepath $0)))" +OPENGRAPH_ROOT="$(dirname $(dirname $(filepath $0)))" -cd $OG_ROOT +cd $OPENGRAPH_ROOT -swift build -Xswiftc -emit-module-interface -Xswiftc -enable-library-evolution +swift build -Xswiftc -emit-module-interface -Xswiftc -enable-library-evolution -Xswiftc -no-verify-emitted-module-interface