Skip to content

Commit 5d3fe25

Browse files
committed
Merge pull request #31 from BrandonMathis/feature/easier-install
Simplify obtaining of swift sources
2 parents a11e61a + dd68e72 commit 5d3fe25

File tree

2 files changed

+46
-25
lines changed

2 files changed

+46
-25
lines changed

Diff for: README.md

+18-25
Original file line numberDiff line numberDiff line change
@@ -65,31 +65,24 @@ compiler for C++14 support and create a symlink:
6565

6666
### Getting Sources for Swift and Related Projects
6767

68-
For those checking out sources as read-only:
69-
70-
git clone https://github.com/apple/swift.git swift
71-
git clone https://github.com/apple/swift-llvm.git llvm
72-
git clone https://github.com/apple/swift-clang.git clang
73-
git clone https://github.com/apple/swift-lldb.git lldb
74-
git clone https://github.com/apple/swift-cmark.git cmark
75-
git clone https://github.com/apple/swift-llbuild.git llbuild
76-
git clone https://github.com/apple/swift-package-manager.git swiftpm
77-
git clone https://github.com/apple/swift-corelibs-xctest.git
78-
git clone https://github.com/apple/swift-corelibs-foundation.git
79-
80-
For those who plan on regularly making direct commits, cloning over
81-
SSH may provide a better experience (which requires uploading
82-
SSH keys to GitHub):
83-
84-
git clone [email protected]:apple/swift.git swift
85-
git clone [email protected]:apple/swift-llvm.git llvm
86-
git clone [email protected]:apple/swift-clang.git clang
87-
git clone [email protected]:apple/swift-lldb.git lldb
88-
git clone [email protected]:apple/swift-cmark.git cmark
89-
git clone [email protected]:apple/swift-llbuild.git llbuild
90-
git clone [email protected]:apple/swift-package-manager.git swiftpm
91-
git clone [email protected]:apple/swift-corelibs-xctest.git
92-
git clone [email protected]:apple/swift-corelibs-foundation.git
68+
#### Swift Sources
69+
70+
**Via HTTPS**
71+
git clone https://github.com/apple/swift.git
72+
73+
**Via SSH**
74+
git clone [email protected]:apple/swift.git
75+
76+
#### Related Project Sources
77+
78+
**Via HTTPS**
79+
cd <local_path_to_swift_repo>
80+
./utils/update-checkout --clone
81+
82+
**Via SSH**
83+
cd <local_path_to_swift_repo>
84+
./utils/update-checkout --clone-via-ssh
85+
9386

9487
[CMake](http://cmake.org) is the core infrastructure used to configure builds of
9588
Swift and its companion projects; at least version 2.8.12.2 is required. Your

Diff for: utils/update-checkout

+28
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ def update_working_copy(repo_path):
5252
else:
5353
check_call([ "svn", "update" ])
5454

55+
def obtain_additional_swift_sources(opts = {'with_ssh': False}):
56+
additional_repos = {
57+
'llvm': 'apple/swift-llvm',
58+
'clang': 'apple/swift-clang',
59+
'lldb': 'apple/swift-lldb',
60+
'cmark': 'apple/swift-cmark',
61+
'llbuild': 'apple/swift-llbuild',
62+
'swiftpm': 'apple/swift-package-manager',
63+
'swift-corelibs-xctest': 'apple/swift-corelibs-xctest',
64+
'swift-corelibs-foundation': 'apple/swift-corelibs-foundation'
65+
}
66+
for dir_name, repo in additional_repos.iteritems():
67+
print("--- Cloning '" + dir_name + "' ---")
68+
if opts['with_ssh'] == True:
69+
remote = "[email protected]:" + repo + '.git'
70+
else:
71+
remote = "https://github.com/" + repo + '.git'
72+
check_call(['git', 'clone', remote, dir_name])
5573

5674
def main():
5775
parser = argparse.ArgumentParser(
@@ -63,12 +81,22 @@ By default, updates your checkouts of Swift, SourceKit, LLDB, and SwiftPM.""")
6381
parser.add_argument("-a", "--all",
6482
help="also update checkouts of llbuild, LLVM, and Clang",
6583
action="store_true")
84+
parser.add_argument("--clone",
85+
help="Obtain Sources for Swift and Related Projects",
86+
action="store_true")
87+
parser.add_argument("--clone-with-ssh",
88+
help="Obtain Sources for Swift and Related Projects via SSH",
89+
action="store_true")
6690
args = parser.parse_args()
6791

6892
if args.all:
6993
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llbuild"))
7094
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llvm"))
7195
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "clang"))
96+
if args.clone:
97+
obtain_additional_swift_sources()
98+
if args.clone_with_ssh:
99+
obtain_additional_swift_sources({'with_ssh': True})
72100

73101
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift"))
74102
update_working_copy(

0 commit comments

Comments
 (0)