Skip to content

Commit 1c6268c

Browse files
committed
Fixed repos not being cloned
## Bug Investigation Summary **Root Cause:** The `repos.json` configuration file was never being loaded into the workspace configuration. This happened because: 1. `load_configs()` explicitly excluded `repos.json` from processing (line 759) 2. `get_workspace_repos()` expected a dictionary with a 'repos' key, but received a list of platform configs 3. This caused the function to return early without cloning any repositories **Changes Made:** 1. **Modified `load_configs()` function:** - Now loads `repos.json` if it exists - Stores the repos data in `globals_config['repos']` 2. **Modified the call to `get_workspace_repos()` in `main()`:** - Constructs a proper config dictionary with both 'repos' and 'platforms' keys - Passes this structure to `get_workspace_repos()` **Verification:** - The code changes are syntactically correct - The logic flow now properly loads and passes the repos configuration - All pre-existing errors in the file are unrelated to these changes The fix ensures that `repos.json` is properly loaded and all repositories defined in it will be cloned during workspace setup. Made changes.
1 parent 71cef5e commit 1c6268c

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

flutter_workspace.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,13 @@ def main():
487487
if not is_exist:
488488
os.makedirs(app_folder)
489489

490-
get_workspace_repos(app_folder, configs)
490+
# Construct config dict for get_workspace_repos
491+
# It expects {'repos': [...], 'platforms': [...]}
492+
workspace_config = {
493+
'repos': globals_.get('repos', []),
494+
'platforms': configs
495+
}
496+
get_workspace_repos(app_folder, workspace_config)
491497

492498
#
493499
# Prepend depot_tools to PATH
@@ -757,9 +763,20 @@ def load_configs(config_dir: Path, flutter_version_override: str = '', enable: s
757763
enable_list = enable.split(',') if enable else []
758764
disable_list = disable.split(',') if disable else []
759765

766+
# Load repos.json if it exists and store in globals_config
767+
repos_path = config_dir / "repos.json"
768+
if repos_path.exists():
769+
print(f"Loading repos config: {repos_path}")
770+
repos_data = load_json_config(repos_path)
771+
if isinstance(repos_data, list):
772+
globals_config['repos'] = repos_data
773+
else:
774+
print(f"WARNING: {repos_path} did not load as a list, skipping")
775+
else:
776+
print(f"WARNING: repos.json not found at {repos_path}, proceeding without it")
777+
760778
# Files to skip (not platform configs)
761779
skip_files = {'globals.json', 'repos.json'}
762-
763780
# Load all platform config files (excluding globals.json and repos.json)
764781
configs = []
765782
for config_file in sorted(config_dir.glob("*.json")):
@@ -1170,6 +1187,8 @@ def get_workspace_repos(base_folder, config):
11701187
import concurrent.futures
11711188

11721189
if 'repos' not in config:
1190+
# print warning
1191+
print_banner("No `configs/repos.json` file found, skipping repo clone")
11731192
return
11741193

11751194
repos = config['repos']

0 commit comments

Comments
 (0)