Hive Hive
Sign in

Add macro executables to file groups

GitHub issue · Open

Metadata
Source
tuist/tuist #5898
Updated
Jun 11, 2026
Domains
Generated projects
Details

We introduced a new TargetDependency type, TargetDependency.macro, which we use internally for binary-caching of macros. However, we forgot to extend the file groups creation to include it in a file group so that developers can see that the file is part of their project.

Comments
Y
YIshihara11201 Jun 19, 2025

@pepicrft Hi! I’d like to take on this issue and work on a fix.

P
pepicrft Jun 19, 2025

@YIshihara11201 all yours :)!

Y
YIshihara11201 Jun 20, 2025

@pepicrft

Hi! I’m working on the issue regarding TargetDependency.macro not being included in the file groups. To clarify the current behavior, could you tell me:

Are there any existing cases where Tuist includes cached files in file groups for other TargetDependency types (e.g. .framework, .xcframework, .package, etc.), excluding .macro?

I’d like to ensure I follow the correct approach when adding .macro-related files to the project structure. Thanks in advance!

P
pepicrft Jun 20, 2025

Are there any existing cases where Tuist includes cached files in file groups for other TargetDependency types (e.g. .framework, .xcframework, .package, etc.), excluding .macro?

Not that I can think of. You’ll notice there’s a place in the codebase where we create the files for all the project references, so in that place we should also account for macros (they are executables in the end).

Y
YIshihara11201 Jun 21, 2025

@pepicrft

Hi! I tried to reproduce the issue (i.e. the macro not being added to the file group, where I believe it should be Products).

Here’s what I did to verify:

  • Added a macro target in Project.swift
.target(
name: "Macro",
destinations: .iOS,
product: .macro,
bundleId: "io.tuist.Macro",
infoPlist: .extendingDefault(with: [:]),
sources: "Macro/**",
dependencies: [
],
metadata: .metadata(tags: ["Macro"])
)
  • Ran tuist generate
  • Checked the Xcode navigator to see if the Products group contains the macro executable

It looks like this behavior is already working as expected. Please let me know if there’s anything else I should check!

P
pepicrft Jun 23, 2025

I’ll add a third-party macro to the project using Tuist’s integration, and then check if the executable of that macro is added to the products.

Y
YIshihara11201 Sep 2, 2025

@pepicrft To confirm my understanding: The problem is that the macro executables, which are ultimately loaded by -load-plugin-executable flag, aren’t referenced in file groups.

The outcome after fix would be like the following image (I did some experiments), am I understanding correctly ?


P.S. https://github.com/tuist/tuist/pull/5834 is the PR preceding this issue.