Hive
Macros cannot be expanded when using cache
GitHub issue · Open
What happened?
When I use tuist cache macros work, however they cannot be expanded
How do we reproduce it?
-
Download attached project framework_with_native_swift_macro.zip
-
tuist install
-
tuist generate
-
open Framework.swift
-
Right click on @Reducer -> Expand macro option is visible
-
tuist cache
-
tuist generate
-
Right click on @Reducer
Expected: Expand macro option is visible
Actual: Expand macro option is not visible
Error log
macOS version
14.1
Tuist version
4.3.4
Xcode version
15.2
Hi. I ran into this issue as well and I wonder if it will be addressed soon. I started using Mockable, https://github.com/Kolos65/Mockable.git, and if I cache this dependency I cannot expand the macros.
I also found a defect which is more serious, not sure if it is Tuist or Mockable, but when I use Mockable in a SPM package to create mocks, and try to import the Mock generated classes from the SPM module in another target (main app for example) the classes are not found, even if they are generated with public access control. I will try to make a project sample and create another issue.
Hi, @JaroVoltix. I’m Dosu, and I’m helping the tuist team manage their backlog and am marking this issue as stale.
Issue Summary:
- You reported that Swift macros fail to expand in Xcode when using Tuist cache, with the “Expand macro” option disappearing after caching.
- The problem occurs on macOS 14.1, Tuist 4.3.4, and Xcode 15.2.
- Other users have confirmed the issue and expressed frustration over the trade-off between macro expansion and binary caching.
- A maintainer suspects this might be an Xcode editor bug related to macros as compiled executables and is considering filing a radar with Apple.
- The issue is still under investigation with no resolution so far.
What’s Next:
- Please let me know if this issue is still relevant with the latest version of Tuist by commenting here to keep the discussion open.
- Otherwise, I will automatically close this issue in 7 days.
Thanks for your understanding and contribution!