-
Notifications
You must be signed in to change notification settings - Fork 1.4k
refactor toolchain SwiftPM libraries path #3660
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
refactor toolchain SwiftPM libraries path #3660
Conversation
3e838b2
to
d0ae07b
Compare
@swift-ci please smoke test |
d0ae07b
to
6b48076
Compare
@swift-ci please smoke test |
if let pathEnvVariable = ProcessEnv.vars["SWIFTPM_CUSTOM_LIBS_DIR"] ?? ProcessEnv.vars["SWIFTPM_PD_LIBS"] { | ||
if ProcessEnv.vars["SWIFTPM_PD_LIBS"] != nil { | ||
print("SWIFTPM_PD_LIBS was deprecated in favor of SWIFTPM_CUSTOM_LIBS_DIR") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abertelrud @neonichu please note ^^, I think this new name makes more sense. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, this is clearer.
// Otherwise, fall back on the old location (this would indicate that we're using an old toolchain). | ||
return self.toolchain.libDir.appending(version.runtimeSubpath) | ||
|
||
// FIXME: how do we test this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abertelrud do you know how I can test this? otherwise I was able to test all scenarios I was aware of
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only way I can think of would be to use a test fixture and then invoke swift package
in a shell, setting the parameter and making sure that it gets used. One could probably even set it to a known broken location and checking for the error message due to its not finding PackageDescription et.al.
@swift-ci please smoke test macOS |
@swift-ci please smoke test |
var xctestLocation: AbsolutePath? | ||
// FIXME: the following logic is pretty fragile, but has always been this way | ||
// an alternative cloud be to force explicit locations to always be set explicitly when running in XCode/SwiftPM | ||
// debug and assert if not set but we detect that we are in this mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, though I think this code shouldn't be concerned at all with debug mode. It should know about the default locations, and just expose optional overrides that clients (including swift-build
etc) can use when they are built in debug mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that can be further refined in a later PR. This is a good improvement already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this cleanup!
@swift-ci please smoke test |
@swift-ci please smoke test |
@swift-ci please smoke test linux |
} | ||
|
||
public init(root: AbsolutePath) { | ||
self.init( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good convenience, I think. The idea was that if we add more of these, then the client (an IDE for example) should just be able to have a directory of support files, and then it's mostly SwiftPM's business what should be in that directory. So for a client to not have to enumerate these subdirectories in the default case is good.
f0bde26
to
3bdc59b
Compare
@swift-ci please smoke test |
this is waiting for Windows validation to be complete by @compnerd |
motivation: improve logic in how Manifest and Plugin APIs locations are derived changes: * rename fields on ToolchainConfiguration to better articulate their meaning * change logic in UserToolchain to derive the SwiftPM libraries path more clearly and reliably * adjust call-sites and test
3bdc59b
to
021db1a
Compare
rebased. @swift-ci please smoke test |
motivation: improve logic in how Manifest and Plugin APIs locations are derived
changes: