Conversation
Apply the needed changes to make builds succeed on Linux. Mainly this involves features missing on non-Apple systems: - URLResourceKey.volumeAvailableCapacityForImportantUsageKey is not available, so only .volumeAvailableCapacityKey is used. - The CryptoKit module is only available on Apple systems. The Crypto module can be used instead, which exposes the same API and wraps CryptoKit where available, and in the rest of cases uses a BoringSSL under the hood. - Linux Swift toolchains include a new FoundationNetworking module that contains some of the APIs previously available directly in Foundation. - URLError.downloadTaskResumeData is not available, download resumption is disabled on Linux. - The Hardware.registryProperty(for:) function always returns nil. - Using setbuf(__stdoutp, ...) does not build on Linux. - Shim autoreleasepool() functions are provided on Linux.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apply the needed changes to make builds succeed on Linux. Mainly this involves features missing on non-Apple systems:
URLResourceKey.volumeAvailableCapacityForImportantUsageKeyis not available, so only.volumeAvailableCapacityKeyis used.CryptoKitmodule is only available on Apple systems. The Crypto module can be used instead, which exposes the same API and wrapsCryptoKitwhere available, and in the rest of cases uses a BoringSSL under the hood.FoundationNetworkingmodule that contains some of the APIs previously available directly inFoundation.URLError.downloadTaskResumeDatais not available, download resumption is disabled on Linux.Hardware.registryProperty(for:)function always returnsnil.setbuf(__stdoutp, ...)does not build on Linux.autoreleasepool()functions are provided on Linux.My goal with this is to be able to inspect and download MacOS images on Linux at some point. This is only a first patch to check if there's interest, and there are a number of changes that would be good to do after this patch 😃
There are a few more changes that probably would be good to have for non-Apple systems (like using
$TMPDIRif defined with a fallback to/tmp), disabling generation of installer formats that require running MacOS tools (for examplehdiutil) which are not available elsewhere, and removing the need to run asroot(which will be fine to only do downloads).