From 81c380ac58748954f0af1d4f7ec710dd2fb9c4eb Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Thu, 2 Jul 2026 14:31:30 +0200 Subject: [PATCH 1/4] Swift: Turn of caching and integrated driver in autobuild * Caching cases compiler invocations to be omitted. You can try this for yourself by turning on caching while building the project from the `xcode-hello` integration test, then cleaning of the build artifacts and building the project again while caching is enabled. This yields a database that is practically empty. * The integrated driver causes compiler invocations to depend on modules shipped with Xcode. Those are unfortunately incompatible with our extractor. --- swift/swift-autobuilder/BuildRunner.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/swift/swift-autobuilder/BuildRunner.cpp b/swift/swift-autobuilder/BuildRunner.cpp index 46108e8259da..2e0045d3c2b6 100644 --- a/swift/swift-autobuilder/BuildRunner.cpp +++ b/swift/swift-autobuilder/BuildRunner.cpp @@ -79,6 +79,9 @@ bool buildXcodeTarget(const XcodeTarget& target, bool dryRun) { argv.push_back(target.name); argv.push_back("CODE_SIGNING_REQUIRED=NO"); argv.push_back("CODE_SIGNING_ALLOWED=NO"); + argv.push_back("COMPILATION_CACHE_ENABLE_CACHING=NO"); + argv.push_back("SWIFT_ENABLE_COMPILE_CACHE=NO"); + argv.push_back("SWIFT_USE_INTEGRATED_DRIVER=NO"); return run_build_command(argv, dryRun); } From 62d709e3fe992c87496a26076eb2a1a13f3217d3 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Thu, 2 Jul 2026 14:36:34 +0200 Subject: [PATCH 2/4] Swift: update integration tests to not use the integrated driver --- swift/ql/integration-tests/osx/hello-ios/test.py | 3 ++- swift/ql/integration-tests/osx/hello-xcode/test.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/swift/ql/integration-tests/osx/hello-ios/test.py b/swift/ql/integration-tests/osx/hello-ios/test.py index b5871f323ccf..ecb4a940d8bd 100644 --- a/swift/ql/integration-tests/osx/hello-ios/test.py +++ b/swift/ql/integration-tests/osx/hello-ios/test.py @@ -7,5 +7,6 @@ def test(codeql, swift, xcode_16): codeql.database.create( command="xcodebuild build " - "CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO", + "CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO " + "SWIFT_USE_INTEGRATED_DRIVER=NO", ) diff --git a/swift/ql/integration-tests/osx/hello-xcode/test.py b/swift/ql/integration-tests/osx/hello-xcode/test.py index 35b0d6dae58e..cf6a17f39084 100644 --- a/swift/ql/integration-tests/osx/hello-xcode/test.py +++ b/swift/ql/integration-tests/osx/hello-xcode/test.py @@ -9,5 +9,6 @@ def test(codeql, swift, xcode_all): command="xcodebuild build " "-project codeql-swift-autobuild-test.xcodeproj " "-target codeql-swift-autobuild-test " - "CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO", + "CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO " + "SWIFT_USE_INTEGRATED_DRIVER=NO", ) From f5aeed949318c308ef6ebd7415a74205f228d8f1 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Thu, 2 Jul 2026 14:46:21 +0200 Subject: [PATCH 3/4] Swift: Update autobuild tests --- .../integration-tests/autobuilder/failure/diagnostics.expected | 2 +- .../swift-autobuilder/tests/hello-autobuilder/commands.expected | 2 +- .../tests/hello-targets-with-tests-suffix/commands.expected | 2 +- swift/swift-autobuilder/tests/hello-tests/commands.expected | 2 +- swift/swift-autobuilder/tests/hello-workspace/commands.expected | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/swift/ql/integration-tests/autobuilder/failure/diagnostics.expected b/swift/ql/integration-tests/autobuilder/failure/diagnostics.expected index 2f43e334bc09..248495e3bd2c 100644 --- a/swift/ql/integration-tests/autobuilder/failure/diagnostics.expected +++ b/swift/ql/integration-tests/autobuilder/failure/diagnostics.expected @@ -1,5 +1,5 @@ { - "markdownMessage": "`autobuild` failed to run the build command:\n\n```\n/usr/bin/xcodebuild build -project /hello-failure.xcodeproj -target hello-failure CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO\n```\n\nSet up a [manual build command][1] or [check the logs of the autobuild step][2].\n\n[1]: https://docs.github.com/en/enterprise-server/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language\n[2]: https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs", + "markdownMessage": "`autobuild` failed to run the build command:\n\n```\n/usr/bin/xcodebuild build -project /hello-failure.xcodeproj -target hello-failure CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO COMPILATION_CACHE_ENABLE_CACHING=NO SWIFT_ENABLE_COMPILE_CACHE=NO SWIFT_USE_INTEGRATED_DRIVER=NO\n```\n\nSet up a [manual build command][1] or [check the logs of the autobuild step][2].\n\n[1]: https://docs.github.com/en/enterprise-server/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language\n[2]: https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs", "severity": "error", "source": { "extractorName": "swift", diff --git a/swift/swift-autobuilder/tests/hello-autobuilder/commands.expected b/swift/swift-autobuilder/tests/hello-autobuilder/commands.expected index 9d2be19b9c45..dd086268ddbb 100644 --- a/swift/swift-autobuilder/tests/hello-autobuilder/commands.expected +++ b/swift/swift-autobuilder/tests/hello-autobuilder/commands.expected @@ -1 +1 @@ -/usr/bin/xcodebuild build -project ./hello-autobuilder.xcodeproj -target hello-autobuilder CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO +/usr/bin/xcodebuild build -project ./hello-autobuilder.xcodeproj -target hello-autobuilder CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO COMPILATION_CACHE_ENABLE_CACHING=NO SWIFT_ENABLE_COMPILE_CACHE=NO SWIFT_USE_INTEGRATED_DRIVER=NO diff --git a/swift/swift-autobuilder/tests/hello-targets-with-tests-suffix/commands.expected b/swift/swift-autobuilder/tests/hello-targets-with-tests-suffix/commands.expected index 4506ff8aa56e..3d31114ca325 100644 --- a/swift/swift-autobuilder/tests/hello-targets-with-tests-suffix/commands.expected +++ b/swift/swift-autobuilder/tests/hello-targets-with-tests-suffix/commands.expected @@ -1 +1 @@ -/usr/bin/xcodebuild build -project ./Foo.xcodeproj -target FooDemo CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO +/usr/bin/xcodebuild build -project ./Foo.xcodeproj -target FooDemo CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO COMPILATION_CACHE_ENABLE_CACHING=NO SWIFT_ENABLE_COMPILE_CACHE=NO SWIFT_USE_INTEGRATED_DRIVER=NO diff --git a/swift/swift-autobuilder/tests/hello-tests/commands.expected b/swift/swift-autobuilder/tests/hello-tests/commands.expected index a34306fe74c2..46e061896a85 100644 --- a/swift/swift-autobuilder/tests/hello-tests/commands.expected +++ b/swift/swift-autobuilder/tests/hello-tests/commands.expected @@ -1 +1 @@ -/usr/bin/xcodebuild build -project ./hello-tests.xcodeproj -target hello-tests CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO +/usr/bin/xcodebuild build -project ./hello-tests.xcodeproj -target hello-tests CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO COMPILATION_CACHE_ENABLE_CACHING=NO SWIFT_ENABLE_COMPILE_CACHE=NO SWIFT_USE_INTEGRATED_DRIVER=NO diff --git a/swift/swift-autobuilder/tests/hello-workspace/commands.expected b/swift/swift-autobuilder/tests/hello-workspace/commands.expected index ad85eb8c24bb..d9d20e69d087 100644 --- a/swift/swift-autobuilder/tests/hello-workspace/commands.expected +++ b/swift/swift-autobuilder/tests/hello-workspace/commands.expected @@ -1 +1 @@ -/usr/bin/xcodebuild build -workspace ./Hello.xcworkspace -scheme hello-workspace CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO +/usr/bin/xcodebuild build -workspace ./Hello.xcworkspace -scheme hello-workspace CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO COMPILATION_CACHE_ENABLE_CACHING=NO SWIFT_ENABLE_COMPILE_CACHE=NO SWIFT_USE_INTEGRATED_DRIVER=NO From 4ecaf491fe2107077eb92d6ebf66681f03ebe321 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Thu, 2 Jul 2026 15:34:22 +0200 Subject: [PATCH 4/4] Swift: Update integration test --- .../autobuilder/xcode-fails-spm-works/Files.macos_26.expected | 3 --- .../autobuilder/xcode-fails-spm-works/test.py | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 swift/ql/integration-tests/autobuilder/xcode-fails-spm-works/Files.macos_26.expected diff --git a/swift/ql/integration-tests/autobuilder/xcode-fails-spm-works/Files.macos_26.expected b/swift/ql/integration-tests/autobuilder/xcode-fails-spm-works/Files.macos_26.expected deleted file mode 100644 index 8a3be429106c..000000000000 --- a/swift/ql/integration-tests/autobuilder/xcode-fails-spm-works/Files.macos_26.expected +++ /dev/null @@ -1,3 +0,0 @@ -| Package.swift:0:0:0:0 | Package.swift | -| Sources/hello-world/hello_world.swift:0:0:0:0 | Sources/hello-world/hello_world.swift | -| file://:0:0:0:0 | | diff --git a/swift/ql/integration-tests/autobuilder/xcode-fails-spm-works/test.py b/swift/ql/integration-tests/autobuilder/xcode-fails-spm-works/test.py index 4beed91f233b..298fd2726d0b 100644 --- a/swift/ql/integration-tests/autobuilder/xcode-fails-spm-works/test.py +++ b/swift/ql/integration-tests/autobuilder/xcode-fails-spm-works/test.py @@ -3,7 +3,6 @@ @runs_on.macos -@pytest.mark.ql_test("DB-CHECK", xfail=not runs_on.macos_26) -@pytest.mark.ql_test("*", expected=f"{'.macos_26' if runs_on.macos_26 else ''}.expected") +@pytest.mark.ql_test("DB-CHECK", xfail=True) def test(codeql, swift): codeql.database.create()