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

Add SDK and platform paths to plugin executables #1377

Merged
merged 2 commits into from Jun 16, 2023

Conversation

DougGregor
Copy link
Member

No description provided.

@DougGregor
Copy link
Member Author

@swift-ci please test

// Given a virtual path pointing into a toolchain/SDK/platform, produce the
// path to `swift-plugin-server`.
fileprivate var pluginServerPath: VirtualPath {
self.appending(components: "usr", "swift-plugin-server")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usr/bin?

Copy link
Contributor

@bnbarham bnbarham Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though seems like the rest don't have usr, so is this actually intended to be bin?

EDIT: Yeah, the root path below is "Developer", "usr" so I assume this should be bin.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right.

return
}

let jobs = try driver.planBuild().removingAutolinkExtractJobs()
XCTAssertEqual(jobs.count, 1)
let job = jobs.first!
XCTAssertTrue(job.commandLine.contains(.flag("-external-plugin-path")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth checking the path here 😅

if isFrontendArgSupported(.pluginPath) {
// Emit user-provided plugin paths, in order.
if isFrontendArgSupported(.externalPluginPath) {
try commandLine.appendAll(.pluginPath, .externalPluginPath, from: &parsedOptions)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we passing load-plugin-library and load-plugin-executable? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those also need to be handled in this same group, yes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah, those aren't being passed at all!

Improve on the prior implementation of adding SDK and platform external
plugin path arguments in a few ways:
* Only do this for Darwin, because other platforms don't have similar
abstractions at the moment
* Fix incorrect paths, because I had not written tests
* Add tests, because otherwise nobody should trust this code
* Make sure all of the command-line arguments for compiler plugins are
passed through to the frontend in the order they were provided
* Pass `-load-plugin-library` and `-load-plugin-executable` through to
the frontend
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test Windows

@DougGregor DougGregor merged commit 99d316a into apple:main Jun 16, 2023
3 checks passed
@DougGregor DougGregor deleted the executable-plugin-paths branch June 16, 2023 00:06
DougGregor added a commit to DougGregor/swift that referenced this pull request Jun 16, 2023
Corresponding to apple/swift-driver#1377, this
adds some default plugin paths for Darwin SDKs and platforms.
Fixes rdar://110819604.
DougGregor added a commit to DougGregor/swift that referenced this pull request Jun 16, 2023
Corresponding to apple/swift-driver#1377, this
adds some default plugin paths for Darwin SDKs and platforms.
Fixes rdar://110819604.
DougGregor added a commit to DougGregor/swift that referenced this pull request Jun 16, 2023
Corresponding to apple/swift-driver#1377, this
adds some default plugin paths for Darwin SDKs and platforms.
Fixes rdar://110819604.
DougGregor added a commit to DougGregor/swift that referenced this pull request Jun 16, 2023
Corresponding to apple/swift-driver#1377, this
adds some default plugin paths for Darwin SDKs and platforms.
Fixes rdar://110819604.
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.

None yet

4 participants