Compare commits
No commits in common. "eb49ba7ce3d73aec3000ae7c93b11a8d9a9cb17c" and "11a0f3484d5a5eefd8bacd337abafc63ed7fa1e7" have entirely different histories.
eb49ba7ce3
...
11a0f3484d
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB |
@ -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() {
|
function findCreateDmgCommand() {
|
||||||
const which = spawnSync("which", ["create-dmg"], { encoding: "utf8" });
|
const which = spawnSync("which", ["create-dmg"], { encoding: "utf8" });
|
||||||
if (which.status === 0 && which.stdout.trim()) {
|
if (which.status === 0 && which.stdout.trim()) {
|
||||||
@ -253,50 +207,24 @@ function findCreateDmgCommand() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildMacDmgWithCreateDmg(
|
function buildMacDmgWithCreateDmg(createDmg, dmgPath, sourceFolder) {
|
||||||
createDmg,
|
|
||||||
dmgPath,
|
|
||||||
sourceFolder,
|
|
||||||
appBundleName,
|
|
||||||
dmgAssets,
|
|
||||||
) {
|
|
||||||
rmSync(dmgPath, { force: true });
|
rmSync(dmgPath, { force: true });
|
||||||
|
|
||||||
const args = [
|
const result = spawnSync(
|
||||||
"--volname",
|
createDmg,
|
||||||
"Farm Control Server",
|
[
|
||||||
"--window-pos",
|
"--volname",
|
||||||
"200",
|
"Farm Control Server",
|
||||||
"120",
|
"--app-drop-link",
|
||||||
"--window-size",
|
"480",
|
||||||
String(MAC_DMG_WINDOW_WIDTH),
|
"170",
|
||||||
String(MAC_DMG_WINDOW_HEIGHT),
|
"--format",
|
||||||
"--icon-size",
|
"UDZO",
|
||||||
"120",
|
dmgPath,
|
||||||
"--icon",
|
sourceFolder,
|
||||||
appBundleName,
|
],
|
||||||
"98",
|
{ stdio: "inherit" },
|
||||||
"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" });
|
|
||||||
|
|
||||||
if (result.status !== 0) {
|
if (result.status !== 0) {
|
||||||
throw new Error(`create-dmg failed with exit code ${result.status ?? 1}`);
|
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(
|
const dmgPath = path.join(
|
||||||
artifactDir,
|
artifactDir,
|
||||||
getReleaseArtifactName(version, arch, "dmg"),
|
getReleaseArtifactName(version, arch, "dmg"),
|
||||||
@ -376,16 +297,9 @@ async function buildMacDmg(appBundlePath, arch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let builtDmgPath;
|
let builtDmgPath;
|
||||||
const dmgAssets = ensureMacDmgAssets();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
builtDmgPath = buildMacDmgWithCreateDmg(
|
builtDmgPath = buildMacDmgWithCreateDmg(createDmg, dmgPath, sourceFolder);
|
||||||
createDmg,
|
|
||||||
dmgPath,
|
|
||||||
sourceFolder,
|
|
||||||
appBundleName,
|
|
||||||
dmgAssets,
|
|
||||||
);
|
|
||||||
} finally {
|
} finally {
|
||||||
if (!useDirectSource) {
|
if (!useDirectSource) {
|
||||||
rmSync(stagingDir, { recursive: true, force: true });
|
rmSync(stagingDir, { recursive: true, force: true });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user