Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Xcode 16.3: error when adding SwiftLint plugin to Package.swift target #6042

@florianschulz

Description

@florianschulz

New Issue Checklist

Bug Description

Including SwiftLint as a plugin in a Swift Package target causes the following error message on Xcode 16.3:

error: a prebuild command cannot use executables built from source, including executable target 'swiftlint'
error: build planning stopped due to build-tool plugin failures

Example Package.swift:

// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "example-executable",
    platforms: [
        .macOS(.v14)
    ],
    dependencies: [
        .package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", exact: "0.58.2")
    ],
    targets: [
        .executableTarget(
            name: "example-executable",
            plugins: [
                .plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLintPlugins")
            ]
        )
    ]
)

The issue wasn't present on Xcode <= 16.2 and disappears when downgrading to Xcode 16.2.

Environment

  • SwiftLint version 0.58.2
  • Xcode version 16.3
  • Installation method used: SPM (SwiftLintPlugins repo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    integrationIssues related to integration of SwiftLint into toolchains.swift-compilerAn issue caused by a shortcoming in the Swift compiler.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions