bazel-ios / cocoapods-bazel

A Cocoapods plugin for automatically generating Bazel BUILD files
Apache License 2.0
110 stars 21 forks source link

dont expand glob for resources attribute #49

Closed hborawski closed 2 years ago

hborawski commented 2 years ago

As outlined in slack -> https://bazelbuild.slack.com/archives/CD3QY5C2X/p1638825357038200

someSpec.resources = 'path/to/folder`

Works fine in cocoapods and in Xcode, importing the folder, but was erroring out when building with bazel after generating with this plugin:

I/O exception during sandboxed execution: /private/var/tmp/_bazel_hborawski/1f6df4ad563028a25ba3a2ddabdedf60/sandbox/darwin-sandbox/897/execroot/<path/to/folder> (File exists)

Turns out it was expand_glob duplicating the path like:

data = glob([
            "path/to/folder",
            "path/to/folder/**/*",
chenxiao0228 commented 2 years ago

Thanks @hborawski !

Any chance you could add a test case for it?

hborawski commented 2 years ago

@chenxiao0228 There's an unrelated failure for me even running tests on master, but i think i added a case for it correctly?

I added a before/after for an app_spec using resources

chenxiao0228 commented 2 years ago

@hborawski sorry my bad.. I'll take a look into the checks.

hborawski commented 2 years ago

hmm im actually now not convinced this is the correct fix

some paths included in resources do need the expansion i think

i dont have issues with .xcassets expanding in the BUILD

data = glob(
            [
                "App/Resources/**/*.storyboard",
                "App/Resources/**/*.storyboard/**/*",
                "App/Resources/**/*.xib",
                "App/Resources/**/*.xib/**/*",
                "App/Resources/**/*.xcassets",
                "App/Resources/**/*.xcassets/**/*",
            ],
            exclude_directories = 0,
        ),

builds fine, but if i try to include a folder of JSON files, it behaves improperly

hborawski commented 2 years ago

I think this is actually caused by: https://github.com/bazel-ios/rules_ios/blob/8c3c7fe77ff69bbbe8861eed53ecf82461979ebc/rules/library/resources.bzl#L59