Files
FreeCADWasmDev/tools/run_p6_partdesign_runtime.mjs
wangdequan 9a7c4f0335 Save FreeCAD Web workspace sources and user validation evidence
IFC native binding remains incomplete; preserve accurate test results.
2026-09-15 22:01:58 +08:00

34 lines
2.8 KiB
JavaScript

#!/usr/bin/env node
import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
import { execFileSync } from "node:child_process";
import { fileURLToPath } from "node:url";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const sourceRoot = path.join(root, "freecad-source");
const build = path.resolve(process.argv[2] ?? path.join(sourceRoot, "build-web/configure/bin"));
const smoke = path.join(sourceRoot, "src/WebAssembly/FreeCADCoreProbe/partdesign-runtime-smoke.js");
const stdout = execFileSync(process.execPath, [smoke, build], { cwd: sourceRoot, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
const result = JSON.parse(stdout.trim().split(/\r?\n/).filter(Boolean).at(-1));
const boundaryPath = path.join(root, "docs/p6/partdesign-source-boundary.json");
const wasmPath = path.join(build, "FreeCADWebPartDesignRuntimeProbe.wasm");
const report = {
schema: "freecad-web-partdesign-runtime/v1",
task_id: "FW-P6-PDN-B",
status: "pass",
source_revision: JSON.parse(fs.readFileSync(boundaryPath, "utf8")).source_revision,
input_sha256: crypto.createHash("sha256").update(fs.readFileSync(boundaryPath)).digest("hex"),
commands: ["EM_CONFIG=/absolute/build-web/emscripten-config.py env -u EM_FROZEN_CACHE ninja -C build-web/configure FreeCADWebPartDesignRuntimeProbe -j8", "node src/WebAssembly/FreeCADCoreProbe/partdesign-runtime-smoke.js build-web/configure/bin"],
result,
artifacts: {
javascript: { path: "freecad-source/build-web/configure/bin/FreeCADWebPartDesignRuntimeProbe.js", bytes: fs.statSync(path.join(build, "FreeCADWebPartDesignRuntimeProbe.js")).size, sha256: crypto.createHash("sha256").update(fs.readFileSync(path.join(build, "FreeCADWebPartDesignRuntimeProbe.js"))).digest("hex") },
wasm: { path: "freecad-source/build-web/configure/bin/FreeCADWebPartDesignRuntimeProbe.wasm", bytes: fs.statSync(wasmPath).size, sha256: crypto.createHash("sha256").update(fs.readFileSync(wasmPath)).digest("hex") },
},
boundaries: ["PartDesign and Sketcher are initialized from the real native static libraries; repeated initialization runs once.", "PartDesignGui is intentionally rejected in the GUI-free Web kernel.", "This B card closes registration and dependency behavior only; create/recompute, Facade, Chrome and persistence remain later cards."],
};
const docs = path.join(root, "docs/p6");
fs.writeFileSync(path.join(docs, "partdesign-runtime.json"), `${JSON.stringify(report, null, 2)}\n`);
fs.writeFileSync(path.join(root, "docs/freecad-p6-partdesign-b-smoke.log"), `${JSON.stringify({ status: report.status, result: report.result, wasmSha256: report.artifacts.wasm.sha256 })}\n`);
console.log(JSON.stringify({ status: report.status, initializationRuns: result.initializationRuns, registeredTypes: result.registeredTypes, wasmSha256: report.artifacts.wasm.sha256 }));