|
16 | 16 | import sys |
17 | 17 | import traceback |
18 | 18 | from multiprocessing import freeze_support |
19 | | -from typing import Any, Dict, Optional, Set, List |
| 19 | +from typing import Any, Dict, Optional, Set, List, Union |
20 | 20 |
|
21 | 21 | from build_swift.build_swift.constants import SWIFT_SOURCE_ROOT |
22 | 22 | from .runner_arguments import AdditionalSwiftSourcesArguments, UpdateArguments |
@@ -316,8 +316,17 @@ def _is_any_repository_locked(pool_args: List[UpdateArguments]) -> Set[str]: |
316 | 316 | locked_repositories.add(repo_name) |
317 | 317 | return locked_repositories |
318 | 318 |
|
| 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 | + |
319 | 328 | def update_all_repositories(args, config, scheme_name, scheme_map, cross_repos_pr): |
320 | | - pool_args = [] |
| 329 | + pool_args: List[UpdateArguments] = [] |
321 | 330 | timestamp = get_timestamp_to_match(args.match_timestamp, args.source_root) |
322 | 331 | for repo_name in config['repos'].keys(): |
323 | 332 | 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 |
360 | 369 | f"'{repo_name}' is locked by git. Cannot update it." |
361 | 370 | for repo_name in locked_repositories |
362 | 371 | ] |
| 372 | + _move_llvm_project_to_first_index(pool_args) |
363 | 373 | return ParallelRunner(update_single_repository, pool_args, args.n_processes).run() |
364 | 374 |
|
365 | 375 |
|
@@ -493,13 +503,16 @@ def obtain_all_additional_swift_sources(args, config, with_ssh, scheme_name, |
493 | 503 |
|
494 | 504 | # Only use `ParallelRunner` when submodules are not used, since `.git` dir |
495 | 505 | # 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 |
500 | 511 |
|
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() |
503 | 516 |
|
504 | 517 |
|
505 | 518 | def dump_repo_hashes(args, config, branch_scheme_name='repro'): |
|
0 commit comments