Skip to content

[Macro] Precise macro plugin dependency during scanning #76732

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

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

cachemeifyoucan
Copy link
Contributor

@cachemeifyoucan cachemeifyoucan commented Sep 26, 2024

Teach dependency scanner to track precise dependencies for macro plugin:

  • Read the available public external macro module name from swift modules dependencies
  • Resolve the macro plugin in the dependency scanner using the search path option
  • Pass resolved plugin configuration to swift-frontend so no searching is needed during compilation

This also means if a macro plugin search path is not used, it will not cause an additional module variants due to the search path difference.

rdar://136682810

@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please smoke test

@cachemeifyoucan
Copy link
Contributor Author

Please test with following PR:
swiftlang/llvm-project#9345

@swift-ci please smoke test

@cachemeifyoucan
Copy link
Contributor Author

Please test with following PR:
swiftlang/llvm-project#9345

@swift-ci please smoke test

@cachemeifyoucan
Copy link
Contributor Author

ping

1 similar comment
@cachemeifyoucan
Copy link
Contributor Author

ping

@DougGregor
Copy link
Member

@rintaro you know the plugin infrastructure better than anyone

@cachemeifyoucan
Copy link
Contributor Author

@rintaro ping

Add flag `-load-resolved-plugin` to load macro plugin, which provides a
pre-resolved entry into PluginLoader so the plugins can be loaded based
on module name without searching the file system. The option is mainly
intended to be used by explicitly module build and the flag is supplied
by dependency scanner.
Teach dependency scanner to construct build commands using resolved
plugin search path option. This ensures the modules that do not have
access to the macro plugins will not have a different variant due to
different plugin search path.

rdar://136682810
@cachemeifyoucan
Copy link
Contributor Author

Please test with following PR:
swiftlang/llvm-project#9345

@swift-ci please smoke test

@cachemeifyoucan
Copy link
Contributor Author

Rebase the change and update the test to test the interaction between new options with the other options.

@cachemeifyoucan
Copy link
Contributor Author

@rintaro review feedback addressed.

@cachemeifyoucan cachemeifyoucan merged commit 0a18baa into swiftlang:main Nov 4, 2024
3 checks passed
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.

3 participants