Summary
Danger Swift 3.20.2 fails to compile the Dangerfile when using Swift 6.2 (bundled with Xcode 27) because SPM's build output layout has changed.
Error
_tmp_dangerfile.swift:1:8: error: no such module 'Danger'
1 | import Danger
| `- error: no such module 'Danger'
2 | import DangerIntegration
3 | import Foundation
Followed by:
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/.../danger-response.json
Cause
The runner invokes swiftc with hardcoded legacy paths:
swift --driver-mode=swift \
-L .../Packages/DangerIntegration/.build/debug \
-I .../Packages/DangerIntegration/.build/debug/Modules \
-lDangerDeps \
_tmp_dangerfile.swift ...
Swift 6.2 (Xcode 27) changed the SPM build output layout. Modules now go to .build/out/Products/Debug/ instead of .build/debug/Modules/, so the -I and -L flags point to directories that no longer contain the built modules/libraries.
Environment
- Xcode 27 (Swift 6.2)
- Danger Swift 3.20.2
- macOS 26+
- danger-js invoking danger-swift via
--process
Steps to Reproduce
- Install Xcode 27 and set it as the active toolchain
- Build DangerIntegration package with
swift build
- Run
danger ci — the Dangerfile compilation fails because the runner looks for modules at .build/debug/Modules/ which no longer exists
Suggested Fix
Update the module/library search paths in the runner (where it constructs the -I and -L flags) to use the new SPM layout (.build/out/Products/Debug/) when building with Swift 6.2+, and fall back to the legacy path for older Swift versions.
Summary
Danger Swift 3.20.2 fails to compile the Dangerfile when using Swift 6.2 (bundled with Xcode 27) because SPM's build output layout has changed.
Error
Followed by:
Cause
The runner invokes
swiftcwith hardcoded legacy paths:Swift 6.2 (Xcode 27) changed the SPM build output layout. Modules now go to
.build/out/Products/Debug/instead of.build/debug/Modules/, so the-Iand-Lflags point to directories that no longer contain the built modules/libraries.Environment
--processSteps to Reproduce
swift builddanger ci— the Dangerfile compilation fails because the runner looks for modules at.build/debug/Modules/which no longer existsSuggested Fix
Update the module/library search paths in the runner (where it constructs the
-Iand-Lflags) to use the new SPM layout (.build/out/Products/Debug/) when building with Swift 6.2+, and fall back to the legacy path for older Swift versions.