Skip to content

Commit 4e65573

Browse files
authored
Merge pull request #14 from apple/master
merge
2 parents dfe4d5f + ef05d6e commit 4e65573

File tree

3,047 files changed

+433617
-149250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,047 files changed

+433617
-149250
lines changed

.flake8

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ filename = *.py,
2323
./utils/recursive-lipo,
2424
./utils/round-trip-syntax-test,
2525
./utils/rth,
26+
./utils/run-remote,
2627
./utils/run-test,
2728
./utils/scale-test,
2829
./utils/submit-benchmark-results,

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ compile_commands.json
5353
SortedCFDatabase.def
5454
htmlcov
5555
.coverage
56+
/benchmark/scripts/Benchmark_Driverc

CHANGELOG.md

+83-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,70 @@ CHANGELOG
2424
Swift 5.0
2525
---------
2626

27+
* [SR-7251][]:
28+
29+
In Swift 5 mode, attempting to declare a static property with the same name as a
30+
nested type is now always correctly rejected. Previously, it was possible to
31+
perform such a redeclaration in an extension of a generic type.
32+
33+
For example:
34+
```swift
35+
struct Foo<T> {}
36+
extension Foo {
37+
struct i {}
38+
39+
// compiler error: Invalid redeclaration of 'i'
40+
// (prior to Swift 5, this did not produce an error)
41+
static var i: Int { return 0 }
42+
}
43+
```
44+
45+
* [SR-4248][]:
46+
47+
In Swift 5 mode, when casting an optional value to a generic placeholder type,
48+
the compiler will be more conservative with the unwrapping of the value. The
49+
result of such a cast now more closely matches the result you would get in a
50+
non-generic context.
51+
52+
For example:
53+
```swift
54+
func forceCast<U>(_ value: Any?, to type: U.Type) -> U {
55+
return value as! U
56+
}
57+
58+
let value: Any? = 42
59+
print(forceCast(value, to: Any.self))
60+
// prints: Optional(42)
61+
// (prior to Swift 5, this would print: 42)
62+
63+
print(value as! Any)
64+
// prints: Optional(42)
65+
```
66+
67+
* [SE-0227][]:
68+
69+
Key paths now support the `\.self` keypath, which is a `WritableKeyPath`
70+
that refers to its entire input value:
71+
72+
```swift
73+
let id = \Int.self
74+
75+
var x = 2
76+
print(x[keyPath: id]) // prints 2
77+
x[keyPath: id] = 3
78+
print(x[keyPath: id]) // prints 3
79+
```
80+
81+
* [SE-0214][]:
82+
83+
Renamed the `DictionaryLiteral` type to `KeyValuePairs`.
84+
A typealias preserves the old name for compatibility.
85+
86+
* [SR-2608][]
87+
88+
Default arguments are now printed in SourceKit-generated interfaces for Swift
89+
modules, instead of just using a placeholder `default`.
90+
2791
* Notable bug fix: unowned and unowned(unsafe) variables now support optional
2892
types.
2993

@@ -62,6 +126,8 @@ Swift 5.0
62126
Swift 4.2
63127
---------
64128

129+
### 2018-09-17 (Xcode 10.0)
130+
65131
* [SE-0194][]
66132

67133
The new CaseIterable protocol describes types which have a static
@@ -267,8 +333,6 @@ Swift 4.2
267333
conditionally conforms to `P`, will succeed when the conditional
268334
requirements are met.
269335

270-
**Add new entries to the top of this section, not here!**
271-
272336
Swift 4.1
273337
---------
274338

@@ -7142,6 +7206,20 @@ Swift 1.0
71427206
[SE-0210]: <https://github.com/apple/swift-evolution/blob/master/proposals/0210-key-path-offset.md>
71437207
[SE-0211]: <https://github.com/apple/swift-evolution/blob/master/proposals/0211-unicode-scalar-properties.md>
71447208
[SE-0212]: <https://github.com/apple/swift-evolution/blob/master/proposals/0212-compiler-version-directive.md>
7209+
[SE-0213]: <https://github.com/apple/swift-evolution/blob/master/proposals/0213-literal-init-via-coercion.md>
7210+
[SE-0214]: <https://github.com/apple/swift-evolution/blob/master/proposals/0214-DictionaryLiteral.md>
7211+
[SE-0215]: <https://github.com/apple/swift-evolution/blob/master/proposals/0215-conform-never-to-hashable-and-equatable.md>
7212+
[SE-0216]: <https://github.com/apple/swift-evolution/blob/master/proposals/0216-dynamic-callable.md>
7213+
[SE-0217]: <https://github.com/apple/swift-evolution/blob/master/proposals/0217-bangbang.md>
7214+
[SE-0218]: <https://github.com/apple/swift-evolution/blob/master/proposals/0218-introduce-compact-map-values.md>
7215+
[SE-0219]: <https://github.com/apple/swift-evolution/blob/master/proposals/0219-package-manager-dependency-mirroring.md>
7216+
[SE-0220]: <https://github.com/apple/swift-evolution/blob/master/proposals/0220-count-where.md>
7217+
[SE-0221]: <https://github.com/apple/swift-evolution/blob/master/proposals/0221-character-properties.md>
7218+
[SE-0222]: <https://github.com/apple/swift-evolution/blob/master/proposals/0222-lazy-compactmap-sequence.md>
7219+
[SE-0223]: <https://github.com/apple/swift-evolution/blob/master/proposals/0223-array-uninitialized-initializer.md>
7220+
[SE-0224]: <https://github.com/apple/swift-evolution/blob/master/proposals/0224-ifswift-lessthan-operator.md>
7221+
[SE-0225]: <https://github.com/apple/swift-evolution/blob/master/proposals/0225-binaryinteger-iseven-isodd-ismultiple.md>
7222+
[SE-0226]: <https://github.com/apple/swift-evolution/blob/master/proposals/0226-package-manager-target-based-dep-resolution.md>
71457223

71467224
[SR-106]: <https://bugs.swift.org/browse/SR-106>
71477225
[SR-419]: <https://bugs.swift.org/browse/SR-419>
@@ -7151,3 +7229,6 @@ Swift 1.0
71517229
[SR-2131]: <https://bugs.swift.org/browse/SR-2131>
71527230
[SR-2388]: <https://bugs.swift.org/browse/SR-2388>
71537231
[SR-2394]: <https://bugs.swift.org/browse/SR-2394>
7232+
[SR-2608]: <https://bugs.swift.org/browse/SR-2608>
7233+
[SR-4248]: <https://bugs.swift.org/browse/SR-4248>
7234+
[SR-7251]: <https://bugs.swift.org/browse/SR-7251>

CMakeLists.txt

+32-20
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ set(SWIFT_ANDROID_NDK_PATH "" CACHE STRING
187187
"Path to the directory that contains the Android NDK tools that are executable on the build machine")
188188
set(SWIFT_ANDROID_NDK_GCC_VERSION "" CACHE STRING
189189
"The GCC version to use when building for Android. Currently only 4.9 is supported.")
190-
set(SWIFT_ANDROID_SDK_PATH "" CACHE STRING
191-
"Path to the directory that contains the Android SDK tools that will be passed to the swiftc frontend")
192190
set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
193191
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")
194192

@@ -354,7 +352,7 @@ endfunction()
354352
# Print out path and version of any installed commands.
355353
# We migth be using the wrong version of a command, so record them all.
356354
function(print_versions)
357-
find_version("cmake" "--version" TRUE)
355+
find_version("${CMAKE_COMMAND}" "--version" TRUE)
358356

359357
message(STATUS "Finding version for: ${CMAKE_COMMAND}")
360358
message(STATUS "Found version: ${CMAKE_VERSION}")
@@ -594,7 +592,7 @@ else()
594592
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
595593
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "IA64")
596594
set(SWIFT_HOST_VARIANT_ARCH_default "itanium")
597-
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
595+
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|i686)")
598596
set(SWIFT_HOST_VARIANT_ARCH_default "i686")
599597
else()
600598
message(FATAL_ERROR "Unrecognized architecture on host system: ${CMAKE_SYSTEM_PROCESSOR}")
@@ -637,7 +635,6 @@ endif()
637635
# To fix it, we would need to append the architecture to the SDKs,
638636
# for example: 'OSX-x86_64;IOS-armv7;...etc'.
639637
# We could easily do that - we have all of that information in build-script-impl.
640-
# Also, we would need to be provided with the sysroot for each SDK (see SWIFT_ANDROID_SDK_PATH/SWIFT_SDK_ANDROID_PATH).
641638
# Darwin targets cheat and use `xcrun`.
642639

643640
if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
@@ -650,6 +647,8 @@ if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
650647
if("${SWIFT_HOST_TRIPLE}" STREQUAL "")
651648
if("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "x86_64")
652649
set(SWIFT_HOST_TRIPLE "x86_64-unknown-linux-gnu")
650+
elseif("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "i686")
651+
set(SWIFT_HOST_TRIPLE "i686-unknown-linux-gnu")
653652
elseif("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "aarch64")
654653
set(SWIFT_HOST_TRIPLE "aarch64-unknown-linux-gnu")
655654
elseif("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "(powerpc64|powerpc64le)")
@@ -726,7 +725,7 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" MATCHES "(OSX|IOS*|TVOS*|WATCHOS*)")
726725
COMMAND "xcodebuild" "-version"
727726
OUTPUT_VARIABLE xcode_version
728727
OUTPUT_STRIP_TRAILING_WHITESPACE)
729-
string(REPLACE "\n" ", " xcode_version ${xcode_version})
728+
string(REPLACE "\n" ", " xcode_version "${xcode_version}")
730729
message(STATUS "${xcode_version}")
731730
message(STATUS "")
732731

@@ -760,22 +759,29 @@ endif()
760759
# Should we cross-compile the standard library for Android?
761760
is_sdk_requested(ANDROID swift_build_android)
762761
if(swift_build_android AND NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
763-
764-
configure_sdk_unix(ANDROID "Android" "android" "android" "armv7" "armv7-none-linux-androideabi" "${SWIFT_ANDROID_SDK_PATH}")
765-
766-
if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux"))
762+
if (NOT ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Darwin" OR "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux"))
767763
message(FATAL_ERROR "A Darwin or Linux host is required to build the Swift runtime for Android")
768-
elseif(("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT swift_build_osx) OR
769-
("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT swift_build_linux))
764+
endif()
765+
766+
if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT swift_build_osx) OR
767+
("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT swift_build_linux))
770768
set(SWIFT_PRIMARY_VARIANT_SDK_default "ANDROID")
771769
set(SWIFT_PRIMARY_VARIANT_ARCH_default "armv7")
772770
endif()
771+
772+
if("${SWIFT_SDK_ANDROID_ARCHITECTURES}" STREQUAL "")
773+
set(SWIFT_SDK_ANDROID_ARCHITECTURES armv7;aarch)
774+
endif()
775+
configure_sdk_unix(ANDROID "Android" "android" "android" "${SWIFT_SDK_ANDROID_ARCHITECTURES}" "" "")
773776
endif()
774777

775778
# Should we cross-compile the standard library for Windows?
776779
is_sdk_requested(WINDOWS swift_build_windows)
777780
if(swift_build_windows AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
778-
configure_sdk_windows(WINDOWS "Windows" "msvc" "aarch64;armv7;i686;x86_64")
781+
if("${SWIFT_SDK_WINDOWS_ARCHITECTURES}" STREQUAL "")
782+
set(SWIFT_SDK_WINDOWS_ARCHITECTURES aarch64;armv7;i686;x86_64)
783+
endif()
784+
configure_sdk_windows(WINDOWS "Windows" "msvc" "${SWIFT_SDK_WINDOWS_ARCHITECTURES}")
779785
endif()
780786

781787
if("${SWIFT_SDKS}" STREQUAL "")
@@ -860,17 +866,18 @@ function(swift_icu_variables_set sdk arch result)
860866
endif()
861867
endfunction()
862868

863-
# ICU is provided through CoreFoundation on Darwin. On other hosts, assume that
864-
# we are compiling for the build as the host. In such a case, if the ICU
869+
# ICU is provided through CoreFoundation on Darwin. On other hosts, if the ICU
865870
# unicode and i18n include and library paths are not defined, perform a standard
866871
# package lookup. Otherwise, rely on the paths specified by the user. These
867872
# need to be defined when cross-compiling.
868873
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
869-
swift_icu_variables_set("${SWIFT_HOST_VARIANT_SDK_default}"
870-
"${SWIFT_HOST_VARIANT_ARCH_default}"
871-
ICU_CONFIGURED)
872-
if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "" AND NOT ${ICU_CONFIGURED})
873-
find_package(ICU REQUIRED COMPONENTS uc i18n)
874+
if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
875+
swift_icu_variables_set("${SWIFT_PRIMARY_VARIANT_SDK}"
876+
"${SWIFT_PRIMARY_VARIANT_ARCH}"
877+
ICU_CONFIGURED)
878+
if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "" AND NOT ${ICU_CONFIGURED})
879+
find_package(ICU REQUIRED COMPONENTS uc i18n)
880+
endif()
874881
endif()
875882
endif()
876883

@@ -898,6 +905,11 @@ cmake_pop_check_state()
898905

899906
check_symbol_exists(wait4 "sys/wait.h" HAVE_WAIT4)
900907

908+
check_symbol_exists(proc_pid_rusage "libproc.h" HAVE_PROC_PID_RUSAGE)
909+
if(HAVE_PROC_PID_RUSAGE)
910+
list(APPEND CMAKE_REQUIRED_LIBRARIES proc)
911+
endif()
912+
901913
if (LLVM_ENABLE_DOXYGEN)
902914
message(STATUS "Doxygen: enabled")
903915
endif()

CODE_OWNERS.TXT

+1-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ D: XCTest overlay
2020
N: Erik Eckstein
2121
2222
G: eeckstein
23-
D: SILOptimizer
23+
D: SILOptimizer, Swift Benchmark Suite
2424

2525
N: Xi Ge
2626
@@ -42,11 +42,6 @@ E: [email protected]
4242
G: akyrtzi
4343
D: IDE, Index, SourceKit, swift-ide-test
4444

45-
N: Luke Larson
46-
47-
G: lplarson
48-
D: Swift Benchmark Suite
49-
5045
N: John McCall
5146
5247
G: rjmccall

README.md

+48-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
| **macOS** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-osx)|[![Build Status](https://ci.swift.org/job/oss-swift-package-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-osx)|
99
| **Ubuntu 14.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04)|
1010
| **Ubuntu 16.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
11-
| **Ubuntu 16.10** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_10/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_10)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_10/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_10)|
11+
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04)|
1212

1313
**Swift Community-Hosted CI Platforms**
1414

@@ -17,10 +17,12 @@
1717
|**[Debian 9.1 (Raspberry Pi)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/armv7_debian_stretch.json)** | ARMv7 | [![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1)|
1818
|**[Fedora 27](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_fedora_27.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27)|
1919
|**[Ubuntu 16.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04)|
20-
|**[Ubuntu 16.04 (TensorFlow)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow)|
2120
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le)|
2221
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_16.04.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64)|
2322
|**[Ubuntu 16.04 (Android)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
23+
|**[Ubuntu 16.04 (TensorFlow)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow)|
24+
|**[macOS 10.13 (TensorFlow)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_macos_high_sierra_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-macOS-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-macOS-tensorflow)|
25+
|**[Ubuntu 16.04 (TensorFlow with GPU)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow_gpu.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow-gpu/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow-gpu)|
2426

2527

2628
**Welcome to Swift!**
@@ -69,7 +71,7 @@ supported host development operating systems.
6971

7072
#### macOS
7173

72-
To build for macOS, you need [Xcode 10 beta 5](https://developer.apple.com/xcode/downloads/).
74+
To build for macOS, you need [Xcode 10.0](https://developer.apple.com/xcode/downloads/).
7375
The required version of Xcode changes frequently, and is often a beta release.
7476
Check this document or the host information on <https://ci.swift.org> for the
7577
current required version.
@@ -206,6 +208,49 @@ common debug flow would involve:
206208
Another option is to change the scheme to "Wait for executable to be launched",
207209
then run the build product in Terminal.
208210

211+
### Swift Toolchains
212+
213+
#### Building
214+
215+
Swift toolchains are created using the script
216+
[build-toolchain](https://github.com/apple/swift/blob/master/utils/build-toolchain). This
217+
script is used by swift.org's CI to produce snapshots and can allow for one to
218+
locally reproduce such builds for development or distribution purposes. E.x.:
219+
220+
```
221+
$ ./utils/build-toolchain $TOOLCHAIN_PREFIX
222+
```
223+
224+
where ``$TOOLCHAIN_PREFIX`` is a string that will be prepended to the swift
225+
package name in the produced tar ball. For instance, if ``$TOOLCHAIN_PREFIX``
226+
was ``macOS``, the produced archive will have the name
227+
``swift-macOS.tar.gz``.
228+
229+
Beyond building the toolchain, ``build-toolchain`` also supports the following
230+
(non-exhaustive) set of useful options::
231+
232+
- ``--dry-run``: Perform a dry run build. This is off by default.
233+
- ``--test``: Test the toolchain after it has been compiled. This is off by default.
234+
- ``--distcc``: Use distcc to speed up the build by distributing the c++ part of
235+
the swift build. This is off by default.
236+
237+
More options may be added over time. Please pass ``--help`` to
238+
``build-toolchain`` to see the full set of options.
239+
240+
#### Installing into Xcode
241+
242+
On macOS if one wants to install such a toolchain into Xcode:
243+
244+
1. Untar and copy the toolchain to one of `/Library/Developer/Toolchains/` or
245+
`~/Library/Developer/Toolchains/`. E.x.:
246+
247+
```
248+
$ tar -xzf swift-macOS.tar.gz -C /
249+
$ tar -xzf swift-macOS.tar.gz -C ~/
250+
```
251+
252+
2. Specify the local toolchain for Xcode's use via `Xcode->Toolchains`.
253+
209254
### Build Failures
210255

211256
Make sure you are using the [correct release](#macos) of Xcode.

0 commit comments

Comments
 (0)