Package resources from a directory named with an extension

We're adding SPM support to a pre-existing project. We have PNG resources inside a foo.bundle.

But it appears that because the parent directory has an extension (e.g. ".bundle"), SPM doesn't copy (or "process") the PNG.

Is that expected?

The following test illustrates the problem. (derived from

    func testSwiftBundleAccessor() throws {
        // This has a Swift and ObjC target in the same package.
        let fs = InMemoryFileSystem(emptyFiles:

        let diagnostics = DiagnosticsEngine()

        let graph = try loadPackageGraph(
            fs: fs,
            diagnostics: diagnostics,
            manifests: [
                    name: "PkgA",
                    path: "/PkgA",
                    url: "/PkgA",
                    v: .v5_3,
                    packageKind: .root,
                    targets: [
                            name: "Foo",
                            exclude: [ "sub.sub" ],
                            resources: [
                                .init(rule: .copy, path: "foo.txt"),
                                .init(rule: .process, path: "sub.sub/subfoo.txt"),

        let plan = try BuildPlan(
            buildParameters: mockBuildParameters(),
            graph: graph,
            diagnostics: diagnostics,
            fileSystem: fs

        try testWithTemporaryDirectory { path in
            let yaml = path.appending(component: "debug.yaml")
            let llbuild = LLBuildManifestBuilder(plan)
            try llbuild.generateManifest(at: yaml)
            let contents = try localFileSystem.readFileContents(yaml).description
            XCTAssertMatch(contents, .contains("subfoo.txt"))

Terms of Service

Privacy Policy

Cookie Policy