@@ -376,6 +376,46 @@ def _is_any_repository_locked(pool_args: List[UpdateArguments]) -> Set[str]:
376376 return locked_repositories
377377
378378
379+ def _check_missing_clones (
380+ args : CliArguments , config : Dict [str , Any ], scheme_map : Dict [str , Any ]
381+ ):
382+ """
383+ Verify that all repositories defined in the scheme map are present in the
384+ source root directory. If a repository is missing—and not explicitly skipped—
385+ the user is prompted to re-run the script with the `--clone` option.
386+
387+ This function also respects per-repository platform restrictions: if the
388+ current platform is not listed for a repo, that repo is ignored.
389+
390+ Args:
391+ args (CliArguments): Parsed CLI arguments.
392+ config (Dict[str, Any]): deserialized `update-checkout-config.json`.
393+ scheme_map (Dict[str, str] | None): map of repo names to branches to check out.
394+
395+ Returns:
396+ Prints a warning if any required repository is missing.
397+ """
398+
399+ directory_contents = {path .name for path in args .source_root .iterdir ()}
400+ current_platform = platform .system ()
401+
402+ for repo in scheme_map :
403+ repo_config = config ["repos" ].get (repo , {})
404+
405+ if (
406+ "platforms" in repo_config
407+ and current_platform not in repo_config ["platforms" ]
408+ ):
409+ continue
410+
411+ if repo not in directory_contents and repo not in args .skip_repository_list :
412+ print (
413+ "You don't have all swift sources. "
414+ "Call this script with --clone to get them."
415+ )
416+ return
417+
418+
379419def _move_llvm_project_to_first_index (
380420 pool_args : Union [List [UpdateArguments ], List [AdditionalSwiftSourcesArguments ]],
381421):
@@ -855,17 +895,7 @@ def main() -> int:
855895 dump_repo_hashes (args , config , args .dump_hashes_config )
856896 return 0
857897
858- # Quick check whether somebody is calling update in an empty directory
859- directory_contents = args .source_root .iterdir ()
860- if not (
861- "cmark" in directory_contents
862- or "llvm" in directory_contents
863- or "clang" in directory_contents
864- ):
865- print (
866- "You don't have all swift sources. "
867- "Call this script with --clone to get them."
868- )
898+ _check_missing_clones (args = args , config = config , scheme_map = scheme_map )
869899
870900 skipped_repositories , update_results = update_all_repositories (
871901 args , config , scheme_name , scheme_map , cross_repos_pr
0 commit comments