Dangerfile compilation fails with Swift 6.2 (Xcode 27) due to SPM build path changes
- Dominant language
- Swift
- Stars
- 1.1k
- Forks
- 152
- Avg merge
- 9h 54m
- Merged PRs (30d)
- 2
Description
## 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
1. Install Xcode 27 and set it as the active toolchain
2. Build DangerIntegration package with `swift build`
3. 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.