bazelbuild / bazelbuild/rules_apple

`apple_bundle_import` w/ tree artifacts in `bundle_imports` misbehaves

Open
#2,070 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
593
Forks
334
Avg merge
16h 48m
Merged PRs (30d)
9

Description

I had a use case where I have a script that produces a `.bundle` directory, but I don't know the names of the files it would produce in it before executing the script. This seemed like a good reason to use a tree artifact (via `ctx.actions.declare_directory`). When passing the directory into `apple_bundle_import`'s `bundle_imports` field, it creates a bundle, but not in the same shape that the script produces. Let's say the rule that produces this bundle lives at `//subdir:some_bundle` and the directory it produces looks like this:

```
Some.bundle/
foo.txt
bar.txt
```

When this bundle is included in another bundle's resources (`ios_application`, etc), this bundle will instead look like this:

```
My.app/
Some.bundle/
subdir/
foo.txt
bar.txt
```

The bundle winds up having subdirectories corresponding to the package the rule lives in. This is perhaps a strange and uncommon use case, but gave an unexpected result, so I figured I'd file an issue.

Reproducible here: https://github.com/dflems/bazel-repro/tree/master/bundle-dir

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction at https://github.com/dflems/bazel-repro/tree/master/bundle-dir and trace how apple_bundle_import handles tree artifacts supplied through bundle_imports. Confirm the package-directory prefix in the generated bundle, then verify that the produced bundle preserves the tree artifact's original shape.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.