Skip to content

Commit b0c4fbd

Browse files
committed
Added option install with ssh param
1 parent 9311f72 commit b0c4fbd

File tree

2 files changed

+42
-40
lines changed

2 files changed

+42
-40
lines changed

README.md

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,25 @@ compiler for C++14 support and create a symlink:
6767

6868
### Getting Sources for Swift and Related Projects
6969

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

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

utils/update-checkout

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ from __future__ import print_function
1616
import argparse
1717
import os
1818
import sys
19-
import pdb
2019

2120
sys.path.append(os.path.dirname(__file__))
2221

@@ -53,20 +52,24 @@ def update_working_copy(repo_path):
5352
else:
5453
check_call([ "svn", "update" ])
5554

56-
def obtain_additional_swift_sources():
55+
def obtain_additional_swift_sources(opts = {'with_ssh': False}):
5756
additional_repos = {
58-
'llvm': 'https://github.com/apple/swift-llvm.git',
59-
'clang': 'https://github.com/apple/swift-clang.git',
60-
'lldb': 'https://github.com/apple/swift-lldb.git',
61-
'cmark': 'https://github.com/apple/swift-cmark.git',
62-
'llbuild': 'https://github.com/apple/swift-llbuild.git',
63-
'swiftpm': 'https://github.com/apple/swift-package-manager.git',
64-
'swift-corelibs-xctest': 'https://github.com/apple/swift-corelibs-xctest.git',
65-
'swift-corelibs-foundation': 'https://github.com/apple/swift-corelibs-foundation.git'
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'
6665
}
6766
for dir_name, repo in additional_repos.iteritems():
6867
print("--- Cloning '" + dir_name + "' ---")
69-
check_call(['git', 'clone', repo, 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])
7073

7174
def main():
7275
parser = argparse.ArgumentParser(
@@ -81,14 +84,19 @@ By default, updates your checkouts of Swift, SourceKit, LLDB, and SwiftPM.""")
8184
parser.add_argument("--clone",
8285
help="Obtain Sources for Swift and Related Projects",
8386
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")
8490
args = parser.parse_args()
8591

86-
if args.all:
87-
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llbuild"))
88-
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llvm"))
89-
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "clang"))
92+
# if args.all:
93+
# update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llbuild"))
94+
# update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llvm"))
95+
# update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "clang"))
9096
if args.clone:
9197
obtain_additional_swift_sources()
98+
if args.clone_with_ssh:
99+
obtain_additional_swift_sources({'with_ssh': True})
92100

93101
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift"))
94102
update_working_copy(

0 commit comments

Comments
 (0)