Hive Hive
Sign in

tuist generate behaves differently for tags

GitHub issue · Open

Metadata
Source
tuist/tuist #8139
Updated
Jun 11, 2026
Domains
CLI Cache
Details

What happened?

Hi, I’m not sure if this is really a bug or not, but I encountered differences when running tuist generate for targets and for tags in conjunction with the cache.

How do we reproduce it?

I created this sample project, which contains the setup for an App with three framework targets. Note that target “FeatureC” is tagged with “c”.

  1. Warm the cache
  2. run tuist generate App FeatureC --binary-cache Expected result: FeatureC is not included as binary, but with sources

However if I focus on the tag: tuist generate App tag:c --binary-cache Unexpected result: FeatureC is included as binary

From the documentation of tuist generate I would expect them to behave similar.

ARGUMENTS:
<query> Targets to focus on, specified by name or tag query (e.g. ‘tag:feature’)

Error log

none

macOS version

15.4.1

Tuist version

4.65.6

Xcode version

16.4

Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments
D
dosubot[bot] Sep 3, 2025

Hi @Miiha! I’m Dosu and I’m helping the tuist team.

The difference you’re seeing between focusing on a target by name (App FeatureC) and by tag (App tag:c) with --binary-cache comes from how Tuist resolves queries internally. When you specify a target directly, Tuist treats it as a “focus target” and always builds it from sources, using binaries only for dependencies. When you use a tag, Tuist resolves all targets matching that tag, but the logic for which targets are treated as “focused” can diverge—sometimes resulting in those targets being replaced by binaries if the query resolution doesn’t mark them as focused in the same way as direct target names. This difference is rooted in the query parsing and graph traversal logic, not in the cache itself.

The documentation doesn’t explicitly call out this behavior, and it can be confusing because both approaches look similar on the surface docs. If you want to guarantee a target is built from sources, specifying it directly by name is the safest approach. If you need tag-based focus to behave identically, you may need to adjust your workflow or raise this as a feature request for more consistent handling.

Let me know if you want a deeper dive into the relevant code paths or have questions about workarounds!

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about tuist with Dosu Add Dosu to your team

M
Miiha Sep 3, 2025

@dosu From the docs it says:

<query> Targets to focus on, specified by name or tag query

So I was under the impression that querying by target name or by tag should lead to the same result — namely, that those targets get built from source. If that’s not how it’s intended to work, maybe the docs could spell it out a bit more clearly?

D
dosubot[bot] Sep 3, 2025

You’re right—based on the docs, it looks like querying by target name or tag should behave the same, with both approaches focusing those targets and building them from source. However, the actual implementation in Tuist treats these queries differently: direct target names are always marked as “focused” and built from source, while tag queries sometimes result in those targets being eligible for binary replacement if available in the cache. This subtle difference comes from how the query resolution logic works internally, and it’s not clearly explained in the documentation [docs].

If you want to guarantee source builds, specifying targets by name is the safest bet. The docs could definitely be clearer about this distinction—if you’d like, I can help draft a suggestion for a documentation update to make this behavior explicit.

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about tuist with Dosu Add Dosu to your team