Files
PaperClipAI/server/src/services/native-runtime/cargo-test-binary.ts
T
DottaandPaperclip 42113e89db feat(server): integrate indexed native recovery and checkpoints
Part 4 of the opt-in indexed history draft series. Validated at the integrated tip; activation remains disabled by default.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-09-29 16:20:49 -05:00

30 lines
989 B
TypeScript

import { isAbsolute, resolve } from "node:path";
/** Resolve Cargo integration-test binaries under the target directory used by
* the matching runner workspace build.
*/
export function resolveRunnerCargoTestBinary(
runnerWorkspace: string,
profile: "debug" | "release",
binaryName: string,
): string {
const configuredTarget = process.env.CARGO_TARGET_DIR;
const targetDirectory = configuredTarget
? isAbsolute(configuredTarget)
? configuredTarget
: resolve(runnerWorkspace, configuredTarget)
: resolve(runnerWorkspace, "target");
return resolve(targetDirectory, profile, `${binaryName}${process.platform === "win32" ? ".exe" : ""}`);
}
export function resolveRunnerCargoTestBinaryOrDefault(
runnerWorkspace: string,
profile: "debug" | "release",
binaryName: string,
defaultBinary: () => string,
): string {
return process.env.CARGO_TARGET_DIR
? resolveRunnerCargoTestBinary(runnerWorkspace, profile, binaryName)
: defaultBinary();
}