-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Is there a way to generate .bundle file for iOS project? #1483
Comments
If you want to include a bundle which already exists in your binary, then you can do so by adding an apple_resource rule with If some of the contents of the bundle are unknown though (like they are the output of another build step), then putting together a bundle is a bit more difficult. Buck currently doesn't have anything set up, although since a Something like this:
My bash-foo is weak, but theres probably a bash one-liner to copy all sources to the out folder. Anyway, a genrule like that will let you generate a bundle and then you can build it with There is also the |
This is the way I managed: # here, name is created as <module_name> + "Resources"
genrule_name = name + "GenRule"
native.genrule(
name = genrule_name,
srcs = files,
out = name + ".bundle",
cmd = "mkdir $OUT && cp $SRCS $OUT",
)
native.apple_resource(
name = name,
dirs = [":" + genrule_name],
) And then in the code you access the resources as follows: let moduleName = String(reflecting: SomeClass.self).components(separatedBy:".").first!
let resourceBundleName = moduleName + "Resources"
let bundleURL = Bundle.main.url(forResource: resourceBundleName, withExtension: "bundle")!
let bundle = Bundle(url: bundleURL)!
let textFilePath = bundle.url(forResource: "text_file", withExtension: "txt") For more details see https://github.com/acecilia/BazelVSBuckSample |
I don't really understand with this genrules
This creates |
I have a project contains several resource files such as png、xib and plist etc. I want to generate the output files as a static library: .a file and a resource bundle file: .bundle file.
I check the apple_resource and apple_library rule, it seems that it can only generate the single .a static library file, but the apple_resource doesn't generate any output file. Is there a way to do that?
The text was updated successfully, but these errors were encountered: