[Support] Compiling Metal files with SwiftPM

I've been trying to figure out how to use Swift and Metal without Xcode. I cannot figure out SwiftPM. I've tried everything I can think of, and am just going round in circles.

This is my (current) manifest (I've tried many variations):

// swift-tools-version: 6.0
import PackageDescription

let package = Package(
    name: "BaseMetal",
    platforms: [.macOS(.v14)],
    products: [.executable(name: "BaseMetal", targets: ["BaseMetal"])],
    targets: [
        .executableTarget(name: "BaseMetal"),
        .target(
            name: "Shaders",
            resources: [.process(".")]
        ),
    ]
)

My tree looks like this:

.
├── Package.swift
└── Sources
    ├── BaseMetal
    │   ├── Main.swift
    │   ├── Metalic.swift
    │   └── Renderer.swift
    └── Shaders
        ├── Canvas.metal
        └── Shader.metal

The same error message comes up under various circumstances, but always when the paths are correct (oddly):

❯ swift run
error: 'basemetal': public headers ("include") directory path for 'Shaders' is invalid or not contained in the target

That error message also confused a few people (in the Apple Developer Forum), but they never got a response there.

Any pointers would be greatly appreciated (while I still have some hair). Thanks for taking the time to look at it.

A bit more info...

I looked through the .build directory, and couldn't find any intermediate (Metal IR) files, so I'm sure that SwiftPM is unhappy with the manifest (it's not an error in the source files). I also copied the code from another project (that compiled fine in Xcode), which increases my confidence that this is an issue with my manifest.

If I understand correctly, the .process function either takes a filename (and processes the file) or a directory (and processes everything in the directory). Here, process means compile/optimize/etc (whatever's appropriate for a known file-type). So, running .process on a directory of Metal files should compile them all.

I've tried changing the paths (so they're incorrect), and get the expected errors, with the expected (incorrect) paths. When I correct the paths, I get the error message from above.