[PM-13361] Fix DDG DMG builds (#11878)

This commit is contained in:
Daniel García 2024-11-06 17:46:57 +01:00 committed by GitHub
parent dce8c0a61a
commit a9595b4d14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 33 additions and 17 deletions

View File

@ -58,30 +58,46 @@ async function run(context) {
id = identities[0].id; id = identities[0].id;
} }
console.log(`Signing proxy binary before the main bundle, using identity '${id}'`); console.log(
`Signing proxy binary before the main bundle, using identity '${id}', for build ${context.electronPlatformName}`,
);
const appName = context.packager.appInfo.productFilename; const appName = context.packager.appInfo.productFilename;
const appPath = `${context.appOutDir}/${appName}.app`; const appPath = `${context.appOutDir}/${appName}.app`;
const proxyPath = path.join(appPath, "Contents", "MacOS", "desktop_proxy"); const proxyPath = path.join(appPath, "Contents", "MacOS", "desktop_proxy");
const inheritProxyPath = path.join(appPath, "Contents", "MacOS", "desktop_proxy.inherit");
const packageId = "com.bitwarden.desktop"; const packageId = "com.bitwarden.desktop";
const entitlementsName = "entitlements.desktop_proxy.plist";
const entitlementsPath = path.join(__dirname, "..", "resources", entitlementsName);
child_process.execSync(
`codesign -s '${id}' -i ${packageId} -f --timestamp --options runtime --entitlements ${entitlementsPath} ${proxyPath}`,
);
const inheritProxyPath = path.join(appPath, "Contents", "MacOS", "desktop_proxy.inherit"); if (is_mas) {
const inheritEntitlementsName = "entitlements.desktop_proxy.inherit.plist"; const entitlementsName = "entitlements.desktop_proxy.plist";
const inheritEntitlementsPath = path.join( const entitlementsPath = path.join(__dirname, "..", "resources", entitlementsName);
__dirname, child_process.execSync(
"..", `codesign -s '${id}' -i ${packageId} -f --timestamp --options runtime --entitlements ${entitlementsPath} ${proxyPath}`,
"resources", );
inheritEntitlementsName,
); const inheritEntitlementsName = "entitlements.desktop_proxy.inherit.plist";
child_process.execSync( const inheritEntitlementsPath = path.join(
`codesign -s '${id}' -i ${packageId} -f --timestamp --options runtime --entitlements ${inheritEntitlementsPath} ${inheritProxyPath}`, __dirname,
); "..",
"resources",
inheritEntitlementsName,
);
child_process.execSync(
`codesign -s '${id}' -i ${packageId} -f --timestamp --options runtime --entitlements ${inheritEntitlementsPath} ${inheritProxyPath}`,
);
} else {
// For non-Appstore builds, we don't need the inherit binary as they are not sandboxed,
// but we sign and include it anyway for consistency. It should be removed once DDG supports the proxy directly.
const entitlementsName = "entitlements.mac.plist";
const entitlementsPath = path.join(__dirname, "..", "resources", entitlementsName);
child_process.execSync(
`codesign -s '${id}' -i ${packageId} -f --timestamp --options runtime --entitlements ${entitlementsPath} ${proxyPath}`,
);
child_process.execSync(
`codesign -s '${id}' -i ${packageId} -f --timestamp --options runtime --entitlements ${entitlementsPath} ${inheritProxyPath}`,
);
}
} }
} }