Skip to content

Commit 29c924b

Browse files
[update-checkout] make llvm-project be the first project
1 parent c89a71a commit 29c924b

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

utils/update_checkout/update_checkout/update_checkout.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import sys
1717
import traceback
1818
from multiprocessing import freeze_support
19-
from typing import Any, Dict, Optional, Set, List
19+
from typing import Any, Dict, Optional, Set, List, Union
2020

2121
from build_swift.build_swift.constants import SWIFT_SOURCE_ROOT
2222
from .runner_arguments import AdditionalSwiftSourcesArguments, UpdateArguments
@@ -316,8 +316,17 @@ def _is_any_repository_locked(pool_args: List[UpdateArguments]) -> Set[str]:
316316
locked_repositories.add(repo_name)
317317
return locked_repositories
318318

319+
def _move_llvm_project_to_first_index(pool_args: List[Union[UpdateArguments, AdditionalSwiftSourcesArguments]]):
320+
llvm_project_idx = None
321+
for i in range(len(pool_args)):
322+
if pool_args[i].repo_name == "llvm-project":
323+
llvm_project_idx = i
324+
break
325+
if llvm_project_idx is not None:
326+
pool_args.insert(0, pool_args.pop(llvm_project_idx))
327+
319328
def update_all_repositories(args, config, scheme_name, scheme_map, cross_repos_pr):
320-
pool_args = []
329+
pool_args: List[UpdateArguments] = []
321330
timestamp = get_timestamp_to_match(args.match_timestamp, args.source_root)
322331
for repo_name in config['repos'].keys():
323332
if repo_name in args.skip_repository_list:
@@ -360,6 +369,7 @@ def update_all_repositories(args, config, scheme_name, scheme_map, cross_repos_p
360369
f"'{repo_name}' is locked by git. Cannot update it."
361370
for repo_name in locked_repositories
362371
]
372+
_move_llvm_project_to_first_index(pool_args)
363373
return ParallelRunner(update_single_repository, pool_args, args.n_processes).run()
364374

365375

@@ -493,13 +503,16 @@ def obtain_all_additional_swift_sources(args, config, with_ssh, scheme_name,
493503

494504
# Only use `ParallelRunner` when submodules are not used, since `.git` dir
495505
# can't be accessed concurrently.
496-
if not use_submodules:
497-
if not pool_args:
498-
print("Not cloning any repositories.")
499-
return
506+
if use_submodules:
507+
return
508+
if not pool_args:
509+
print("Not cloning any repositories.")
510+
return
500511

501-
return ParallelRunner(
502-
obtain_additional_swift_sources, pool_args, args.n_processes).run()
512+
_move_llvm_project_to_first_index(pool_args)
513+
return ParallelRunner(
514+
obtain_additional_swift_sources, pool_args, args.n_processes
515+
).run()
503516

504517

505518
def dump_repo_hashes(args, config, branch_scheme_name='repro'):

0 commit comments

Comments
 (0)