swift
swift copied to clipboard
.build/x86_64-apple-macosx/debug/Danger.build/Danger-Swift.h' not found
I have problems setting up danger-swift in my iOS project.
I followed the steps in the readme
npm install -g danger
brew install danger/tap/danger-swift
I created a DangerCompileDummy.swift
file in the Sources/DangerDependencies
folder, and created the following Package.swift
following the example in the README.
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "DangerDependencies",
products: [
.library(name: "DangerDeps", type: .dynamic, targets: ["DangerDependencies"]),
],
dependencies: [
.package(name: "danger-swift", url: "https://github.com/danger/swift.git", from: "3.0.0")
],
targets: [
.target(name: "DangerDependencies", dependencies: ["danger-swift"], sources: ["DangerCompileDummy.swift"]),
]
)
i explicitly had to name the package danger-swift
, otherwise i get the error dependency 'Danger' in target 'DangerCompileDummy' requires explicit declaration...
.
However i get the confusing error
* Build Completed!
Starting Danger PR on my-pr
../my-project/.build/debug/Danger.build/module.modulemap:2:12: error: header '../my-project/.build/x86_64-apple-macosx/debug/Danger.build/Danger-Swift.h' not found
header "../my-project/.build/x86_64-apple-macosx/debug/Danger.build/Danger-Swift.h"
^
/var/folders/ms/28mx7fh50536x8wqx1j_xy7wl492lm/T/_tmp_dangerfile.swift:1:8: error: could not build Objective-C module 'Danger'
import Danger
^
I don't know what causes it. All i can see is that this header file referenced in the modulemap is really just not there. From all i can see now, my setup is consistent with the one in the readme.
Environment:
- XCode 12.5
- MacOS BigSur 11.4 (20F71)
danger --version
10.6.4
danger-swift --version
3.10.1
swift run danger-swift --version
[1/1] Planning build
* Build Completed!3.10.1
Does the machine has an M1 processor?
No I have this machine: MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports) 2 GHz Quad-Core Intel Core i5
Hey, so I looked a little bit at the issue, given you are installing the project with brew you don't need a Project.swift, does removing that file helps?
Another alternative is to not use brew install danger/tap/danger-swift
and use swift run danger-swift ci
(in the folder with the Package.swift) instead.
you mean just running danger-swift ci ...
without the swift run
prefix right?
i tried it but it leads to the same error.
I think the error happens when the Dangerfile.swift
is evaluated... i'm still not sure why it happens.
We switched now to another solution in the team, so feel free to close this.
If you want to figure it out i'm happy to provide more info tho.
Does the machine has an M1 processor?
@f-meloni Hey I'm also seeing this issue and we do have an M1 Mac Mini for our CI.
I know Homebrew updated their installation path for M1 machines, but do you know of a way to fix it?