Skip to content

Simplify obtaining of swift sources #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Dec 11, 2015
43 changes: 18 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,24 @@ compiler for C++14 support and create a symlink:

### Getting Sources for Swift and Related Projects

For those checking out sources as read-only:

git clone https://github.com/apple/swift.git swift
git clone https://github.com/apple/swift-llvm.git llvm
git clone https://github.com/apple/swift-clang.git clang
git clone https://github.com/apple/swift-lldb.git lldb
git clone https://github.com/apple/swift-cmark.git cmark
git clone https://github.com/apple/swift-llbuild.git llbuild
git clone https://github.com/apple/swift-package-manager.git swiftpm
git clone https://github.com/apple/swift-corelibs-xctest.git
git clone https://github.com/apple/swift-corelibs-foundation.git

For those who plan on regularly making direct commits, cloning over
SSH may provide a better experience (which requires uploading
SSH keys to GitHub):

git clone [email protected]:apple/swift.git swift
git clone [email protected]:apple/swift-llvm.git llvm
git clone [email protected]:apple/swift-clang.git clang
git clone [email protected]:apple/swift-lldb.git lldb
git clone [email protected]:apple/swift-cmark.git cmark
git clone [email protected]:apple/swift-llbuild.git llbuild
git clone [email protected]:apple/swift-package-manager.git swiftpm
git clone [email protected]:apple/swift-corelibs-xctest.git
git clone [email protected]:apple/swift-corelibs-foundation.git
#### Swift Sources

**Via HTTPS**
git clone https://github.com/apple/swift.git

**Via SSH**
git clone [email protected]:apple/swift.git

#### Related Project Sources

**Via HTTPS**
cd <local_path_to_swift_repo>
./utils/update-checkout --clone

**Via SSH**
cd <local_path_to_swift_repo>
./utils/update-checkout --clone-via-ssh


[CMake](http://cmake.org) is the core infrastructure used to configure builds of
Swift and its companion projects; at least version 2.8.12.2 is required. Your
Expand Down
28 changes: 28 additions & 0 deletions utils/update-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ def update_working_copy(repo_path):
else:
check_call([ "svn", "update" ])

def obtain_additional_swift_sources(opts = {'with_ssh': False}):
additional_repos = {
'llvm': 'apple/swift-llvm',
'clang': 'apple/swift-clang',
'lldb': 'apple/swift-lldb',
'cmark': 'apple/swift-cmark',
'llbuild': 'apple/swift-llbuild',
'swiftpm': 'apple/swift-package-manager',
'swift-corelibs-xctest': 'apple/swift-corelibs-xctest',
'swift-corelibs-foundation': 'apple/swift-corelibs-foundation'
}
for dir_name, repo in additional_repos.iteritems():
print("--- Cloning '" + dir_name + "' ---")
if opts['with_ssh'] == True:
remote = "[email protected]:" + repo + '.git'
else:
remote = "https://github.com/" + repo + '.git'
check_call(['git', 'clone', remote, dir_name])

def main():
parser = argparse.ArgumentParser(
Expand All @@ -63,12 +81,22 @@ By default, updates your checkouts of Swift, SourceKit, LLDB, and SwiftPM.""")
parser.add_argument("-a", "--all",
help="also update checkouts of llbuild, LLVM, and Clang",
action="store_true")
parser.add_argument("--clone",
help="Obtain Sources for Swift and Related Projects",
action="store_true")
parser.add_argument("--clone-with-ssh",
help="Obtain Sources for Swift and Related Projects via SSH",
action="store_true")
args = parser.parse_args()

if args.all:
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llbuild"))
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llvm"))
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "clang"))
if args.clone:
obtain_additional_swift_sources()
if args.clone_with_ssh:
obtain_additional_swift_sources({'with_ssh': True})

update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift"))
update_working_copy(
Expand Down