Skip to content

Commit b79a92b

Browse files
Add ISSUE_TEMPLATE.md and PULL_REQUEST_TEMPLATE.md
1 parent a569248 commit b79a92b

File tree

4 files changed

+116
-140
lines changed

4 files changed

+116
-140
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### Expected behavior
2+
_[what you expected to happen]_
3+
4+
### Actual behavior
5+
_[what actually happened]_
6+
7+
### Steps to reproduce
8+
9+
1. ...
10+
2. ...
11+
12+
### If possible, minimal yet complete reproducer code (or URL to code)
13+
14+
_[anything to help us reproducing the issue]_
15+
16+
### Swift Package Manager version/commit hash
17+
18+
_[the Swift Package Manager tag/commit hash]_
19+
20+
### Swift & OS version (output of `swift --version && uname -a`)

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
_[One line description of your change]_
2+
3+
### Motivation:
4+
5+
_[Explain here the context, and why you're making that change. What is the problem you're trying to solve.]_
6+
7+
### Modifications:
8+
9+
_[Describe the modifications you've done.]_
10+
11+
### Result:
12+
13+
_[After your change, what will change.]_

Documentation/Contributing.md

Lines changed: 82 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,38 @@ There are several types of contributions one can make. Bug fixes, documentation
33

44
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).
55

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).
77

88
For more information about making contributions to the Swift project in general see [Swift Contribution Guide](https://swift.org/contributing/).
99

1010
## 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).
11+
* [SwiftPM JIRA Bug Tracker](https://bugs.swift.org/browse/SR-13640?jql=component%20%3D%20%22Package%20Manager%22).
12+
* [Guide for filing quality bug reports](https://github.com/apple/swift-package-manager/blob/main/Documentation/Resources.md#reporting-a-good-swiftpm-bug).
1313

1414
## Development environment
1515

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:
1721

1822
### Using Xcode (Easiest)
1923

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.
2227

23-
### Using a Swift toolchain
28+
### Using the Command Line
2429

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.
2631

27-
2. Confirm the toolchain is installed correctly:
32+
#### Installing the toolchain
2833

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:
36+
37+
**macOS**
3038
```bash
3139
$> export TOOLCHAINS=swift
3240
```
@@ -41,7 +49,7 @@ $> swift --version
4149
Apple Swift version 5.3
4250
```
4351

44-
*Linux*
52+
**Linux**
4553
```bash
4654
$> export PATH=/path/to/swift-toolchain/usr/bin:"${PATH}"
4755
```
@@ -55,188 +63,127 @@ $> swift --version
5563
Apple Swift version 5.3
5664
```
5765

58-
3. Alternatively use tools like swiftenv that help manage toolchains versions.
59-
60-
### Using the Swift Compiler Build Script
66+
Note: Alternatively use tools like [swiftenv](https://github.com/kylef/swiftenv) that help manage toolchains versions.
6167

62-
Follow these instructions to get the Swift sources and then execute the build-script using swiftpm preset:
68+
#### Building
6369

64-
*macOS*
6570
```bash
66-
$> ./swift/utils/build-script --preset=buildbot_swiftpm_macos_platform,tools=RA,stdlib=RA
71+
$> swift build
6772
```
6873

69-
*Linux*
74+
A successful build will create a `.build/` directory with the following approximate structure:
7075
```bash
71-
$> ./swift/utils/build-script --preset=buildbot_swiftpm_linux_platform,tools=RA,stdlib=RA
76+
artifacts/
77+
checkouts/
78+
debug/
79+
repositories
80+
x86_64-apple-macosx
7281
```
7382

74-
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/`:
7587

7688
```bash
77-
$> git clone https://github.com/apple/swift-llbuild llbuild
89+
$> cd /tmp && mkdir hello && cd hello
90+
$> /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-package init
91+
$> /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-build
7892
```
7993

80-
Note: Make sure the directory for llbuild is called "llbuild" and not
81-
"swift-llbuild".
82-
83-
4. Clone [Yams](https://github.com/jpsim/yams) beside the package manager directory.
94+
#### Testing
8495

8596
```bash
86-
$> git clone https://github.com/jpsim/yams
97+
$> swift test
8798
```
8899

89-
5. Clone [swift-driver](https://github.com/apple/swift-driver) beside the package manager directory.
100+
to run a single test:
90101

91102
```bash
92-
$> git clone https://github.com/apple/swift-driver
103+
$> swift test --filter PackageGraphTests.DependencyResolverTests/testBasics
93104
```
94105

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:
96107

97-
For example, if the latest tag is 0.3.1:
98108
```bash
99-
$> git clone https://github.com/apple/swift-argument-parser --branch 0.3.1
109+
$> swift test --filter BuildTests --skip BuildPlanTests --filter WorkspaceTests --skip InitTests
100110
```
101111

102-
7. Build the Swift Package Manager.
112+
To run the performance tests, enable them with an ENV variable:
103113

104114
```bash
105-
$> cd swiftpm
106-
$> Utilities/bootstrap build
115+
$> export TSC_ENABLE_PERF_TESTS=1
116+
$> swift test -c release --filter PerformanceTests
107117
```
108118

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
110120

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.
114123

115-
<a id="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.
116126

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.
119128

120129
```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
130+
$> git clone https://github.com/apple/swift-llbuild llbuild
133131
```
134132

135-
Note: PackageDescription v4 is not available when developing using this method.
133+
Note: Make sure the directory for llbuild is called "llbuild" and not
134+
"swift-llbuild".
136135

137-
This method can also used be used for performance testing. Use the following
138-
command run SwiftPM's performance tests:
136+
2. Clone [Yams](https://github.com/jpsim/yams) beside the SwiftPM directory.
139137

140138
```bash
141-
$> export TSC_ENABLE_PERF_TESTS=1
142-
$> swift test -c release --filter PerformanceTests
139+
$> git clone https://github.com/jpsim/yams
143140
```
144141

145-
<a id="swift-compiler-build-script">*E) _Using the Swift Compiler Build Script_*</a>:
146-
147-
Follow [these](https://github.com/apple/swift#getting-started) instructions to
148-
get the Swift sources and then execute the `build-script` using swiftpm preset:
149-
150-
### macOS
142+
3. Clone [swift-driver](https://github.com/apple/swift-driver) beside the SwiftPM directory.
151143

152144
```bash
153-
$> ./swift/utils/build-script --preset=buildbot_swiftpm_macos_platform,tools=RA,stdlib=RA
145+
$> git clone https://github.com/apple/swift-driver
154146
```
155147

156-
### Linux
148+
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).
157149

150+
For example, if the latest tag is 0.3.1:
158151
```bash
159-
$> ./swift/utils/build-script --preset=buildbot_swiftpm_linux_platform,tools=RA,stdlib=RA
152+
$> git clone https://github.com/apple/swift-argument-parser --branch 0.3.1
160153
```
161154

162-
Once the build is complete, you should be able to run the swiftpm binaries from the build folder.
163-
164-
### Example
155+
#### Building
165156

166157
```bash
167-
$> cd /tmp && mkdir hello && cd hello
168-
$> /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-package init
169-
$> /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-build
158+
$> Utilities/bootstrap build
170159
```
171160

172-
8. Test the Swift Package Manager.
161+
See "Using the Command Line / Building" section above for more information on how to test the new artifacts.
173162

174-
```bash
175-
$> Utilities/bootstrap test
176-
```
163+
#### Testing
177164

178-
## Building
179-
1. Pull the SwiftPM repository:
180-
```bash
181-
$> git clone https://github.com/apple/swift-package-manager.git
182-
```
183-
2. Run your first build:
184165
```bash
185-
$> cd swift-package-manager
186-
$> swift build
166+
$> Utilities/bootstrap test
187167
```
188-
Make sure the build did not fail.
189168

190-
A `.build/` folder will be generated and it should have inside a similar structure (including build binaries):
191-
```bash
192-
artifacts/
193-
checkouts/
194-
debug/
195-
repositories
196-
x86_64-apple-macosx
197-
debug.yaml
198-
manifest.db
199-
workspace-state.json
200-
```
201-
Binaries (in the example above) are in `x86_64-apple-macosx/`.
202-
If you need to build the generated binaries, run `swift-build` in inside `.build/`:
203-
```bash
204-
./.build/x86_64-apple-macosx/debug/swift-build
205-
```
169+
## Testing locally
206170

207-
## Running Tests
208-
### Run all tests.
209-
```bash
210-
$> swift test
211-
```
212-
### Run a single test.
213-
```bash
214-
$> swift test --filter PackageGraphTests.DependencyResolverTests/testBasics
215-
```
216-
Or another example, to run tests for the test targets BuildTests and WorkspaceTests, but skip some test cases.
217-
```bash
218-
$> swift test --filter BuildTests --skip BuildPlanTests --filter WorkspaceTests --skip InitTests
219-
```
220-
Note: PackageDescription v4 is not available when developing using this method.
171+
Before submitting code modification as Pull Requests, test locally across the supported platforms and build variants.
221172

222-
This method can also used be used for performance testing. Use the following command run SwiftPM's performance tests:
173+
1. If using Xcode, run all the unit tests and verify they pass.
174+
2. If using the Command Line, run all the unit tests and verify they pass.
223175

224176
```bash
225-
$> export TSC_ENABLE_PERF_TESTS=1
226-
$> swift test -c release --filter PerformanceTests
177+
$> swift test
227178
```
228179

229-
To test SwiftPM functionality using the newly created binaries, you can invoke them from the `.build` directory. For example:
180+
3. Optionally: Test with the bootstrap script as well.
230181

231182
```bash
232-
$> cd /tmp && mkdir hello && cd hello
233-
$> /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-package init
234-
$> /path/to/swiftpm/.build/x86_64-apple-macosx/debug/swift-build
183+
$> Utilities/bootstrap test
235184
```
236185

237-
## Testing on Linux with Docker
238-
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:
240187

241188
```bash
242189
$> 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
257204
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).
258205
8. Push the commit / branch to your fork
259206
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)
262210

263211
## 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.
270213

271214
Run tests with the trunk compiler and other projects. This is **required** before
272215
a pull-request can be merged.
273216

274217
```
275-
@swift-ci please smoke test self hosted
218+
@swift-ci please smoke test
276219
```
277220

278221
Run just the self-hosted tests. This has fast turnaround times so it can be used
279222
to get quick feedback.
280223

281224
Note: Smoke tests are still required for merging pull-requests.
282225

283-
## Using Custom Swift Compilers
226+
## Advanced
227+
### Using Custom Swift Compilers
284228
SwiftPM needs the Swift compiler to parse `Package.swift` manifest files and to
285229
compile Swift source files. You can use the `SWIFT_EXEC` and `SWIFT_EXEC_MANIFEST`
286230
environment variables to control which compiler to use for these operations.
@@ -298,7 +242,7 @@ want to use a debug compiler with SwiftPM.
298242
$> SWIFT_EXEC=/path/to/my/built/swiftc swift build
299243
```
300244

301-
## Overriding the Path to the Runtime Libraries
245+
### Overriding the Path to the Runtime Libraries
302246
SwiftPM computes the path of its runtime libraries relative to where it is
303247
installed. This path can be overridden by setting the environment variable
304248
`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
307251
back to built-in computation.
308252

309253
## 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.
311255

312256
## Community and Support
313257
If you want to connect with the Swift community you can:
314258
* Use Swift Forums: [https://forums.swift.org/c/development/SwiftPM](https://forums.swift.org/c/development/SwiftPM)
315259
* Contact the CODEOWNERS: https://github.com/apple/swift-package-manager/blob/main/CODEOWNERS
316-
(mailing lists are usually the best place to go for help: [[email protected]](mailto:[email protected]), [[email protected]](mailto:[email protected]), [[email protected]](mailto:[email protected])
317260

318261
## Additional resources
319262
* `Swift.org` Contributing page

0 commit comments

Comments
 (0)