Skip to content

Commit 9f62f61

Browse files
committed
Merge branch 'rebased-changes'
2 parents db9ec2a + b83e990 commit 9f62f61

File tree

354 files changed

+12024
-6472
lines changed

Some content is hidden

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

354 files changed

+12024
-6472
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ xcuserdata
55
*~
66
\#*
77
.\#*
8+
.*.sw[nop]
89
*.xcscmblueprint
910
/default.profraw
1011
*.xcodeproj

CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This source file is part of the Swift.org open source project
2+
#
3+
# Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
cmake_minimum_required(VERSION 3.15.1)
10+
11+
project(SwiftPM LANGUAGES C Swift)
12+
13+
set(CMAKE_Swift_LANGUAGE_VERSION 4.2)
14+
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
15+
16+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
17+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
18+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
19+
20+
option(BUILD_SHARED_LIBS "Build shared libraryes by default" YES)
21+
22+
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
23+
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path
24+
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
25+
OUTPUT_STRIP_TRAILING_WHITESPACE)
26+
endif()
27+
28+
add_subdirectory(Sources)

CODEOWNERS

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
This file is a list of the people responsible for ensuring that patches for a
2-
particular part of Swift are reviewed, either by themselves or by someone else.
3-
They are also the gatekeepers for their part of Swift, with the final word on
4-
what goes in or not.
5-
6-
The list is sorted by surname and formatted to allow easy grepping and
7-
beautification by scripts. The fields are: name (N), email (E), web-address
8-
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
9-
(S).
10-
11-
N: Ankit Aggarwal
12-
13-
D: Package Manager
14-
15-
N: Anders Bertelrud
16-
17-
D: Package Manager
18-
19-
N: Daniel Dunbar
20-
21-
D: Package Manager
1+
# This file is a list of the people responsible for ensuring that patches for a
2+
# particular part of Swift are reviewed, either by themselves or by someone else.
3+
# They are also the gatekeepers for their part of Swift, with the final word on
4+
# what goes in or not.
5+
#
6+
# The list is sorted by surname and formatted to allow easy grepping and
7+
# beautification by scripts. The fields are: name (N), email (E), web-address
8+
# (W), PGP key ID and fingerprint (P), description (D), and snail-mail address
9+
# (S).
10+
11+
# N: Ankit Aggarwal
12+
13+
# D: Package Manager
14+
#
15+
# N: Anders Bertelrud
16+
17+
# D: Package Manager
18+
19+
# N: Daniel Dunbar
20+
21+
# D: Package Manager
2222

2323
###
2424

2525
# The following lines are used by GitHub to automatically recommend reviewers.
2626

27-
* @aciidb0mb3r
27+
* @aciidb0mb3r @abertelrud @neonichu

Documentation/Development.md

Lines changed: 104 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -2,90 +2,97 @@
22

33
This document contains information on building and testing the Swift Package Manager.
44

5-
## Using Swift compiler build script
5+
## Using the Swift Compiler Build Script
66

77
The official way to build and test is using the Swift compiler build script.
88
First, follow the instructions provided
99
[here](https://github.com/apple/swift/blob/master/README.md#getting-started) and
1010
then run one of these commands from the Swift Package Manager directory:
1111

12-
##### macOS:
12+
### macOS
1313

1414
```sh
1515
$ ../swift/utils/build-script -R --llbuild --swiftpm
1616
```
1717

18-
##### Linux:
18+
### Linux
1919

2020
```sh
2121
$ ../swift/utils/build-script -R --llbuild --swiftpm --xctest --foundation --libdispatch
2222
```
2323

24-
This will build compiler and friends in `build/` directory. It takes about ~1
24+
This will build the compiler and friends in the `build/` directory. It takes about 1
2525
hour for the initial build process. However, it is not really required to build
2626
the entire compiler in order to work on the Package Manager. A faster option is
2727
using a [snapshot](https://swift.org/download/#releases) from swift.org.
2828

29-
## Using trunk snapshot
30-
31-
1. [Download](https://swift.org/download/#snapshots) and install latest Trunk Development snapshot.
32-
2. Run the following command depending on your platform.
33-
34-
### macOS
35-
```sh
36-
$ export TOOLCHAINS=swift
37-
# Verify that we're able to find the swift compiler from the installed toolchain.
38-
$ xcrun --find swift
39-
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift
40-
```
41-
### Linux
42-
```sh
43-
$ export PATH=/path/to/swift-toolchain/usr/bin:"${PATH}"
44-
# Verify that we're able to find the swift compiler from the installed toolchain.
45-
$ which swift
46-
/path/to/swift-toolchain/usr/bin/swift
47-
```
48-
49-
3. Clone [llbuild](https://github.com/apple/swift-llbuild) next to the package manager directory.
50-
51-
```sh
52-
$ git clone https://github.com/apple/swift-llbuild llbuild
53-
$ ls
54-
swiftpm llbuild
55-
```
56-
57-
Note: Make sure the directory for llbuild is called "llbuild" and not
29+
## Using a Trunk Snapshot
30+
31+
1. [Download](https://swift.org/download/#snapshots) and install the latest Trunk Development snapshot.
32+
2. Run the following commands depending on your platform.
33+
34+
### macOS
35+
36+
```sh
37+
$ export TOOLCHAINS=swift
38+
# Verify that we're able to find the swift compiler from the installed toolchain.
39+
$ xcrun --find swift
40+
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift
41+
```
42+
43+
### Linux
44+
45+
```sh
46+
$ export PATH=/path/to/swift-toolchain/usr/bin:"${PATH}"
47+
# Verify that we're able to find the swift compiler from the installed toolchain.
48+
$ which swift
49+
/path/to/swift-toolchain/usr/bin/swift
50+
```
51+
52+
3. Clone [llbuild](https://github.com/apple/swift-llbuild) beside the package manager directory.
53+
54+
```sh
55+
$ git clone https://github.com/apple/swift-llbuild llbuild
56+
$ ls
57+
swiftpm llbuild
58+
```
59+
60+
Note: Make sure the directory for llbuild is called "llbuild" and not
5861
"swift-llbuild".
59-
60-
4. Building the Swift Package Manager.
61-
62-
```sh
63-
$ cd swiftpm
64-
$ Utilities/bootstrap
65-
```
66-
67-
This command will build the Package Manager inside `.build/` directory.
62+
63+
4. Build the Swift Package Manager.
64+
65+
```sh
66+
$ cd swiftpm
67+
$ Utilities/bootstrap
68+
```
69+
70+
Note: The bootstrap script requires having [CMake](https://cmake.org/) and [Ninja](https://ninja-build.org/) installed. Please refer to the [Swift project repo](https://github.com/apple/swift/blob/master/README.md#macos) for installation instructions.
71+
72+
This command builds the Package Manager inside the `.build/` directory.
6873
Run the bootstrap script to rebuild after making a change to the source
6974
code.
70-
71-
You can also use the built binaries: `swift-build`, `swift-package`,
75+
76+
You can also use the built binaries: `swift-build`, `swift-package`,
7277
`swift-test`, `swift-run`.
73-
74-
### Example:
75-
```sh
76-
$ cd /tmp && mkdir hello && cd hello
77-
$ /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-package init
78-
$ /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-build
79-
```
8078

81-
5. Testing the Swift Package Manager.
79+
### Example
8280

83-
```sh
84-
$ Utilities/bootstrap test --test-parallel
85-
```
86-
Use this command to run the tests. All tests must pass before a patch can be accepted.
81+
```sh
82+
$ cd /tmp && mkdir hello && cd hello
83+
$ /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-package init
84+
$ /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-build
85+
```
8786

88-
## Self-hosting
87+
5. Test the Swift Package Manager.
88+
89+
```sh
90+
$ Utilities/bootstrap test --test-parallel
91+
```
92+
93+
Use this command to run the tests. All tests must pass before a patch can be accepted.
94+
95+
## Self Hosting a Swift Package
8996

9097
It is possible to build SwiftPM with itself using a special script that is
9198
emitted during bootstrapping. This is useful when you want to rebuild just the
@@ -98,44 +105,44 @@ $ cd swiftpm
98105
$ .build/x86_64-apple-macosx/debug/spm build
99106

100107
# Run a single test.
101-
$ .build/x86_64-apple-macosx/debug/spm test --filter BasicTests.GraphAlgorithmsTests/testCycleDetection
108+
$ .build/x86_64-apple-macosx/debug/spm test --filter PackageGraphTests.DependencyResolverTests/testBasics
102109
```
103110

104-
Note: If you make any changes to `PackageDescription` runtime-related targets,
111+
Note: If you make any changes to the `PackageDescription` runtime-related targets,
105112
you **will** need to rebuild using the bootstrap script.
106113

107114
## Developing using Xcode
108115

109-
Run the following command to generate a Xcode project.
116+
Run the following commands to generate and open an Xcode project.
110117

111118
```sh
112119
$ Utilities/bootstrap --generate-xcodeproj
113120
generated: ./SwiftPM.xcodeproj
114121
$ open SwiftPM.xcodeproj
115122
```
116123

117-
Note: If you make any changes to `PackageDescription` or `PackageDescription4`
118-
target, you will need to regenerate the Xcode project using the above command.
124+
Note: If you make any changes to the `PackageDescription` or `PackageDescription4`
125+
targets, you will need to regenerate the Xcode project using the above command.
119126

120-
## Continuous Integration
127+
## Using Continuous Integration
121128

122129
SwiftPM uses [swift-ci](https://ci.swift.org) infrastructure for its continuous integration testing. The
123-
bots can be triggered on pull-requests if you have commit access, otherwise ask
130+
bots can be triggered on pull-requests if you have commit access. Otherwise, ask
124131
one of the code owners to trigger them for you. The following commands are supported:
125132

126-
### @swift-ci please smoke test
133+
@swift-ci please smoke test
127134

128-
Run tests with trunk compiler and other projects. This is **required** before
135+
Run tests with the trunk compiler and other projects. This is **required** before
129136
a pull-request can be merged.
130137

131-
### @swift-ci test with toolchain
138+
@swift-ci test with toolchain
132139

133-
Run tests with latest trunk snapshot. This has fast turnaround times so it can
140+
Run tests with the latest trunk snapshot. This has fast turnaround times so it can
134141
be used to get quick feedback.
135142

136-
Note: Smoke tests are still required for merging the pull-requests.
143+
Note: Smoke tests are still required for merging pull-requests.
137144

138-
## Running the performance tests
145+
## Running the Performance Tests
139146

140147
Running performance tests is a little awkward right now. First, generate the
141148
Xcode project using this command:
@@ -152,38 +159,50 @@ For contributors on macOS who need to test on Linux, install Docker and use the
152159
following commands:
153160

154161
```sh
155-
$ Utilities/Docker/docker-utils build # will build an image with the latest swift snapshot
156-
$ Utilities/Docker/docker-utils bootstrap # will bootstrap SwiftPM on the linux container
157-
$ Utilities/Docker/docker-utils run bash # to run an interactive bash shell in the container
162+
$ Utilities/Docker/docker-utils build # will build an image with the latest Swift snapshot
163+
$ Utilities/Docker/docker-utils bootstrap # will bootstrap SwiftPM on the Linux container
164+
$ Utilities/Docker/docker-utils run bash # to run an interactive Bash shell in the container
158165
$ Utilities/Docker/docker-utils swift-build # to run swift-build in the container
159166
$ Utilities/Docker/docker-utils swift-test # to run swift-test in the container
160167
$ Utilities/Docker/docker-utils swift-run # to run swift-run in the container
161168
```
162169

163-
## Using custom Swift compilers
170+
## Using Custom Swift Compilers
164171

165-
SwiftPM needs Swift compiler to parse Package.swift manifest files and to
166-
compile Swift source files. You can use `SWIFT_EXEC` and `SWIFT_EXEC_MANIFEST`
172+
SwiftPM needs the Swift compiler to parse `Package.swift` manifest files and to
173+
compile Swift source files. You can use the `SWIFT_EXEC` and `SWIFT_EXEC_MANIFEST`
167174
environment variables to control which compiler to use for these operations.
168175

169176
`SWIFT_EXEC_MANIFEST`: This variable controls which compiler to use for parsing
170-
Package.swift manifest files. The lookup order for the manifest compiler is:
171-
SWIFT_EXEC_MANIFEST, swiftc adjacent to swiftpm binaries, SWIFT_EXEC
177+
`Package.swift` manifest files. The lookup order for the manifest compiler is:
178+
`SWIFT_EXEC_MANIFEST`, `swiftc` adjacent to the `swiftpm` binaries, then `SWIFT_EXEC`
172179

173180
`SWIFT_EXEC`: This variable controls which compiler to use for compiling Swift
174-
sources. The lookup order for the sources compiler is: SWIFT_EXEC, swiftc adjacent
175-
to swiftpm binaries. This is also useful for Swift compiler developers when they
181+
sources. The lookup order for the sources' compiler is: `SWIFT_EXEC`, then `swiftc` adjacent
182+
to `swiftpm` binaries. This is also useful for Swift compiler developers when they
176183
want to use a debug compiler with SwiftPM.
177184

178185
```sh
179186
$ SWIFT_EXEC=/path/to/my/built/swiftc swift build
180187
```
181188

182-
## Overriding path to the runtime libraries
189+
## Overriding the Path to the Runtime Libraries
183190

184-
SwiftPM computes the path of runtime libraries relative to where it is
191+
SwiftPM computes the path of its runtime libraries relative to where it is
185192
installed. This path can be overridden by setting the environment variable
186-
`SWIFTPM_PD_LIBS` to a directory containing the libraries. This can be a list of
187-
absolute search paths separated by colon (":"). SwiftPM will choose the first
188-
path which exists on disk. If none of the path are present on disk, it will fall
193+
`SWIFTPM_PD_LIBS` to a directory containing the libraries, or a colon-separated list of
194+
absolute search paths. SwiftPM will choose the first
195+
path which exists on disk. If none of the paths are present on disk, it will fall
189196
back to built-in computation.
197+
198+
## Skipping SwiftPM tests
199+
200+
SwiftPM has a hidden env variable `_SWIFTPM_SKIP_TESTS_LIST` that can be used
201+
to skip a list of tests. This value of the variable is either a file path that contains a
202+
newline separated list of tests to skip, or a colon-separated list of tests.
203+
204+
This is only a development feature and should be considered _unsupported_.
205+
206+
## Making changes in TSC targets
207+
208+
All targets with the prefix TSC define the interface for the tools support core. Those APIs might be used in other projects as well and need to be updated in this repository by copying their sources directories to the TSC repository. The repository can be found [here](https://github.com/apple/swift-tools-support-core).

0 commit comments

Comments
 (0)