Fix: windows x86_64 packaging behavior
This commit is contained in:
@@ -32,6 +32,7 @@ class FrontendLayout:
|
||||
binary_name: str
|
||||
artifact_name: str
|
||||
readme_run: str
|
||||
runtime_files: tuple[str, ...] = ()
|
||||
|
||||
|
||||
FRONTENDS: dict[str, FrontendLayout] = {
|
||||
@@ -48,6 +49,7 @@ FRONTENDS: dict[str, FrontendLayout] = {
|
||||
binary_name="sprimo-tauri.exe",
|
||||
artifact_name="sprimo-tauri-windows-x64",
|
||||
readme_run="sprimo-tauri.exe",
|
||||
runtime_files=("WebView2Loader.dll",),
|
||||
),
|
||||
}
|
||||
|
||||
@@ -108,6 +110,18 @@ def ensure_release_binary(frontend: FrontendLayout) -> Path:
|
||||
return binary_path
|
||||
|
||||
|
||||
def ensure_runtime_files(frontend: FrontendLayout, binary_dir: Path) -> list[Path]:
|
||||
resolved: list[Path] = []
|
||||
for filename in frontend.runtime_files:
|
||||
path = binary_dir / filename
|
||||
if not path.exists():
|
||||
raise PackagingError(
|
||||
f"required runtime file missing for {frontend.id}: {path}"
|
||||
)
|
||||
resolved.append(path)
|
||||
return resolved
|
||||
|
||||
|
||||
def ensure_assets() -> None:
|
||||
required = [
|
||||
ASSETS_REL / "sprite-packs" / "default" / "manifest.json",
|
||||
@@ -140,6 +154,7 @@ def package(frontend: FrontendLayout) -> PackageLayout:
|
||||
version = read_version()
|
||||
ensure_assets()
|
||||
binary = ensure_release_binary(frontend)
|
||||
runtime_files = ensure_runtime_files(frontend, binary.parent)
|
||||
|
||||
DIST.mkdir(parents=True, exist_ok=True)
|
||||
artifact_name = f"{frontend.artifact_name}-v{version}"
|
||||
@@ -151,6 +166,8 @@ def package(frontend: FrontendLayout) -> PackageLayout:
|
||||
stage.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
shutil.copy2(binary, stage / frontend.binary_name)
|
||||
for runtime_file in runtime_files:
|
||||
shutil.copy2(runtime_file, stage / runtime_file.name)
|
||||
shutil.copytree(ASSETS_REL, stage / "assets", dirs_exist_ok=True)
|
||||
|
||||
readme = stage / "README.txt"
|
||||
@@ -198,6 +215,7 @@ def smoke(frontend: FrontendLayout) -> None:
|
||||
pkg_root / "assets" / "sprite-packs" / "default" / "manifest.json",
|
||||
pkg_root / "assets" / "sprite-packs" / "default" / "sprite.png",
|
||||
]
|
||||
required.extend(pkg_root / filename for filename in frontend.runtime_files)
|
||||
missing = [path for path in required if not path.exists()]
|
||||
if missing:
|
||||
joined = ", ".join(str(path) for path in missing)
|
||||
|
||||
Reference in New Issue
Block a user