Skip to content

Commit 7778ddb

Browse files
Checkout swiftlang/swift-sdk-generator manually
1 parent 62f8f5c commit 7778ddb

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

tools/build/build_support/actions.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,25 @@ def system(self, *args):
2525
raise Exception('Command failed: {}'.format(' '.join(args)))
2626

2727
class CloneAction(Action):
28+
def __init__(self, options, repo: str, branch: str):
29+
super().__init__(options)
30+
self.repo = repo
31+
self.repo_basename = repo.split('/')[-1]
32+
self.branch = branch
33+
2834
def run(self):
29-
if os.path.exists("../swift/.git"):
35+
repo_dir = os.path.join('..', self.repo_basename)
36+
if os.path.exists(os.path.join(repo_dir, '.git')):
3037
return
3138
print('=====> Cloning Swift repository')
3239
git_options = []
3340
if self.options.skip_history:
34-
git_options += ['--depth', '1', '--branch', self.options.tag]
41+
git_options += ['--depth', '1', '--branch', self.branch]
3542

36-
args = ['git', 'clone'] + git_options + ['https://github.com/apple/swift.git', '../swift']
43+
args = ['git', 'clone'] + git_options + [f'https://github.com/{self.repo}.git', repo_dir]
3744
self.system(*args)
38-
print('=====> Checking out Swift tag {}'.format(self.options.tag))
39-
self.system('git', '-C', '../swift', 'checkout', self.options.tag)
45+
print('=====> Checking out Swift tag {}'.format(self.branch))
46+
self.system('git', '-C', repo_dir, 'checkout', self.branch)
4047

4148
class UpdateCheckoutAction(Action):
4249
def run(self):

tools/git-swift-workspace

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@ def main():
2121
default=[])
2222
options = derive_options_from_args(sys.argv[1:], parser)
2323
actions = [
24-
CloneAction(options), UpdateCheckoutAction(options),
24+
CloneAction(options, 'swiftlang/swift', self.options.tag),
25+
UpdateCheckoutAction(options),
26+
]
27+
if options.scheme == 'release-6.0':
28+
# release/6.0 doesn't have swift-sdk-generator configuration in update-checkout
29+
# so we need to clone it manually
30+
actions.append(CloneAction(options, 'swiftlang/swift-sdk-generator', 'swift-6.1-RELEASE'))
31+
32+
actions = actions + [
2533
ApplyPatchesAction(options, 'swift'),
2634
CheckoutCorelibsAction(options),
2735
ApplyPatchesAction(options, 'swift-corelibs-foundation'),

0 commit comments

Comments
 (0)