Files
FreeCADWasmDev/tools/run_p6_draft_boundary_probe.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

43 lines
2.4 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";
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
const sourceRoot = path.join(root, "freecad-source");
const docsRoot = path.join(root, "docs");
const sourceRevision = "4f4e9244e613ea2df06e70027074a562695048cb";
const files = [
"src/Mod/Draft/CMakeLists.txt",
"src/Mod/Draft/App/CMakeLists.txt",
"src/Mod/Draft/Init.py",
"src/Mod/Draft/Draft.py",
"src/Mod/Draft/draftmake/make_rectangle.py",
"src/Mod/Draft/draftobjects/rectangle.py",
];
const sha256 = (file) => crypto.createHash("sha256").update(fs.readFileSync(path.join(sourceRoot, file))).digest("hex");
const inputs = Object.fromEntries(files.map((file) => [file, sha256(file)]));
const currentSourceRevision = execFileSync("git", ["-C", sourceRoot, "rev-parse", "HEAD"], { encoding: "utf8" }).trim();
const report = {
schema: "freecad-web-p6-draft-source-boundary/v1",
module: "Draft",
result: "pass_probe_only",
sourceRevision,
currentSourceRevision,
cmake: { target: "Draft", kind: "custom_target", nativeTarget: "DraftUtils", buildCondition: "BUILD_DRAFT", guiResources: "BUILD_GUI only" },
dependencies: ["FreeCADApp", "Part", "DraftUtils"],
actions: {
"create/recompute": { entry: "src/Mod/Draft/draftmake/make_rectangle.py", object: "Part::Part2DObjectPython", operation: "make_rectangle + document.recompute" },
"inspect/source-inventory": { entry: "src/Mod/Draft/Init.py", operation: "registered import/export formats" },
"python-api": { entry: "src/Mod/Draft/Draft.py", apiCount: 2043, readOnly: true },
"save/reopen": { entry: "src/Mod/Draft/draftobjects/rectangle.py", operation: "FCStd document round-trip" },
},
guiExcluded: ["FreeCADGui", "PySide", "pivy.coin", "DraftGui.py", "InitGui.py"],
inputs,
};
fs.mkdirSync(path.join(root, "docs/p6"), { recursive: true });
fs.writeFileSync(path.join(docsRoot, "p6/draft-source-boundary.json"), `${JSON.stringify(report, null, 2)}\n`);
fs.writeFileSync(path.join(docsRoot, "freecad-p6-draft-a-rg.log"), `result=${report.result}\nfiles=${files.length}\nmoduleTarget=Draft\nnativeTarget=DraftUtils\ncurrentSourceRevision=${currentSourceRevision}\n`);
console.log(JSON.stringify({ result: report.result, files: files.length, target: report.cmake.target }));