You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -3,30 +3,38 @@ There are several types of contributions one can make. Bug fixes, documentation
3
3
4
4
Larger changes that do materially change the semantics of Swift Package Manager (e.g. changes to the manifest format or behavior) are required to go through [Swift Evolution Process](https://github.com/apple/swift-evolution/blob/master/process.md).
5
5
6
-
To see how previous evolution decisions for SwiftPM have been made and have some direction for the development of future features please check out the [Community Proposal](Documentation/Internals/PackageManagerCommunityProposal.md).
6
+
To see how previous evolution decisions for SwiftPM have been made and have some direction for the development of future features please check out the [Community Proposals](https://forums.swift.org/tag/packagemanager).
7
7
8
8
For more information about making contributions to the Swift project in general see [Swift Contribution Guide](https://swift.org/contributing/).
9
9
10
10
## Reporting issues
11
-
Report a bug guide: https://github.com/apple/swift-package-manager/blob/main/Documentation/Resources.md#reporting-a-good-swiftpm-bug.
12
-
JIRA Bug Tracker (a place where you can open bugs, enhancements to start to contribute): [https://bugs.swift.org/browse/SR-13640?jql=component%20%3D%20%22Package%20Manager%22](https://bugs.swift.org/browse/SR-13640?jql=component%20%3D%20%22Package%20Manager%22).
*[Guide for filing quality bug reports](https://github.com/apple/swift-package-manager/blob/main/Documentation/Resources.md#reporting-a-good-swiftpm-bug).
13
13
14
14
## Development environment
15
15
16
-
SwiftPM is typically built with a pre-existing versions of SwiftPM present on the system. Which can be obtained by installing the latest release of Xcode or a toolchain from swift.org. But there are have multiple ways to setup your development environment:
16
+
First, clone a copy of SwiftPM code from https://github.com/apple/swift-package-manager.
17
+
18
+
If you are preparing to make a contribution you should fork the repository first and clone the fork which will make opening Pull Requests easier. See "Creating Pull Requests" section below.
19
+
20
+
SwiftPM is typically built with a pre-existing version of SwiftPM present on the system, but there are multiple ways to setup your development environment:
17
21
18
22
### Using Xcode (Easiest)
19
23
20
-
1. Install latest Xcode from https://developer.apple.com/xcode
21
-
2. Open SwiftPM's `Package.swift` manifest with the latest release (including betas) of Xcode.
24
+
1. Install Xcode from [https://developer.apple.com/xcode](https://developer.apple.com/xcode) (including betas!).
25
+
2. Verify the expected version of Xcode was installed.
26
+
3. Open SwiftPM's `Package.swift` manifest with Xcode, and use Xcode to edit the code, build, and run the tests.
22
27
23
-
### Using a Swift toolchain
28
+
### Using the Command Line
24
29
25
-
1. Download a toolchain from https://swift.org/download/
30
+
If you are using macOS and have Xcode installed, you can use the command line even without downloading and installing a toolchain, otherwise, you first need to doownload and install one.
26
31
27
-
2. Confirm the toolchain is installed correctly:
32
+
#### Installing the toolchain
28
33
29
-
*macOS*
34
+
1. Download a toolchain from https://swift.org/download/
35
+
2. Install it and verify the expected version of the toolchain was installed:
3. Clone [llbuild](https://github.com/apple/swift-llbuild) beside the package manager directory.
83
+
Binary artifacts are located in `x86_64-apple-macosx/` when building on macOS,
84
+
or the equivalent on other architectures and operating systems.
85
+
86
+
These binaries can be used to test the code modification. For example, to test the `swift package init` and `swift build` commands from the new SwiftPM artifacts in `.build/`:
$>swift test --filter PackageGraphTests.DependencyResolverTests/testBasics
93
104
```
94
105
95
-
6. Clone [swift-argument-parser](https://github.com/apple/swift-argument-parser) beside the package manager directory and check out tag with the [latest version](https://github.com/apple/swift-argument-parser/tags).
106
+
Or another example, to run tests for the test targets BuildTests and WorkspaceTests, but skip some test cases:
$>swift test --filter BuildTests --skip BuildPlanTests --filter WorkspaceTests --skip InitTests
100
110
```
101
111
102
-
7. Build the Swift Package Manager.
112
+
To run the performance tests, enable them with an ENV variable:
103
113
104
114
```bash
105
-
$>cd swiftpm
106
-
$>Utilities/bootstrap build
115
+
$>export TSC_ENABLE_PERF_TESTS=1
116
+
$>swift test -c release --filter PerformanceTests
107
117
```
108
118
109
-
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.
119
+
### Using the bootstrap script
110
120
111
-
This command builds the Package Manager inside the `.build/` directory.
112
-
Run the bootstrap script to rebuild after making a change to the source
113
-
code.
121
+
The bootstrap script is designed for building SwiftPM on systems that do not have Xcode or a toolchain installed.
122
+
It is used on bare systems to bootstrap the Swift toolchain (including SwiftPM), and as such not typically used outside the Swift team.
114
123
115
-
<aid="self-hosting">*_Self Hosting_*</a>:
124
+
the bootstrap script requires having [CMake](https://cmake.org/) and [Ninja](https://ninja-build.org/) installed.
125
+
Please refer to the [Swift project repo](https://github.com/apple/swift/blob/master/README.md#macos) for installation instructions.
116
126
117
-
It is possible to build SwiftPM with itself using SwiftPM present in latest
118
-
release of Xcode or the latest trunk snapshot on Linux.
127
+
1. Clone [llbuild](https://github.com/apple/swift-llbuild) beside the SwiftPM directory.
119
128
120
129
```bash
121
-
# Build:
122
-
$> swift build
123
-
124
-
# Run all tests.
125
-
$> swift test --parallel
126
-
127
-
# Run a single test.
128
-
For example, to only run the `PackageGraphTests.DependencyResolverTests/testBasics`
129
-
$> swift test --filter PackageGraphTests.DependencyResolverTests/testBasics
130
-
131
-
# Run tests for the test targets BuildTests and WorkspaceTests, but skip some test cases.
132
-
$> swift test --filter BuildTests --skip BuildPlanTests --filter WorkspaceTests --skip InitTests
4. Clone [swift-argument-parser](https://github.com/apple/swift-argument-parser) beside the SwiftPM directory and check out tag with the [latest version](https://github.com/apple/swift-argument-parser/tags).
For contributors on macOS who need to test on Linux, install Docker and use the
239
-
following commands:
186
+
When developing on macOS and need to test on Linux, install [Docker](https://www.docker.com/products/docker-desktop) and use the following commands:
240
187
241
188
```bash
242
189
$> Utilities/Docker/docker-utils build # will build an image with the latest Swift snapshot
@@ -257,30 +204,27 @@ $> Utilities/Docker/docker-utils swift-run # to run swift-run in the container
257
204
7. Commit (include the Radar link or JIRA issue id in the commit message if possible and a description your changes). Try to have only 1 commit in your PR (but, of course, if you add changes that can be helpful to be kept aside from the previous commit, make a new commit for them).
258
205
8. Push the commit / branch to your fork
259
206
9. Make a PR from your fork / branch to `apple: main`
260
-
10. Reviewers are going to be automatically added to your PR
261
-
11. Merge pull request when you received approval from the reviewers (one or more)
207
+
10. While creating your PR, make sure to follow the PR Template providing information about the motivation and highlighting the changes.
208
+
11. Reviewers are going to be automatically added to your PR
209
+
12. Merge pull request when you received approval from the reviewers (one or more)
262
210
263
211
## Using Continuous Integration
264
-
SwiftPM uses [swift-ci](https://ci.swift.org) infrastructure for its continuous integration testing. The bots can be triggered on pull-requests if you have commit access. Otherwise, ask
265
-
one of the code owners to trigger them for you. The following commands are supported:
266
-
267
-
```
268
-
@swift-ci please smoke test
269
-
```
212
+
SwiftPM uses [swift-ci](https://ci.swift.org) infrastructure for its continuous integration testing. The bots can be triggered on pull-requests if you have commit access. Otherwise, ask one of the code owners to trigger them for you.
270
213
271
214
Run tests with the trunk compiler and other projects. This is **required** before
272
215
a pull-request can be merged.
273
216
274
217
```
275
-
@swift-ci please smoke test self hosted
218
+
@swift-ci please smoke test
276
219
```
277
220
278
221
Run just the self-hosted tests. This has fast turnaround times so it can be used
279
222
to get quick feedback.
280
223
281
224
Note: Smoke tests are still required for merging pull-requests.
282
225
283
-
## Using Custom Swift Compilers
226
+
## Advanced
227
+
### Using Custom Swift Compilers
284
228
SwiftPM needs the Swift compiler to parse `Package.swift` manifest files and to
285
229
compile Swift source files. You can use the `SWIFT_EXEC` and `SWIFT_EXEC_MANIFEST`
286
230
environment variables to control which compiler to use for these operations.
@@ -298,7 +242,7 @@ want to use a debug compiler with SwiftPM.
298
242
$> SWIFT_EXEC=/path/to/my/built/swiftc swift build
299
243
```
300
244
301
-
## Overriding the Path to the Runtime Libraries
245
+
###Overriding the Path to the Runtime Libraries
302
246
SwiftPM computes the path of its runtime libraries relative to where it is
303
247
installed. This path can be overridden by setting the environment variable
304
248
`SWIFTPM_PD_LIBS` to a directory containing the libraries, or a colon-separated list of
@@ -307,13 +251,12 @@ path which exists on disk. If none of the paths are present on disk, it will fal
307
251
back to built-in computation.
308
252
309
253
## Making changes in TSC targets
310
-
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).
254
+
SwiftPM uses [Tools Support Core](https://github.com/apple/swift-tools-support-core) (aka TSC) for many of its general purpose utilities. Changes in SwiftPM often require changes in TSC first. To coordinate changes, open a PR against TSC first, then a second one against SwiftPM pulling the correct TSC version.
311
255
312
256
## Community and Support
313
257
If you want to connect with the Swift community you can:
314
258
* Use Swift Forums: [https://forums.swift.org/c/development/SwiftPM](https://forums.swift.org/c/development/SwiftPM)
315
259
* Contact the CODEOWNERS: https://github.com/apple/swift-package-manager/blob/main/CODEOWNERS
0 commit comments