Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift run danger-swift edit doesn't include plugins; swift run danger-swift (ci|local) works #590

Open
niorko opened this issue Aug 15, 2023 · 1 comment

Comments

@niorko
Copy link

niorko commented Aug 15, 2023

I have a danger subdirectory in my project.

This is it's structure:

.
├── DangerDependencies
│   └── Fake.swift
├── Dangerfile.swift
├── Package.resolved
└── Package.swift

This is Dangerfile.swift:

import Foundation
import Danger
import DangerSwiftKantoku

let danger = Danger()
let kantokuConfig = XCResultParsingConfiguration(
    codeCoverageRequirement: .none,
    reportingFileType: .modifiedAndCreatedFiles
)
danger.kantoku.parseXCResultFile(at: "somePath", configuration: kantokuConfig)

and this is Package.swift:

// swift-tools-version:5.8
import PackageDescription

let package = Package(
    name: "DangerDepsProject",
    platforms: [.macOS(.v12)],
    products: [
        .library(name: "DangerDeps", type: .dynamic, targets: ["DangerDependencies"])
    ],
    dependencies: [
        .package(url: "https://github.com/danger/swift.git", from: "3.17.1"),
        .package(url: "https://www.github.com/yumemi-inc/danger-swift-kantoku.git", from: "0.1.1")
    ],
    targets: [
        .target(
            name: "DangerDependencies", 
            dependencies: [
                .product(name: "Danger", package: "swift"),
                .product(name: "DangerSwiftKantoku", package: "danger-swift-kantoku")
            ],
            path: "DangerDependencies"
        )
    ]
)

This works and it successfully uses plugins:

cd danger
swift build
swift run danger-swift local --failOnErrors --cwd ../ --base origin/develop

But I want to be able to edit the project, so I call this:

cd danger
swift build
swift run danger-swift edit

And this does not work, it generates the project where Package.swift does not contain plugins, so it won't build:

Generated Package.swift:

// swift-tools-version:5.8
// danger-dependency-generator-version:3

import PackageDescription

let package = Package(
    name: "Dangerfile",
    platforms: [.macOS(.v13)],
    products: [.executable(name: "DangerDependencies", targets: ["Dangerfile"])],
    dependencies: [
        .package(url: "https://github.com/danger/swift.git", exact: "3.17.1")
    ],
    targets: [.executableTarget(name: "Dangerfile", dependencies: [
        .product(name: "Danger", package: "swift")
    ])],
    swiftLanguageVersions: [.version("5")]
)

Swift Danger Version: 3.17.1

Example project: danger.zip

@niorko niorko changed the title swift run edit does not include plugins; swift run (ci|local) works correctly swift run danger-swift edit doesn't include plugins; swift run danger-swift (ci|local) works Aug 15, 2023
@f-meloni
Copy link
Member

Thank you for the really detailed issue, let me give it a look and see if I can help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants