Open djbe opened 2 years ago
Do note that for Homebrew, we had some trouble because they didn't like that we were installing the binary + the bundle in the bin
folder. Apparently they have some validation for that. Not sure if Mint also wants to avoid polluting the bin
path like that.
We couldn't just move the bundle somewhere else, the (relative) path to the bundle is hardcoded in the binary (and controlled by Apple/Swift). We ended up installing everything in libexec
, and then creating a shim in bin
. Initially we tried a symlink, but that doesn't work in all cases.
See these Homebrew PRs for the relevant discussions: https://github.com/Homebrew/homebrew-core/pull/86408 and https://github.com/Homebrew/homebrew-core/pull/86446.
As a temporary workaround, we re-added our Package.resources
but this time pointing it to the generated bundle in the .build/
folder. Props to @tid-kijyun for the fix.
I am working to resolve this issue at tid-kijyun/Mint. It's already working in SwiftGen and my sample project, but I will do some more testing and create a PR.
SPM outputs a file named [package name]_[target name].bundle
when resources
is specified as a target in Package.swift. If resources
is specified for multiple targets, multiple bundles will be output, so Mint needs to figure out the dependency graph and copy only what it needs.
As documented in the Mint readme, SPM now supports resource bundles (since 5.3).
With SwiftGen 6.5 we've switched over to fully using SPM for this, but apparently during installation Mint is getting rid of the resource bundles:
Tried it locally as well, and indeed the build folder only contains:
Where it should contain:
To make things a bit spicier, we don't control the name of the bundle, we just use
Bundle.module
in Swift code. And in this specific case, it is a resource bundle for a framework the binary depends on (calledSwiftGenCLI
). It is defined here in Package.swift.