finestructure / Arena

A command line tool to create Swift Playground projects with SPM package dependencies
MIT License
685 stars 16 forks source link

Unable to find bundle #84

Closed Ewg777 closed 1 year ago

Ewg777 commented 3 years ago

Thanks for a great tool! Trying to use it with my UICore local package with resources

Got the following error:

UICore/resource_bundle_accessor.swift:27: Fatal error: unable to find bundle named UICore_UICore

Package.swift:

import PackageDescription

let package = Package(
    name: "Dependencies",
    platforms: [
        .iOS(.v14),
    ],
    products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "Dependencies",
            targets: ["Dependencies"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    ],
    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: "Dependencies",
            dependencies: []
        ),
        .testTarget(
            name: "DependenciesTests",
            dependencies: ["Dependencies"]),
    ]
)

package.dependencies = [
    .package(name: "UICore", path: "../../Modules/UICore"),
]
package.targets = [
    .target(name: "Dependencies",
        dependencies: [
            .product(name: "UICore", package: "UICore"),
        ]
    )
]
package.platforms = [
    .iOS("14.0")
]

UICore Package.swift

        .target(
            name: "UICore",
            dependencies: [
...
            ],
            resources: [
                .process("Resources")
            ]

The resulting product folder contains this bundle.

Screenshot 2021-10-28 at 11 49 46

Do you have any idea how to fix it? @finestructure

Thanks!

finestructure commented 3 years ago

Mmm, it could be a couple of things. For one, I've never tested this with local dependencies and relative paths. It could (should?) work but that's definitely something I'd try and eliminate as a source for errors.

And the same is true for resources - but that might also be tied to the local dependency with the path. I could see that breaking when the resource is being loaded.

Hope that helps as a pointer as to what might be going wrong!

finestructure commented 3 years ago

Well, that's rubbish :D Of course I've run this with local dependencies and relative paths - it's even in the README! It's been so long I've done this that I completely forgot.

Nonetheless, maybe that's an issue with resources. It would be interesting to see if pulling that from a remote repo or importing it via an absolute path makes any difference!

finestructure commented 1 year ago

Closing this as part of housekeeping. Please re-open if it's still an issue!