feat: add NWNX C++ build pipeline
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
|||||||
hotReloadScripts,
|
hotReloadScripts,
|
||||||
compileSingle,
|
compileSingle,
|
||||||
buildHaks,
|
buildHaks,
|
||||||
|
buildNWNX,
|
||||||
} from "../services/build.service.js";
|
} from "../services/build.service.js";
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
@@ -57,4 +58,14 @@ router.post("/haks", async (_req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.post("/nwnx", async (req, res) => {
|
||||||
|
const { target } = req.body;
|
||||||
|
try {
|
||||||
|
const result = await buildNWNX(target);
|
||||||
|
res.json(result);
|
||||||
|
} catch (err: any) {
|
||||||
|
res.status(500).json({ error: err.message });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
@@ -120,3 +120,38 @@ export async function buildHaks(): Promise<{
|
|||||||
});
|
});
|
||||||
return { success, output: result.output };
|
return { success, output: result.output };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function buildNWNX(
|
||||||
|
target?: string,
|
||||||
|
): Promise<{ success: boolean; output: string }> {
|
||||||
|
const workspacePath = getWorkspacePath();
|
||||||
|
|
||||||
|
broadcast("build", "start", { type: "nwnx", target });
|
||||||
|
|
||||||
|
const cmd = target
|
||||||
|
? [
|
||||||
|
"bash",
|
||||||
|
"-c",
|
||||||
|
`cd /build/unified/build-nwnx && cmake --build . --target ${target} --parallel $(nproc)`,
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
"bash",
|
||||||
|
"-c",
|
||||||
|
"cd /build/unified && mkdir -p build-nwnx && cd build-nwnx && cmake .. && cmake --build . --parallel $(nproc)",
|
||||||
|
];
|
||||||
|
|
||||||
|
const result = await runEphemeralContainer({
|
||||||
|
image: "layonara-builder",
|
||||||
|
cmd,
|
||||||
|
binds: [`${workspacePath}/repos/unified:/build/unified`],
|
||||||
|
workingDir: "/build/unified",
|
||||||
|
});
|
||||||
|
|
||||||
|
const success = result.statusCode === 0;
|
||||||
|
broadcast("build", success ? "complete" : "failed", {
|
||||||
|
type: "nwnx",
|
||||||
|
target,
|
||||||
|
exitCode: result.statusCode,
|
||||||
|
});
|
||||||
|
return { success, output: result.output };
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user