Skip to content

Revert "Support macros when cross-compiling" #7349

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

Closed
wants to merge 1 commit into from

Conversation

DougGregor
Copy link
Member

Reverts #7118. It is causing the swift-syntax Examples to fail to build. See https://ci.swift.org/job/oss-swift-incremental-RA-macos/4247/

@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@MaxDesiatov the swift-syntax "Examples" package is failing to build with this error:

/home/build-user/swift-syntax/Examples/Tests/MacroExamples/Implementation/ComplexMacros/DictionaryIndirectionMacroTests.swift:13:8: error: no such module 'MacroExamplesImplementation'
import MacroExamplesImplementation
^
note: module 'MacroExamplesImplementation' is a macro, and cannot be imported by tests and other targets
error: fatalError
Error: Command failed with non-zero exit code 1:

@MaxDesiatov
Copy link
Contributor

MaxDesiatov commented Feb 19, 2024

I think I can come up with a proper fix for this quickly and we can avoid reverting this 🙏

MaxDesiatov added a commit that referenced this pull request Feb 19, 2024
`assertMacroExpansion` requires macros to be compiled for target platform and evaluated in-process. We can't handle the case of indirect macro dependencies cleanly, those will be still compiled for the host. Supersedes #7349.
@MaxDesiatov
Copy link
Contributor

MaxDesiatov commented Feb 19, 2024

I have a fix that doesn't require a revert for it here #7350

MaxDesiatov added a commit that referenced this pull request Feb 20, 2024
`assertMacroExpansion` requires macros to be compiled for target
platform and evaluated in-process. We can't handle the case of indirect
macro dependencies cleanly, those will be still compiled for the host.
Supersedes #7349.

This doesn't contain tests to expedite the fix and unblock broken CI
jobs, but I've verified locally that test products of the `Examples`
package in `apple/swift-syntax` repo can be built successfully and these
tests all pass.
@MaxDesiatov
Copy link
Contributor

MaxDesiatov commented Feb 20, 2024

That error is no longer reproducible for me locally when running SwiftPM on the swift-syntax/Examples package, and also with the full utils/build-script invocation identical to the one used on CI. Maybe there's something cached on the CI node that gets in the way? I've triggered clean builds on an impacted apple/swift-syntax PR.

@MaxDesiatov
Copy link
Contributor

MaxDesiatov commented Feb 20, 2024

As this accumulated conflicts, I'm closing it in favor of a bigger revert in #7352

@MaxDesiatov MaxDesiatov deleted the revert-7118-maxd/cross-compile-macros branch February 20, 2024 19:30
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
`assertMacroExpansion` requires macros to be compiled for target
platform and evaluated in-process. We can't handle the case of indirect
macro dependencies cleanly, those will be still compiled for the host.
Supersedes swiftlang#7349.

This doesn't contain tests to expedite the fix and unblock broken CI
jobs, but I've verified locally that test products of the `Examples`
package in `apple/swift-syntax` repo can be built successfully and these
tests all pass.
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
`assertMacroExpansion` requires macros to be compiled for target
platform and evaluated in-process. We can't handle the case of indirect
macro dependencies cleanly, those will be still compiled for the host.
Supersedes swiftlang#7349.

This doesn't contain tests to expedite the fix and unblock broken CI
jobs, but I've verified locally that test products of the `Examples`
package in `apple/swift-syntax` repo can be built successfully and these
tests all pass.
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

Successfully merging this pull request may close these issues.

2 participants