bazelbuild / bazelbuild/rules_apple

.DS_Store inside *AppIcons.xcassets causes validation error

Open
#302 4 comments 0 reactions 0 assignees View on GitHub
P3 type: feature request
Dominant language
Starlark
Stars
593
Forks
334
Avg merge
16h 48m
Merged PRs (30d)
9

Description

If a user opens a `*AppIcons.xcassets` in the finder ( or creates a `.DS_Store` in some other way ), it will cause a validation error.

```
ERROR: /Users/jerrymarino/Projects/ios-review/Pinterest/iOS/App/BUILD:81:1: in ios_application rule //Pinterest/iOS/App:Pinterest: Traceback (most recent call last):
File "/Users/jerrymarino/Projects/ios-review/Pinterest/iOS/App/BUILD", line 81
ios_application(name = 'Pinterest')
File "/private/var/tmp/_bazel_jerrymarino/dab264afbccc7ab80d8809aaba91b923/external/build_bazel_rules_apple/apple/bundling/ios_rules.bzl", line 78, in _ios_application_impl
bundling_support.ensure_single_xcassets_type("app_icons", app_icons, "appiconset")
File "/private/var/tmp/_bazel_jerrymarino/dab264afbccc7ab80d8809aaba91b923/external/build_bazel_rules_apple/apple/bundling/bundling_support.bzl", line 322, in bundling_support.ensure_single_xcassets_type
_ensure_path_format(attr, files, [["xcassets", extension...], ...)
File "/private/var/tmp/_bazel_jerrymarino/dab264afbccc7ab80d8809aaba91b923/external/build_bazel_rules_apple/apple/bundling/bundling_support.bzl", line 407, in _ensure_path_format
fail(("%s, but found the following: %...)), ...)
attribute app_icons: Expected the xcassets directory to only contain files are in sub-directories with the extension appiconset, but found the following: [
Pinterest/iOS/App/Resources/ProdAppIcons.xcassets/.DS_Store
]
```

If we don't think this is a good idea to add a special case for `DS_Store` in the validation logic, I can add it to my rule:

```
ios_application(
name = "Pinterest",
app_icons = glob(["Resources/ProdAppIcons.xcassets/**"], exclude=["*.DS_Store"]),
```
but it seems suboptimal for everyone to have to add this.

Contributor guide

Open the contributing guide

Research direction

Start at bundling_support.ensure_single_xcassets_type and _ensure_path_format in the referenced apple bundling files, then trace how app_icons paths are validated. Reproduce the .DS_Store case and verify that an xcassets directory containing it no longer causes validation to fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.