feat(factory): auto-sync latest bins after idf build

This commit is contained in:
admin
2026-03-02 13:44:56 +08:00
parent 5cd0c51be0
commit 673b257c4f
5 changed files with 169 additions and 8 deletions

View File

@@ -359,10 +359,13 @@ def _sync_bins_from_build(
enabled: bool,
) -> None:
if not enabled:
print(f"[INFO] Skip build sync; package directly from {_rel(bin_dir)}/")
return
copied = sync_bins_from_idf_build(bin_dir, required_bins, build_dir)
copied = sync_bins_from_idf_build(bin_dir, required_bins, build_dir, overwrite=True)
for source, target in copied:
print(f"[INFO] Sync build bin: {source} -> {_rel(target)}")
if not copied:
print("[INFO] Build sync enabled but no bin files were updated.")
def _resolve_icon() -> Optional[Path]:
@@ -691,12 +694,12 @@ def main() -> None:
parser.add_argument(
"--build-dir",
default=str(DEFAULT_IDF_BUILD_DIR),
help="ESP-IDF build directory for auto-syncing missing .bin files.",
help="ESP-IDF build directory used when --sync-build-bins is enabled.",
)
parser.add_argument(
"--no-sync-build-bins",
"--sync-build-bins",
action="store_true",
help="Disable auto-sync of missing bins from build/flasher_args.json.",
help="Overwrite-sync required bins from build/flasher_args.json before packaging.",
)
args = parser.parse_args()
@@ -712,7 +715,7 @@ def main() -> None:
bin_dir=bin_dir,
required_bins=required_bins,
build_dir=build_dir,
enabled=not args.no_sync_build_bins,
enabled=args.sync_build_bins,
)
ensure_flash_files(bin_dir, required_bins)
for tool in targets: