Hive
Add macro executables to file groups
GitHub issue · Open
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.
@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!
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).
@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!
@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.