Skip to content

Make the lookup of the PackageDescription dylib fall back on the versioned location if needed #3560

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Sources/PackageLoading/ManifestLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,18 @@ public final class ManifestLoader: ManifestLoaderProtocol {
/// Returns the runtime path given the manifest version and path to libDir.
private func runtimePath(for version: ToolsVersion) -> AbsolutePath {
// Bin dir will be set when developing swiftpm without building all of the runtimes.
return resources.binDir ?? resources.libDir.appending(component: "ManifestAPI")
if let binDir = resources.binDir {
return binDir
}

// Otherwise we use the standard location of the manifest API in the toolchain, if it exists.
let manifestAPIDir = resources.libDir.appending(component: "ManifestAPI")
if localFileSystem.exists(manifestAPIDir) {
return manifestAPIDir
}

// Otherwise, fall back on the old location (this would indicate that we're using an old toolchain).
Copy link
Contributor

Choose a reason for hiding this comment

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

should we emit some warning in this case, or is it valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is valid. It's due to the different locations of PackageDescription, both of which are valid, but are different depending on whether the toolchain has the unified implementation or not.

return resources.libDir.appending(version.runtimeSubpath)
}

/// Returns path to the manifest database inside the given cache directory.
Expand Down