MobileNativeFoundation / MobileNativeFoundation/rules_xcodeproj

Feature Request: Improved target focusing API

Open
#2,746 6 comments 3 reactions 1 assignee View on GitHub

@brentleyjones is already working on this.

Since Nov 29, 2023.

feature request
Dominant language
Swift
Stars
626
Forks
124
PR merge metrics
No merged PRs in 30d

Description

The current target focusing API (i.e. xcodeproj.focused_targets and xcodeproj.unfocused_targets) allows for focusing or unfocusing any target you want. They can be annoying to use though if you want to (un)focus a category of targets, such as entire repositories. I say annoying instead of impossible because with a generated BUILD file a query can list out all of the targets in a repository. This has negative performance implications as well, passing around and interacting with large data structures.

I propose that we improve the target focusing API to allow specifying some "more than one target" patterns. The rough idea is to allow more than just labels in the {un,}ocused_targets attributes:

xcodeproj(
    …
    unfocused_targets = [
        "@repo1//some:target",
        unfocused_targets(type = focusing_type.repository, pattern = "repo2"),
        unfocused_targets(type = focusing_type.name.suffix, pattern = "_mocks"),
        unfocused_targets(type = focusing_type.package.suffix, pattern = "_UI"),
        unfocused_targets(type = focusing_type.package.component, pattern = "Tests"),
    ],
    …
)

I'm not sure on the actual spelling of the API (e.g. maybe `unfocused_targets.package.component("Tests") or something instead?), but the idea of being able to specify these matching clarifications is the key thing. With incremental generation mode there is a single location that can do these sorts of matches, making it a lot easier to add this sort of feature.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.