mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
<rdar://problem/20180372> Build cmark alongside llvm and clang. If the clone doesn't exist, build-script-impl will clone it in the workspace. Also update the README and update-checkout scripts. Swift SVN r26364
85 lines
2.6 KiB
Python
Executable File
85 lines
2.6 KiB
Python
Executable File
#!/usr/bin/python
|
|
#===--- update-checkout - Utility to update your local checkouts -----------===#
|
|
#
|
|
# This source file is part of the Swift.org open source project
|
|
#
|
|
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
# Licensed under Apache License v2.0 with Runtime Library Exception
|
|
#
|
|
# See http://swift.org/LICENSE.txt for license information
|
|
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
#
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
from __future__ import print_function
|
|
|
|
import argparse
|
|
import os
|
|
import sys
|
|
|
|
sys.path.append(os.path.dirname(__file__))
|
|
|
|
from SwiftBuildSupport import *
|
|
|
|
|
|
def update_git_svn(repo_path):
|
|
with WorkingDirectory(repo_path):
|
|
use_stash = (check_output([ "git", "status", "--porcelain" ]) != "")
|
|
if use_stash:
|
|
check_call([ "git", "stash", "save", "--all"])
|
|
|
|
# Try first to pull from an upstream Git repo, assuming there is one
|
|
if check_output([ "git", "remote" ]) != "":
|
|
check_call([ "git", "pull", "--rebase" ])
|
|
check_call([ "git", "svn", "rebase", "-l" ])
|
|
else:
|
|
check_call([ "git", "svn", "rebase" ])
|
|
|
|
if use_stash:
|
|
check_call([ "git", "stash", "pop" ])
|
|
|
|
|
|
def update_working_copy(repo_path):
|
|
if not os.path.isdir(repo_path):
|
|
return
|
|
|
|
print("--- Updating '" + repo_path + "' ---")
|
|
with WorkingDirectory(repo_path):
|
|
if os.path.isdir(os.path.join(".git", "svn")):
|
|
update_git_svn(repo_path)
|
|
elif os.path.isdir(".git"):
|
|
check_call([ "git", "pull" ])
|
|
else:
|
|
check_call([ "svn", "update" ])
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
description="""
|
|
repositories.
|
|
|
|
By default, updates your checkouts of Swift, SourceKit and LLDB.""")
|
|
parser.add_argument("-a", "--all",
|
|
help="update your checkouts of LLVM, Clang and Swift, SourceKit and LLDB",
|
|
action="store_true")
|
|
args = parser.parse_args()
|
|
|
|
if args.all:
|
|
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llvm"))
|
|
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "clang"))
|
|
|
|
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift"))
|
|
update_working_copy(
|
|
os.path.join(SWIFT_SOURCE_ROOT, "swift", "benchmark", "PerfTestSuite"))
|
|
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "SourceKit"))
|
|
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "cmark"))
|
|
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "lldb"))
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|
|
|