Compare commits

..

No commits in common. "eb49ba7ce3d73aec3000ae7c93b11a8d9a9cb17c" and "11a0f3484d5a5eefd8bacd337abafc63ed7fa1e7" have entirely different histories.

3 changed files with 17 additions and 103 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

View File

@ -189,52 +189,6 @@ function cleanStagingArtifacts(keepNames) {
}
}
const MAC_DMG_ASSETS_DIR = path.join(rootDir, "packaging/macos/dmg");
const MAC_DMG_BACKGROUND_PATH = path.join(rootDir, "assets/dmg/background.png");
const MAC_DMG_BACKGROUND_RETINA_PATH = path.join(
rootDir,
"assets/dmg/background@2x.png",
);
const MAC_DMG_APP_NAME = "Farm Control Server.app";
const MAC_DMG_WINDOW_WIDTH = 380;
const MAC_DMG_WINDOW_HEIGHT = 540;
function ensureMacDmgAssets() {
mkdirSync(MAC_DMG_ASSETS_DIR, { recursive: true });
const voliconPath = path.join(MAC_DMG_ASSETS_DIR, "volicon.icns");
const iconsetPath = path.join(rootDir, "assets/icon.iconset");
if (!existsSync(voliconPath) && existsSync(iconsetPath)) {
const iconutil = spawnSync(
"iconutil",
["-c", "icns", "-o", voliconPath, iconsetPath],
{ stdio: "inherit" },
);
if (iconutil.status !== 0) {
throw new Error(
`iconutil failed to create DMG volicon with exit code ${iconutil.status ?? 1}`,
);
}
}
if (!existsSync(MAC_DMG_BACKGROUND_PATH)) {
throw new Error(`DMG background not found at ${MAC_DMG_BACKGROUND_PATH}`);
}
if (!existsSync(MAC_DMG_BACKGROUND_RETINA_PATH)) {
console.warn(
`finalize-desktop-artifacts: retina DMG background not found at ${MAC_DMG_BACKGROUND_RETINA_PATH}`,
);
}
return {
volicon: existsSync(voliconPath) ? voliconPath : null,
background: MAC_DMG_BACKGROUND_PATH,
};
}
function findCreateDmgCommand() {
const which = spawnSync("which", ["create-dmg"], { encoding: "utf8" });
if (which.status === 0 && which.stdout.trim()) {
@ -253,50 +207,24 @@ function findCreateDmgCommand() {
return null;
}
function buildMacDmgWithCreateDmg(
createDmg,
dmgPath,
sourceFolder,
appBundleName,
dmgAssets,
) {
function buildMacDmgWithCreateDmg(createDmg, dmgPath, sourceFolder) {
rmSync(dmgPath, { force: true });
const args = [
"--volname",
"Farm Control Server",
"--window-pos",
"200",
"120",
"--window-size",
String(MAC_DMG_WINDOW_WIDTH),
String(MAC_DMG_WINDOW_HEIGHT),
"--icon-size",
"120",
"--icon",
appBundleName,
"98",
"270",
"--hide-extension",
appBundleName,
"--app-drop-link",
"282",
"270",
"--format",
"UDZO",
];
if (dmgAssets.volicon) {
args.push("--volicon", dmgAssets.volicon);
}
if (dmgAssets.background) {
args.push("--background", dmgAssets.background);
}
args.push(dmgPath, sourceFolder);
const result = spawnSync(createDmg, args, { stdio: "inherit" });
const result = spawnSync(
createDmg,
[
"--volname",
"Farm Control Server",
"--app-drop-link",
"480",
"170",
"--format",
"UDZO",
dmgPath,
sourceFolder,
],
{ stdio: "inherit" },
);
if (result.status !== 0) {
throw new Error(`create-dmg failed with exit code ${result.status ?? 1}`);
@ -341,13 +269,6 @@ async function buildMacDmg(appBundlePath, arch) {
);
}
const appBundleName = path.basename(appBundlePath);
if (appBundleName !== MAC_DMG_APP_NAME) {
console.warn(
`finalize-desktop-artifacts: expected ${MAC_DMG_APP_NAME}, found ${appBundleName}`,
);
}
const dmgPath = path.join(
artifactDir,
getReleaseArtifactName(version, arch, "dmg"),
@ -376,16 +297,9 @@ async function buildMacDmg(appBundlePath, arch) {
}
let builtDmgPath;
const dmgAssets = ensureMacDmgAssets();
try {
builtDmgPath = buildMacDmgWithCreateDmg(
createDmg,
dmgPath,
sourceFolder,
appBundleName,
dmgAssets,
);
builtDmgPath = buildMacDmgWithCreateDmg(createDmg, dmgPath, sourceFolder);
} finally {
if (!useDirectSource) {
rmSync(stagingDir, { recursive: true, force: true });