Quantcast
Channel: Swift Package - Distribute standalone executable with bundle - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Swift Package - Distribute standalone executable with bundle

$
0
0

I'm writing a Swift script as a standalone Swift Package. Part of this script needs to generate some files, for which I have templates.

Now, these templates are not compilable (they're HTML files); so in order to include them in the package I've included them as .copy("Templates").

When debugging my script, I can access the templates just fine, but when I try to archive the product, the executable doesn't have access to them anymore.

Here's my Package.swift:

let package = Package(    name: "flucs",    products: [        .executable(name: "Flucs",                    targets: ["flucs"])    ],    dependencies: [        .package(url: "https://github.com/MrSkwiggs/Netswift", .exact(.init(0, 3, 1))),    ],    targets: [        .target(            name: "flucs",            dependencies: ["Netswift"],            path: "Sources",            resources: [                .copy("Templates")            ]),        .testTarget(            name: "flucsTests",            dependencies: ["flucs"]),    ])

My folder structure:

folder structure

How can I distribute my script so that it also includes its resources?


Viewing all articles
Browse latest Browse all 2

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>