Skip to content

Dangerfile compilation fails with Swift 6.2 (Xcode 27) due to SPM build path changes #661

Description

@renfrenkel

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions