yonaskolb / yonaskolb/XcodeGen
Problem with including macros to project locally
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 8.8k
- Forks
- 908
- Avg merge
- 17d 14h
- Merged PRs (30d)
- 2
Description
Here I try to include my macros locally into the project. But eventually have this issue in logs:
Error: external macro implementation type 'MyLocalMcr.MockekeMacro' could not be found for macro 'Mockeke()'
I'm using 2.42.0 XcodeGen
My yml config:
name: TemplateProject
options:
deploymentTarget:
iOS: "15.0"
settings:
base:
MARKETING_VERSION: 1.0
targetTemplates:
Framework:
type: framework
platform: iOS
settings:
BUILD_LIBRARY_FOR_DISTRIBUTION: true
info:
path: Info.plist
packages:
MyLocalMcr:
path: ./../MyLocalMcr // Here I try to include it
targets:
TemplateProjectDemo:
type: application
platform: iOS
deploymentTarget: "15.0"
info:
path: TemplateProjectDemo/Info.plist
properties:
NSAppTransportSecurity:
NSAllowsArbitraryLoads: true
sources:
- TemplateProjectDemo
dependencies:
- framework: Products/xc/TemplateProject.xcframework
- package: MyLocalMcr
linkType: static
destinationFilters: [iOS, macOS]
- framework: Products/xc/OtherFramework1.xcframework
- framework: Products/xc/OtherFramework1.xcframework
- framework: Products/xc/OtherFramework1.xcframework
Could you please provide examples: how to include macros into the project (as local package, or as target, etc)
Because I have faced it today and it's stumbling block for my project :(
MyLocalMcr is SPM package
import CompilerPluginSupport
import PackageDescription
let package = Package(
name: "MyLocalMcr",
platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .macCatalyst(.v13)],
products: [
.library(
name: "MyLocalMcr",
targets: ["MyLocalMcr"]
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax.git", from: "509.0.0")
],
targets: [
.macro(
name: "MyLocalMcrMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax")
]
),
.target(name: "MyLocalMcr", dependencies: ["MyLocalMcrMacros"])
]
)
XcodeGen macros error
Macros doesn't work with XcodeGen
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the provided XcodeGen YAML configuration and the MyLocalMcr Package.swift macro package. Trace how the local package and its macro target are represented in the generated Xcode project; done means the local macro can be included and invoked without the external macro implementation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100