Skip to content

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

Closed

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)

Activity

  1. SimplyDanny commented on Apr 3, 2025

    @SimplyDanny
    Collaborator

    I don't see this in a simple Swift package. Can you share a reproducer?

  2. added
    repro-needed
    integration
    on Apr 3, 2025
  3. florianschulz commented on Apr 3, 2025

    @florianschulz
    Author

    Sure, here you go:

    example-executable.zip

  4. SimplyDanny commented on Apr 3, 2025

    @SimplyDanny
    Collaborator

    And there you go. Seems to be an issue in the just released version of the Swift 6.1 toolchain. Nothing that SwiftLint can do about it, other than switching to the command plugin for the time being.

    I can reproduce it with swift build, but not when building with Xcode. So maybe it still works for most users.

    Nevertheless, I'll pin this issue to let others know. Thanks for reporting, @florianschulz!

  5. pinned this issue on Apr 3, 2025
  6. added
    swift-compiler
    and removed
    repro-needed
    on Apr 3, 2025
  7. Noobish1 commented on Apr 4, 2025

    @Noobish1

    What you can do as a workaround is install SwiftLint via Mint and wrap it in your own BuildTool plugin.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    integrationswift-compiler

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions