Hive
Macro in combination with dynamic frameworks do not generate
GitHub issue · Open
What happened?
This is particularly in reference to The Composable Architecture. I have my project currently configured based on Tuist recommendations here: https://tuist.dev/en/docs/guides/features/projects/dependencies#the-composable-architecture
The issue I faced is that since swift-case-paths version 1.8.0, TCA has converted the CasePathsMacrosSupport library to be a macro. So after upgrading the libraries to that version I am seeing this error:
Target SwiftNavigationMacros has platforms 'macOS' and product 'Swift Macro' and depends on target CasePathsMacrosSupport of type 'dynamic framework' and platforms 'macOS' which is an invalid or not yet supported combination.
Target CasePathsMacros has platforms 'macOS' and product 'Swift Macro' and depends on target CasePathsMacrosSupport of type 'dynamic framework' and platforms 'macOS' which is an invalid or not yet supported combination.
The problem lies in that the CasePathsMacrosSupport cannot be dynamic. The solution I’ve found currently is adding this line
"CasePathsMacrosSupport": .staticFramework,
to the existing dependency configuration to pin that macro to a static framework. However I wonder if there’s any configuration that can be done so that macros target types are automatically pinned to static? At the very least i can open up a PR to update the TCA section of the dependencies doc.
How do we reproduce it?
I can’t seem to attach a zip file of my project, but this is the project config and the Package.swift file:
import ProjectDescription
let project = Project(
name: "TuistTCADebug",
targets: [
.target(
name: "TuistTCADebug",
destinations: .iOS,
product: .app,
bundleId: "dev.tuist.TuistTCADebug",
infoPlist: .extendingDefault(
with: [
"UILaunchScreen": [
"UIColorName": "",
"UIImageName": "",
],
]
),
buildableFolders: [
"Sources/TuistTCADebug/Sources",
"Sources/TuistTCADebug/Resources",
],
dependencies: [
.target(name: "Module"),
]
),
.target(
name: "TuistTCADebugTests",
destinations: .iOS,
product: .unitTests,
bundleId: "dev.tuist.TuistTCADebugTests",
infoPlist: .default,
buildableFolders: [
"Sources/TuistTCADebug/Tests"
],
dependencies: [.target(name: "TuistTCADebug")]
),
.target(
name: "Module",
destinations: [.iPhone],
product: .framework,
bundleId: "dev.tuist.TuistTCADebug-Module",
buildableFolders: ["Sources/Module/Sources"],
dependencies: [
.external(name: "ComposableArchitecture"),
]
)
]
)
// swift-tools-version: 6.0
import PackageDescription
#if TUIST
import struct ProjectDescription.PackageSettings
let packageSettings = PackageSettings(
// Customize the product types for specific package product
// Default is .staticFramework
// productTypes: ["Alamofire": .framework,]
productTypes: [
"Alamofire": .framework,
"AnyCodable": .framework,
"CasePaths": .framework,
"CasePathsCore": .framework,
// Must be static framework as this is a macro not a target in TCA
// "CasePathsMacrosSupport": .staticFramework,
"Clocks": .framework,
"CombineSchedulers": .framework,
"ComposableArchitecture": .framework,
"ConcurrencyExtras": .framework,
"CustomDump": .framework,
"Dependencies": .framework,
"DependenciesTestSupport": .framework,
"IdentifiedCollections": .framework,
"InternalCollectionsUtilities": .framework,
"IssueReporting": .framework,
"IssueReportingPackageSupport": .framework,
"IssueReportingTestSupport": .framework,
"OrderedCollections": .framework,
"Perception": .framework,
"PerceptionCore": .framework,
"Sharing": .framework,
"SnapshotTesting": .framework,
"SwiftNavigation": .framework,
"SwiftUINavigation": .framework,
"UIKitNavigation": .framework,
"XCTestDynamicOverlay": .framework
],
targetSettings: [
"ComposableArchitecture": .settings(base: [
"OTHER_SWIFT_FLAGS": ["-module-alias", "Sharing=SwiftSharing"]
]),
"Sharing": .settings(base: [
"PRODUCT_NAME": "SwiftSharing",
"OTHER_SWIFT_FLAGS": ["-module-alias", "Sharing=SwiftSharing"]
])
]
)
#endif
let package = Package(
name: "TuistTCADebug",
dependencies: [
.package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "1.26.2"),
// Add your own dependencies here:
// .package(url: "https://github.com/Alamofire/Alamofire", from: "5.0.0"),
// You can read more about dependencies here: https://docs.tuist.io/documentation/tuist/dependencies
]
)
To reproduce it the issue, just make a project and the folders specified above (I had just a blank Test.swift file in Sources/Module/Sources). Then install, and run generate you should run into the issue. I can also email the zip over since it doesn’t seem to be attaching.
Error log
Target CasePathsMacros has platforms 'macOS' and product 'Swift Macro' and depends on target CasePathsMacrosSupport of type 'dynamic framework' and platforms 'macOS' which is an invalid or not yet supported combination.
Target SwiftNavigationMacros has platforms 'macOS' and product 'Swift Macro' and depends on target CasePathsMacrosSupport of type 'dynamic framework' and platforms 'macOS' which is an invalid or not yet supported combination.
macOS version
26.5.1
Tuist version
4.206.0
Xcode version
26.5
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.
No GitHub comments yet.