|
17 | 17 | import sys |
18 | 18 | import traceback |
19 | 19 | from multiprocessing import freeze_support |
20 | | -from typing import Any, Dict, Optional, Set, List |
| 20 | +from typing import Any, Dict, Optional, Set, List, Union |
21 | 21 |
|
22 | 22 | from build_swift.build_swift.constants import SWIFT_SOURCE_ROOT |
23 | 23 | from .runner_arguments import AdditionalSwiftSourcesArguments, UpdateArguments |
@@ -340,8 +340,17 @@ def _is_any_repository_locked(pool_args: List[UpdateArguments]) -> Set[str]: |
340 | 340 | locked_repositories.add(repo_name) |
341 | 341 | return locked_repositories |
342 | 342 |
|
| 343 | +def _move_llvm_project_to_first_index(pool_args: List[Union[UpdateArguments, AdditionalSwiftSourcesArguments]]): |
| 344 | + llvm_project_idx = None |
| 345 | + for i in range(len(pool_args)): |
| 346 | + if pool_args[i].repo_name == "llvm-project": |
| 347 | + llvm_project_idx = i |
| 348 | + break |
| 349 | + if llvm_project_idx is not None: |
| 350 | + pool_args.insert(0, pool_args.pop(llvm_project_idx)) |
| 351 | + |
343 | 352 | def update_all_repositories(args, config, scheme_name, scheme_map, cross_repos_pr): |
344 | | - pool_args = [] |
| 353 | + pool_args: List[UpdateArguments] = [] |
345 | 354 | timestamp = get_timestamp_to_match(args.match_timestamp, args.source_root) |
346 | 355 | for repo_name in config['repos'].keys(): |
347 | 356 | if repo_name in args.skip_repository_list: |
@@ -384,6 +393,7 @@ def update_all_repositories(args, config, scheme_name, scheme_map, cross_repos_p |
384 | 393 | f"'{repo_name}' is locked by git. Cannot update it." |
385 | 394 | for repo_name in locked_repositories |
386 | 395 | ] |
| 396 | + _move_llvm_project_to_first_index(pool_args) |
387 | 397 | return ParallelRunner(update_single_repository, pool_args, args.n_processes).run() |
388 | 398 |
|
389 | 399 |
|
@@ -517,13 +527,16 @@ def obtain_all_additional_swift_sources(args, config, with_ssh, scheme_name, |
517 | 527 |
|
518 | 528 | # Only use `ParallelRunner` when submodules are not used, since `.git` dir |
519 | 529 | # can't be accessed concurrently. |
520 | | - if not use_submodules: |
521 | | - if not pool_args: |
522 | | - print("Not cloning any repositories.") |
523 | | - return |
| 530 | + if use_submodules: |
| 531 | + return |
| 532 | + if not pool_args: |
| 533 | + print("Not cloning any repositories.") |
| 534 | + return |
524 | 535 |
|
525 | | - return ParallelRunner( |
526 | | - obtain_additional_swift_sources, pool_args, args.n_processes).run() |
| 536 | + _move_llvm_project_to_first_index(pool_args) |
| 537 | + return ParallelRunner( |
| 538 | + obtain_additional_swift_sources, pool_args, args.n_processes |
| 539 | + ).run() |
527 | 540 |
|
528 | 541 |
|
529 | 542 | def dump_repo_hashes(args, config, branch_scheme_name='repro'): |
|
0 commit comments