Skip to content

Conditionalize use of .withoutEscapingSlashes #2993

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
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions Sources/PackageLoading/ManifestLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,11 @@ public final class ManifestLoader: ManifestLoaderProtocol {

let encoder = JSONEncoder()
if #available(macOS 10.15, *) {
#if os(macOS)
encoder.outputFormatting = [.sortedKeys, .withoutEscapingSlashes]
#else // `.withoutEscapingSlashes` is not in 5.3 on non-Darwin platforms
Copy link
Member

@federicobucchi federicobucchi Oct 22, 2020

Choose a reason for hiding this comment

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

Can we please move the comment // .withoutEscapingSlashes is not in 5.3 on non-Darwin platforms at the #if os(macOS) like for /PIFBuilder.swift ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

There doesn't seem to be a way to conditionalize on the patch component of the version, which means that this would still fail on older toolchains. Or should this PR not be taken once the Foundation fix is in the latest 5.3 toolchains?

encoder.outputFormatting = [.sortedKeys]
#endif
}

try keyHash.withData {
Expand Down
2 changes: 2 additions & 0 deletions Sources/XCBuildSupport/PIFBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public final class PIFBuilder {
encoder.outputFormatting.insert(.sortedKeys)
}
if #available(macOS 10.15, *) {
#if os(macOS) // `.withoutEscapingSlashes` is not in 5.3 on non-Darwin platforms
encoder.outputFormatting.insert(.withoutEscapingSlashes)
#endif
}
#endif
}
Expand Down