Skip to content

Commit 678e832

Browse files
authored
Merge pull request swiftlang#123 from apple/multicommit2
Support building multiple pinned version commits
2 parents b228277 + a61370c commit 678e832

File tree

7 files changed

+1764
-257
lines changed

7 files changed

+1764
-257
lines changed

README.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ To add a new Swift Package Manager project, use the following template:
7070
"path": "project",
7171
"branch": "master",
7272
"maintainer": "[email protected]",
73-
"compatibility": {
74-
"3.0": {
73+
"compatibility": [
74+
{
75+
"version": "3.0",
7576
"commit": "195cd8cde2bb717242b3081f9c367ccd0a2f0121"
7677
}
77-
},
78+
],
7879
"platforms": [
7980
"Darwin"
8081
],
@@ -90,10 +91,13 @@ To add a new Swift Package Manager project, use the following template:
9091
}
9192
~~~
9293

93-
The `commit` field specifies a commit hash to pin the repository to. It's
94-
contained inside a `compatibility` field which specifies the version of Swift
95-
the commit is known to compile against. Multiple commits compatible with
96-
different versions of Swift can be specified.
94+
The `compatibility` field contains a list of version dictionaries, each
95+
containing a Swift version and a commit. Commits are checked out before
96+
building a project in the associated Swift version compatibility mode. The
97+
Swift version is the earliest version of Swift known to compile the project at
98+
the given commit. The goal is to have multiple commits at different points in a
99+
project's history that are compatible with all supported Swift version
100+
compatibility modes.
97101

98102
The `platforms` field specifies the platforms that can be used to build the
99103
project. Linux and Darwin can currently be specified.
@@ -109,11 +113,12 @@ To add a new Swift Xcode workspace, use the following template:
109113
"path": "project",
110114
"branch": "master",
111115
"maintainer": "[email protected]",
112-
"compatibility": {
113-
"3.0": {
116+
"compatibility": [
117+
{
118+
"version": "3.0",
114119
"commit": "195cd8cde2bb717242b3081f9c367ccd0a2f0121"
115120
}
116-
},
121+
],
117122
"platforms": [
118123
"Darwin"
119124
],
@@ -177,11 +182,12 @@ To add a new Swift Xcode project, use the following template:
177182
"path": "project",
178183
"branch": "master",
179184
"maintainer": "[email protected]",
180-
"compatibility": {
181-
"3.0": {
185+
"compatibility": [
186+
{
187+
"version": "3.0",
182188
"commit": "195cd8cde2bb717242b3081f9c367ccd0a2f0121"
183189
}
184-
},
190+
],
185191
"platforms": [
186192
"Darwin"
187193
],
@@ -206,15 +212,15 @@ in Xcode 8.0.
206212
# Select Xcode 8.0 GM
207213
sudo xcode-select -s /Applications/Xcode.app
208214
# Build project at pinned commit against selected Xcode
209-
./project_precommit_check project-path-field
215+
./project_precommit_check project-path-field --earliest-compatible-swift-version 3.0
210216
~~~
211217

212218
On Linux, you can build against the Swift 3.0 release toolchain:
213219

214220
~~~bash
215221
curl -O https://swift.org/builds/swift-3.0-release/ubuntu1510/swift-3.0-RELEASE/swift-3.0-RELEASE-ubuntu15.10.tar.gz
216222
tar xzvf swift-3.0-RELEASE-ubuntu15.10.tar.gz
217-
./project_precommit_check project-path-field --swiftc swift-3.0-RELEASE-ubuntu15.10/usr/bin/swiftc
223+
./project_precommit_check project-path-field --earliest-compatible-swift-version 3.0 --swiftc swift-3.0-RELEASE-ubuntu15.10/usr/bin/swiftc
218224
~~~
219225

220226
## Maintaining Projects
@@ -238,13 +244,13 @@ To build all projects against a specified Swift compiler locally, use the
238244
`runner.py` utility as shown below.
239245

240246
~~~bash
241-
./runner.py --swift-branch master --projects projects.json --swift-version 3 --include-actions 'action.startswith("Build")' --swiftc path/to/swiftc
247+
./runner.py --swift-branch master --projects projects.json --include-actions 'action.startswith("Build")' --swiftc path/to/swiftc
242248
~~~
243249

244250
Use the `--include-repos` flag to build a specific project.
245251

246252
~~~bash
247-
./runner.py --swift-branch master --projects projects.json --swift-version 3 --include-actions 'action.startswith("Build")' --include-repos 'path == "Alamofire"' --swiftc path/to/swiftc
253+
./runner.py --swift-branch master --projects projects.json --include-actions 'action.startswith("Build")' --include-repos 'path == "Alamofire"' --swiftc path/to/swiftc
248254
~~~
249255

250256
By default, build output is redirected to per-action `.log` files in the current

common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@ def git_update(url, configured_sha, path,
410410
))
411411
else:
412412
debug_print('current_sha == configured_sha', stderr=stderr)
413+
returncodes.append(git_checkout(configured_sha, path,
414+
force=True,
415+
stdout=stdout, stderr=stderr))
413416
except ExecuteCommandFailure:
414417
debug_print("warning: Unable to update. Falling back to a clone.",
415418
stderr=stderr)

0 commit comments

Comments
 (0)