Hive Hive
Sign in

Changes to macro plugin target from local package are not picked up without a clean build

GitHub issue · Open

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

What happened?

We have a local Swift package called LocalMacros in our repository which defines a series of macro plugins. This package is then pulled into our Tuist project however when making modifications to the macro plugin implementation, we find that the macro plugin is not being rebuild which is causing a frustrating developer experience because other engineers on the team find themselves facing obscure compiler errors until they perform a clean and build.

How do we reproduce it?

  1. Download macro-debug.zip
  2. Run tuist install && tuist generate
  3. Build and run the project, observe ‘1 + 2’ displayed on the screen
  4. Open LocalMacrosMacro.swift in the project, edit the return value of literal in some way
  5. Re-run the macro-debug target
  6. Observe that the text printed in the view has not changed to reflect your change
  7. Clean the project
  8. Re-run the macro-debug target
  9. Observe that the text printed is now reflecting your changes from step 4

Error log

N/A

macOS version

15.4.1 (24E263)

Tuist version

4.43.2

Xcode version

16.4.0

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
L
liamnichols Jun 19, 2025

Something interesting is that there are two LocalMacrosMacros binaries in DerivedData:

If I check with strings on each binary after updating the macro but not cleaning the project, the one in Debug-iphonesimulator has the correct changes in it, but the one in Debug does not.

So it seems that the binary is being rebuilt, just not correctly?

D
dosubot[bot] Jun 19, 2025

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

You’re right—what you’re seeing is that the macro binary is being rebuilt for the simulator (Debug-iphonesimulator), but not for the generic Debug directory, which is likely used for macOS or other destinations. This behavior comes from how Xcode and SwiftPM handle local package builds and up-to-date checks. Tuist sets up the build phases and copies macro executables as expected, but it relies on Xcode/SPM to decide when to rebuild local packages, including macros. There isn’t a custom invalidation or rebuild mechanism for local packages in Tuist, so if Xcode/SPM misses a change, a clean build is required to force a rebuild of the macro binary ref.

This is a known pain point and is essentially a limitation or bug in Xcode/SPM’s incremental build logic, not something Tuist can directly control ref. If you consistently see this, the only reliable workaround is to clean before building when you change macro code. Some users have found that removing custom SDK flags (like -sdk iphonesimulator) can help Xcode pick up changes more reliably, but results may vary ref.

If you haven’t already, make sure your macros and plugins are declared using the correct types in your Tuist manifest and that your project setup matches the recommended integration. But ultimately, the need for a clean build after macro changes is a limitation of the current Xcode/SPM toolchain.

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

P
pepicrft Jun 23, 2025

@liamnichols I did some debugging here. With the standard macro graph “App > Macro framework > Macro executable”, Xcode is unable to invalidate Macro framework and App when the executable changes, and because of that changes don’t show up incrementally. I’d have expected Xcode to detect that and re-trigger the compilation of the Swift files that depend on the macro, but that’s unfortunately not the case.

I’m afraid we won’t be able to solve this without a hack. Xcode’s probably handling this scenario for the SwiftPM’s integration, but they haven’t thought about supporting it across the board. Have you considered having example targets where people can iterate on the macros cleaning when changing the files? It’s a bit annoying, I know, but until we can figure something out or Xcode handles that gracefully, it will alleviate the pain a bit.

Also… if you have ideas having the context now, you can try to play with build settings and phases until you find the right setup that works incrementally. If you find it, I can happily incorporate that into Tuist.