plugin targets missing from swift-format dependency

So I've added swift-format as one of my dependencies to my own swift package so that I can use their lint swift package plugin.

Here is my Package.swift:

// swift-tools-version: 5.7

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



import PackageDescription



let package = Package(

	name: "EssentialFeed",

	platforms: [

		.iOS(.v16),

		.macOS(.v13),

		.macCatalyst(.v16),

		.tvOS(.v16),

		.watchOS(.v9)

	],

	products: [

		// Products define the executables and libraries a package produces, and make them visible to other packages.

		.library(

			name: "EssentialFeed",

			targets: ["EssentialFeed"]),

		.library(

			name: "EssentialFeedTestHelpers",

			targets: ["EssentialFeedTestHelpers"]),

	],

	dependencies: [

		.package(url: "https://github.com/apple/swift-format", .upToNextMajor(from: "0.50700.1")),

	],

	targets: [

		// Targets are the basic building blocks of a package. A target can define a module or a test suite.

		// Targets can depend on other targets in this package, and on products in packages this package depends on.

		.target(

			name: "EssentialFeed",

			dependencies: [],

			plugins: [

				.plugin(name: "LintPlugin", package: "swift-format"),

				.plugin(name: "FormatPlugin", package: "swift-format"),

			]

		),

		.target(

			name: "EssentialFeedTestHelpers",

			dependencies: []),

		.testTarget(

			name: "EssentialFeedTests",

			dependencies: ["EssentialFeed", "EssentialFeedTestHelpers"]),

		.testTarget(

			name: "EssentialFeedAPIEndToEndTests",

			dependencies: ["EssentialFeed", "EssentialFeedTestHelpers"]),

	]

)

I get the following error when pulling this package:

product 'LintPlugin' required by package 'essentialfeed' target 'EssentialFeed' not found in package 'swift-format'.

But if you look at swift-format's Package.swift, you can see the plugins exist.

Answered by Xaxxus in 780293022

Looks like the reason this happens is because the swift-format team created a COMMAND plugin. Instead of a BUILD plugin.

If you right click on your package.swift file you should see an option in Xcode to run swift-format.

I really want to use the official tooling with my projects. But time after time, it just seems like apple does not care about swift tooling.

swift-format just seems to be a pain to work with. I can't even get it working with build phases. My script hits the line of code to trigger swift-format, but then nothing happens.

Going to switch to SwiftLint

Accepted Answer

Looks like the reason this happens is because the swift-format team created a COMMAND plugin. Instead of a BUILD plugin.

If you right click on your package.swift file you should see an option in Xcode to run swift-format.

I really want to use the official tooling with my projects. But time after time, it just seems like apple does not care about swift tooling.

swift-format just seems to be a pain to work with. I can't even get it working with build phases. My script hits the line of code to trigger swift-format, but then nothing happens.

Going to switch to SwiftLint

plugin targets missing from swift-format dependency
 
 
Q