Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit
54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
import { spawnSync } from "node:child_process";
|
|
import { fileURLToPath } from "node:url";
|
|
import path from "node:path";
|
|
import { getReleaseArch, isBundleCefEnabled } from "./release-artifact-utils.mjs";
|
|
|
|
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
const hostArch = getReleaseArch(process.arch);
|
|
const requestedArch = process.env.ELECTROBUN_TARGET_ARCH
|
|
? getReleaseArch(process.env.ELECTROBUN_TARGET_ARCH)
|
|
: hostArch;
|
|
const bundleCef = isBundleCefEnabled();
|
|
|
|
if (requestedArch !== hostArch) {
|
|
console.error(
|
|
`Electrobun 2 builds only for the current host (${hostArch}). Cannot build macOS ${requestedArch} from this machine. Electrobun 2.0.1 does not publish macOS x64 cores.`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
const env = {
|
|
...process.env,
|
|
ELECTROBUN_BUILD_ENV: "stable",
|
|
ELECTROBUN_OS: "macos",
|
|
ELECTROBUN_ARCH: hostArch,
|
|
ELECTROBUN_FORCE_ARCH: hostArch,
|
|
ELECTROBUN_TARGET_ARCH: hostArch,
|
|
NODE_ENV: "production",
|
|
};
|
|
|
|
console.log(`Host architecture: ${hostArch}`);
|
|
console.log(`CEF bundling: ${bundleCef ? "enabled" : "disabled"}`);
|
|
console.log(
|
|
`\n=== Building macOS ${hostArch} (cef=${bundleCef}) ===`,
|
|
);
|
|
console.log(
|
|
`ELECTROBUN_BUILD_ENV=stable ELECTROBUN_OS=macos ELECTROBUN_ARCH=${hostArch} ELECTROBUN_BUNDLE_CEF=${bundleCef}\n`,
|
|
);
|
|
|
|
const result = spawnSync(
|
|
"bun",
|
|
[path.join(rootDir, "scripts/run-electrobun-build.mjs")],
|
|
{
|
|
cwd: rootDir,
|
|
stdio: "inherit",
|
|
env,
|
|
},
|
|
);
|
|
|
|
if (result.status !== 0) {
|
|
process.exit(result.status ?? 1);
|
|
}
|
|
|
|
console.log(`\nBuilt macOS architecture: ${hostArch}`);
|