Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with including macros to project locally #1501

Open
timoninas opened this issue Sep 11, 2024 · 3 comments
Open

Problem with including macros to project locally #1501

timoninas opened this issue Sep 11, 2024 · 3 comments

Comments

@timoninas
Copy link

timoninas commented Sep 11, 2024

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

@2gury
Copy link

2gury commented Sep 12, 2024

I've the same problem recently. Could you make some resolution about it? 🙏

@timoninas
Copy link
Author

timoninas commented Sep 12, 2024

Hello, @yonaskolb!
I've seen this issue #1428
And thought you could help me with this issue or provide examples of including macros into the project/sdk package 🙏

@Lutzifer
Copy link
Contributor

@timoninas can you create a minimal example of your project as a repo to look at?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants