Skip to content

Import the Foundation overlay codebase from the Swift repository #2915

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 1,591 commits into from
Nov 11, 2020

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Oct 31, 2020

This PR imports the Foundation overlay codebase from the Swift compiler repository up to commit 7f2185d3 on 2020-10-28.

This includes the associated regression tests (ported to XCTest), and comes complete with a working Xcode project file to build the overlay.

The intention is that the Foundation overlay will be maintained in this repository from now on; the original codebase will be removed from the Swift repo once we teach the compiler's build system to pick up the overlay from here.

Note that while there is significant overlap in the functionality, implementations and test cases between swift-corelibs-foundation and the Foundation overlay, this particular PR makes no effort to share code or run unified tests across the two projects.


To build the overlay, you currently need to point Xcode to a local build of the Swift compiler & stdlib by manually overriding the SWIFT_EXEC and SWIFT_LIBRARY_PATH build settings to the location of your custom Swift compiler executable and Swift standard library, respectively:

env SWIFT_EXEC=.../build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swiftc \
  SWIFT_LIBRARY_PATH=.../build/Ninja-ReleaseAssert/swift-macosx-x86_64/lib/swift/macosx \
  xcodebuild

(Replacing macosx with the platform you're targeting, as needed.)


This PR preserves the full commit history of the imported files, including attribution and commit messages. However, as this is a partial import, you cannot build the Foundation overlay from historical commits -- you'll need to use the Swift repository for
that.

The Swift repository's mailmap file as of the commit above was used to update/fix author names and email addresses.

Resolves rdar://70903483.

pitiphong-p and others added 30 commits December 8, 2018 13:39
Protocols in resilient libraries that wish to provide a default implementation of hashing need to do so by providing a hash(into:) implementation.

hashValue has been deprecated as a Hashable requirement in SE-0206. Implementing only it in a protocol extension curses conforming types to get deprecation warnings by default.
…alue/_rawHashValue

The compiler-synthesized / stdlib-provided default implementations seem perfectly fine for these.
…ntation

These implementations did not produce the same hash values as the raw value. RawRepresentable provides a correct hashing implementation by default, so let’s just use that.
As seen in swift crashers while building swiftlang/swift#20103
…itly know that it is 64 bit; this allows for better portability (#21290)
…t explicitly know that it is 64 bit; this allows for better portability (#21290)"

This reverts commit c7be592.
…ility-in-tests

Add #available checks for NSKeyedArchiver methods in tests
shahmishal and others added 15 commits September 22, 2020 23:53
appendingPathComponent(:isDirectory:) should account for isDirectory
These special symbols instruct the linker to load these overlay dylibs from the rpath on OS versions that shipped before the Swift 5 release. Apps targeting these versions ship with a special build of the stdlib & overlays in their bundle.
This PR imports the Foundation overlay codebase from the Swift
compiler repository up to commit 7f2185d3 on 2020-10-28.

swiftlang/swift@7f2185d

This includes the associated regression tests (ported to XCTest), and
comes complete with a working Xcode project file to build the overlay.

The intention is that the Foundation overlay will be maintained in
this repository from now on; the original codebase will be removed
from the Swift repo once we teach the compiler's build system to pick
up the overlay from here.

Note that while there is significant overlap between functionality,
implementations and test cases between swift-corelibs-foundation and
the Foundation overlay, this particular PR makes no effort to share
code or run unified tests across the two projects.

* * *

To build the overlay, you currently need to point Xcode to a local
build of the Swift compiler & stdlib by manually overriding the
SWIFT_EXEC and SWIFT_LIBRARY_PATH build settings to the location of
your custom Swift compiler executable and Swift standard library,
respectively:

env SWIFT_EXEC=.../build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swiftc \
  SWIFT_LIBRARY_PATH=.../build/Ninja-ReleaseAssert/swift-macosx-x86_64/lib/swift/macosx \
  xcodebuild

(Replacing `macosx` with the platform you're targeting, as needed.)

* * *

This PR preserves the full commit history of the imported files,
including attribution and commit messages. However, as this is a
partial import, you cannot build the Foundation overlay from
historical commits -- you'll need to use the Swift repository for
that.

The Swift repository's mailmap file as of the commit above was used to
update/fix author names and email addresses.
@lorentey lorentey requested review from millenomi and edymtt October 31, 2020 00:10
@millenomi
Copy link
Contributor

All: we are moving things around so that Foundation sources are all together, for both Darwin and off-Darwin.

@millenomi
Copy link
Contributor

cc @parkera

@millenomi
Copy link
Contributor

@swift-ci please test

@millenomi
Copy link
Contributor

@lorentey LGTM

@millenomi
Copy link
Contributor

@lorentey Let's give @parkera time to respond before we land.

@lorentey
Copy link
Member Author

Note: The bits that don't come verbatim from the Swift repository are isolated in the last dozen or so commits:

https://github.com/apple/swift-corelibs-foundation/pull/2915/files/c7485fb359db306fb73679a2ae1e7444cf1a66d1..b46360970814d1a83de9bc120027f86037494a4b

@millenomi
Copy link
Contributor

@swift-ci please test

@lorentey
Copy link
Member Author

lorentey commented Nov 2, 2020

@swift-ci test linux platform

1 similar comment
@lorentey
Copy link
Member Author

lorentey commented Nov 3, 2020

@swift-ci test linux platform

@spevans
Copy link
Contributor

spevans commented Nov 4, 2020

@swift-ci test linux

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.