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

Error message on incorrect macro configuration on Package.swift #6135

Open
kelvinharron opened this issue Mar 29, 2024 · 2 comments
Open

Error message on incorrect macro configuration on Package.swift #6135

kelvinharron opened this issue Mar 29, 2024 · 2 comments
Labels
good first issue Good for newcomers type:bug Something isn't working

Comments

@kelvinharron
Copy link

kelvinharron commented Mar 29, 2024

What happened?

I've been enhancing our Swift project with Tuist Cloud and applying a Package.swift, defining the path to the local Swift Macro created through Xcode. I want to cache it and from feedback with Marek suggested our configuration is incorrect, but the error messaging could be improved to be more specific.

I can get around this error and successfully generate by using .external(name: "MyMacro", condition: .when([.ios])) but there are no references to MyMacro in the project as a result.

I have recreated the issue with the attached project. TuistMacroIssue.zip

How do we reproduce it?

  1. Open the attached sample project
  2. run tuist install
  3. run tuist generate
  4. observe the error

Error log

Target RecordModelMacro has platforms 'macOS' and product 'Swift Macro' and depends on target RecordModelMacros of type 'Swift Macro' and platforms 'macOS' which is an invalid or not yet supported combination.
Fatal linting issues found
Consider creating an issue using the following link: https://github.com/tuist/tuist/issues/new/choose

macOS version

14.4

Tuist version

4.8.1

Xcode version

15.3

@kelvinharron kelvinharron added the type:bug Something isn't working label Mar 29, 2024
@pepicrft
Copy link
Contributor

Quick question @kelvinharron. Do you plan to share the Swift Macro across projects that live in different repositories? Because if you don't, what we can do is to expose the Swift Macros API in ProjectDescription, and let you define Swift Macros with standard targets, instead of using Swift Packages for that. The business logic is there, just the documentation and the APIs are missing.

@pepicrft pepicrft added the good first issue Good for newcomers label Mar 31, 2024
@kelvinharron
Copy link
Author

Hey @pepicrft, we keep all our work in one repository, so exposing the Swift Macros API would be a big win for us.

Do you mean we could define a target through Tuist as product: .macro? I would love to be able to do this as it was my expectation we would be able to, and would be very happy to use my problem as a means to implement and document it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants