-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for other resource file extensions such as .stencil
and .png
#1028
Comments
.stencil
and .png
.stencil
and .png
I just noticed
|
Not sure.
Is this in the |
@cgrindel Thank you for taking time to reply. Very much appreciated 👍 The resources are in one of the dependencies. |
By any chance is this dependency publicly available, it would be great to add a repro to one of the examples in this repository. |
Hi @cgrindel 👋 I published an example dependency for use in attempting to repro my issue: https://github.com/tinder-cfuller/rspm-example Since After following the latest instructions in the README, I am receiving the following error:
If I manually add
I have attached my sample executable project: This can be executed via SPM directly with:
Which will output:
For reference, I ultimately expect to validate by executing:
May you please help me to fix the error I am receiving so I am then able to continue to repo my original issue. Thank you! |
@cgrindel Looking through the source code, I found usage of
With this in place, I am able to execute:
But this fails with the same bundle error I reported:
Here is the up-to-date sample executable project: Now that we have a repro example in place, may you please help diagnose the resources issue? Thank you! Note The repro example is only setup for a As a reminder, I believe that |
I just put up #1185 to clarify when one needs to specify that attribute. Can you review and let me know if that helps? Regarding the resource issue, I will take a look now that we have a repro. Thanks! |
@cgrindel Thank you! |
Hi @cgrindel 👋 I am kindly checking in to see whether you can please look into this issue? |
Sorry for the delay, @tinder-cfuller. I am a bit behind on my open-source work. I'll try to look at it this weekend. |
There are a couple of issues. First, to use resources with Bazel-built Apple applications, you must use a Second: However, as @tinder-cfuller rightly points out, SPM allows you to create a command-line application that can access resources. Unfortunately, macos_command_line_application does not. In theory, I think that we need to update load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load("@rules_apple//apple:macos.bzl", "macos_command_line_application")
load(
"@rules_apple//apple:versioning.bzl",
"apple_bundle_version",
)
swift_library(
name = "ExampleExecutableLib",
srcs = ["ExampleExecutable.swift"],
module_name = "ExampleExecutable",
visibility = ["//visibility:public"],
deps = ["@swiftpkg_rspm_example//:ExampleLibrary"],
)
apple_bundle_version(
name = "CommandLineSwiftVersion",
build_version = "1.0",
)
macos_command_line_application(
name = "ExampleExecutable",
bundle_id = "com.example.command-line-swift",
infoplists = [":Info.plist"],
minimum_os_version = "10.13",
version = ":CommandLineSwiftVersion",
deps = [":ExampleExecutableLib"],
) @brentleyjones @luispadron Do you have thoughts on adding resource bundle support to |
Thank you @cgrindel 👍 Very much appreciated! And just for my own Bazel learning, may you please clarify, would the example Bazel config you provided ultimately be code generated just like the Also, are we sure that |
Yes and no. It will generate the
Great. FYI. Per a request from the community, I am working to separate the Gazelle plugin from the
Well, all of the Apple bundle support is implemented in
By any change, did you try your example on Linux? Did it work? If so, that could be a good argument for adding the resource bundling to the Swift Bazel rules. 🤷♂️ @brentleyjones @luispadron Do you have any thoughts on this? |
How to include
.stencil
and.png
resources in bundle?Target resources are defined as
resources: [.process("Resources")]
, and when building with SPM natively, all files are copied to bundle. I could be wrong, but I believe that.process()
includes all files, regardless of file type/extension, while performing optimizations for specific types/extensions.FWIW,
resources: [.copy("Resources/Image.png")]
is also not working.In both cases, the following error is reported when running the executable target:
Any help or suggestions are welcome. Thank you!
The text was updated successfully, but these errors were encountered: