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

47 lines
3.4 KiB
JavaScript

#!/usr/bin/env node
import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
const sourceRoot = path.join(root, "freecad-source/src/Mod/JtReader");
const docs = path.join(root, "docs/p6");
const files = {
moduleCMake: "CMakeLists.txt",
appCMake: "App/CMakeLists.txt",
appInit: "App/AppJtReader.cpp",
pythonEntry: "App/AppJtReaderPy.cpp",
fallbackReader: "App/JrJt/JtReader.cpp",
fallbackTest: "App/TestJtReader.cpp",
guiInit: "InitGui.py",
moduleInit: "Init.py"
};
const hash = (file) => crypto.createHash("sha256").update(fs.readFileSync(path.join(sourceRoot, file))).digest("hex");
const source = Object.fromEntries(Object.entries(files).map(([key, file]) => [key, { path: `src/Mod/JtReader/${file}`, sha256: hash(file) }]));
const report = {
schema: "freecad-web-p6-jtreader-source-boundary/v1",
taskId: "FW-P6-JTR-A",
module: "JtReader",
result: "pass",
sourceRevision: "4f4e9244e613ea2df06e70027074a562695048cb",
target: { cmake: "src/Mod/JtReader/App/CMakeLists.txt:51", library: "JtReader", appOnly: true, guiSubdirectory: "src/Mod/JtReader/CMakeLists.txt:4-6 is BUILD_GUI guarded and commented out" },
dependencies: { direct: ["Mesh", "${OCC_LIBRARIES}"], optional: ["TKJT via JTREADER_TKJT_INCLUDE_DIRS/JTREADER_TKJT_LIBRARIES"], pythonRuntime: true, gui: false },
entries: {
moduleRegistration: { file: "src/Mod/JtReader/App/AppJtReader.cpp", lines: "35-44", symbol: "PyMOD_INIT_FUNC(JtReader)", action: "register JtReader Python module and load Mesh" },
pythonApi: { file: "src/Mod/JtReader/App/AppJtReaderPy.cpp", lines: "48-72", symbol: "JtReaderNS::Module", methods: ["read", "open", "insert"] },
createObject: { file: "src/Mod/JtReader/App/AppJtReaderPy.cpp", lines: "100-117,137-154", symbol: "App::InventorObject", condition: "JTREADER_HAVE_TKJT" },
fallbackParser: { file: "src/Mod/JtReader/App/JrJt/JtReader.cpp", lines: "43-110", symbols: ["setFile", "readToc", "readLodSegment"], condition: "always compiled through JrJt glob" },
fallbackAction: { file: "src/Mod/JtReader/App/TestJtReader.cpp", lines: "42-57", symbol: "TestJtReader::read", action: "iterate JT TOC and segment type 7" }
},
conditions: [
{ symbol: "JTREADER_HAVE_TKJT", source: "App/CMakeLists.txt:28-39", effect: "TKJT reader and InventorObject creation enabled only when JtData_Object.hxx exists" },
{ symbol: "BUILD_GUI", source: "CMakeLists.txt:4-6", effect: "GUI target is disabled/commented; InitGui.py is not a Web runtime dependency" }
],
commands: ["rg -n \"BUILD_|Init|addObject|registerType|PyInit\" src/Mod/JtReader", "sha256 over the listed source files"],
artifacts: { source: "docs/p6/jtreader-source-boundary.json", log: "docs/freecad-p6-jtreader-a-boundary.log" },
boundaries: ["This probe confirms source boundaries only; it does not claim JtReader WASM runtime initialization or JT fixture parsing."]
};
fs.writeFileSync(path.join(docs, "jtreader-source-boundary.json"), `${JSON.stringify({ ...report, source }, null, 2)}\n`);
fs.writeFileSync(path.join(root, "docs/freecad-p6-jtreader-a-boundary.log"), `${JSON.stringify({ result: report.result, target: report.target.library, optionalTKJT: true, guiTarget: false })}\n`);
console.log(JSON.stringify({ result: report.result, target: report.target.library, entries: Object.keys(report.entries).length }));