Some checks reported errors
farmcontrol/farmcontrol-server/pipeline/head Something is wrong with the build of this commit
- Updated electrobun.config.ts to conditionally enable code signing and notarization based on developer ID presence. - Refactored Jenkinsfile to support separate macOS builds for x64 and arm64 architectures. - Added new scripts for ensuring core dependencies and patching Electrobun source for cross-architecture compatibility. - Enhanced build-macos.mjs to improve architecture detection and build order, ensuring robust handling of macOS builds. - Updated package.json to include a post-install script for patching Electrobun source files.
76 lines
1.7 KiB
JavaScript
76 lines
1.7 KiB
JavaScript
import { spawnSync } from "node:child_process";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { getReleaseArch } from "./release-artifact-utils.mjs";
|
|
|
|
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
const electrobunCli = path.join(
|
|
rootDir,
|
|
"node_modules/electrobun/src/cli/index.ts",
|
|
);
|
|
|
|
const buildEnv = process.env.ELECTROBUN_BUILD_ENV || "stable";
|
|
const targetArch = getReleaseArch(
|
|
process.env.ELECTROBUN_TARGET_ARCH ||
|
|
process.env.ELECTROBUN_FORCE_ARCH ||
|
|
process.arch,
|
|
);
|
|
|
|
const patchResult = spawnSync("bun", [path.join(rootDir, "scripts/patch-electrobun-src.mjs")], {
|
|
cwd: rootDir,
|
|
stdio: "inherit",
|
|
env: process.env,
|
|
});
|
|
|
|
if (patchResult.status !== 0) {
|
|
process.exit(patchResult.status ?? 1);
|
|
}
|
|
|
|
const ensureCoreEnv = {
|
|
...process.env,
|
|
ELECTROBUN_TARGET_ARCH: targetArch,
|
|
ELECTROBUN_FORCE_ARCH: targetArch,
|
|
};
|
|
|
|
const ensureCoreResult = spawnSync(
|
|
"bun",
|
|
[path.join(rootDir, "scripts/ensure-electrobun-core.mjs")],
|
|
{
|
|
cwd: rootDir,
|
|
stdio: "inherit",
|
|
env: ensureCoreEnv,
|
|
},
|
|
);
|
|
|
|
if (ensureCoreResult.status !== 0) {
|
|
process.exit(ensureCoreResult.status ?? 1);
|
|
}
|
|
|
|
const env = {
|
|
...process.env,
|
|
ELECTROBUN_BUILD_ENV: buildEnv,
|
|
ELECTROBUN_OS: "macos",
|
|
ELECTROBUN_ARCH: targetArch,
|
|
ELECTROBUN_FORCE_ARCH: targetArch,
|
|
ELECTROBUN_TARGET_ARCH: targetArch,
|
|
NODE_ENV: process.env.NODE_ENV || "production",
|
|
};
|
|
|
|
console.log(
|
|
`run-electrobun-build: env=${buildEnv} os=macos arch=${targetArch} (host ${getReleaseArch(process.arch)})`,
|
|
);
|
|
|
|
const result = spawnSync(
|
|
"bun",
|
|
[electrobunCli, "build", `--env=${buildEnv}`],
|
|
{
|
|
cwd: rootDir,
|
|
stdio: "inherit",
|
|
env,
|
|
},
|
|
);
|
|
|
|
if (result.status !== 0) {
|
|
process.exit(result.status ?? 1);
|
|
}
|