Closed postmechanical closed 4 years ago
First two things I notice are that:
swift run danger-swift edit
ti see if compiles)danger-swift
is in your Package.swift, just use swift run danger-swift command
, you only need danger-js, you can install it with npm or brew Also: which version of Danger-swift are you currently using in your package.resolved?
@f-meloni Thanks for the response.
import DangerSwiftCoverage
in my Dangerfile.swift
and then running swift run danger-swift edit
it does not compile. See first error posted.brew
installed danger-swift
to SPM
setup in order to use DangerSwiftCoverage
, but it's not working and the errors don't seem to guide one to any solution in a reasonable amount of time.danger-swift
version in Package.resolved
that I tried were 3.0.0
and 3.3.0
.I'm sure you will need an import DangerSwiftCoverage
.
I'm currently not sure of why that is not working though.
I have a repo with a really similar configuration to the one you would like to have, that is currently working, maybe you can have a look and see if you spot any difference
https://github.com/f-meloni/danger-swift-xcodesummary/pull/17/files
@f-meloni Finally got it working with the Package.swift
to which you linked. Thanks.
@f-meloni Actually scratch that previous comment. I was able to get swift run danger-swift edit
to build and run. In my Dangerfile.swift
I could import DangerSwiftCoverage
, but I could not import any other plugins so your linked example really is for a Package.swift
for a plugin. What I need is a Package.swift
for just running danger-swift
and arbitrary plugins via SPM.
The plugin example on the main site just doesn't appear to work at all. I have a pretty vanilla Package.swift
, which builds fine but none of the plugins can be imported. Pretty much going to bail and go back to Ruby danger
.
// swift-tools-version:5.1
import PackageDescription
let package = Package(
name: "Whatever",
products: [
.library(name: "DangerDependencies-Library", type: .dynamic, targets: ["DangerDependencies-Target"]) // dev
],
dependencies: [
.package(url: "https://github.com/danger/swift.git", from: "3.3.0"), // dev
.package(url: "https://github.com/f-meloni/danger-swift-coverage", from: "1.1.0"), // dev
.package(url: "https://github.com/f-meloni/danger-swift-xcodesummary", from: "1.2.1"), // dev
],
targets: [
.target(name: "DangerDependencies-Target", dependencies: ["Danger", "DangerSwiftCoverage", "DangerXCodeSummary"], path: ".", sources: ["Fake.swift"]) // dev
]
)
I think you’ll need to replace the library name library(name: "DangerDeps[Product name (optional)]"
(it needs to start with DangerDeps, danger needs to identify it)
Thanks, that works. I opened a PR to improve the main readme for that: https://github.com/danger/swift/pull/348. Hopefully it saves other a significant hassle in the future.
Package.swift
:Running
swift run danger-swift edit
crashes with:Running
swift run danger-swift pr https://github.com/some-org/some-repo/pull/1234
crashes with:The
Dangerfile.swift
runs fine withdanger-swift
installed via brew and theimport DangerSwiftCoverage
omitted.