mirror of
https://github.com/bitwarden/browser
synced 2026-03-02 19:41:26 +00:00
Moves the autofill extension building to after pack
This commit is contained in:
@@ -5,6 +5,7 @@ const path = require("path");
|
||||
const { notarize } = require("@electron/notarize");
|
||||
const { deepAssign } = require("builder-util");
|
||||
const fse = require("fs-extra");
|
||||
const buildExtension = require('./build-macos-extension.js');
|
||||
|
||||
exports.default = run;
|
||||
|
||||
@@ -16,12 +17,19 @@ async function run(context) {
|
||||
const appPath = `${context.appOutDir}/${appName}.app`;
|
||||
const macBuild = context.electronPlatformName === "darwin";
|
||||
const copySafariExtension = ["darwin", "mas"].includes(context.electronPlatformName);
|
||||
const copyAutofillExtension = ["mas"].includes(context.electronPlatformName);
|
||||
const copyAutofillExtension = ["darwin", "mas"].includes(context.electronPlatformName);
|
||||
const isTempBuild = context.appOutDir.includes("temp");
|
||||
|
||||
let shouldResign = false;
|
||||
|
||||
// cannot use extraFiles because it modifies the extensions .plist and makes it invalid
|
||||
if (copyAutofillExtension) {
|
||||
if (!isTempBuild) {
|
||||
await buildExtension.default(context);
|
||||
} else {
|
||||
console.log("### Packing in a temporary build location - skipping autofill extension build");
|
||||
}
|
||||
|
||||
console.log("### Copying autofill extension");
|
||||
const extensionPath = path.join(__dirname, "../macos/dist/autofill-extension.appex");
|
||||
if (!fse.existsSync(extensionPath)) {
|
||||
|
||||
@@ -10,10 +10,13 @@ const paths = {
|
||||
extensionDistDir: "./macos/dist",
|
||||
extensionDist: "./macos/dist/autofill-extension.appex",
|
||||
macOsProject: "./macos/desktop.xcodeproj",
|
||||
macOsConfig: "./macos/production.xcconfig",
|
||||
};
|
||||
|
||||
async function buildMacOs() {
|
||||
exports.default = buildMacOs;
|
||||
|
||||
async function buildMacOs(context) {
|
||||
console.log("### Building Autofill Extension");
|
||||
|
||||
if (fse.existsSync(paths.macosBuild)) {
|
||||
fse.removeSync(paths.macosBuild);
|
||||
}
|
||||
@@ -22,15 +25,35 @@ async function buildMacOs() {
|
||||
fse.removeSync(paths.extensionDistDir);
|
||||
}
|
||||
|
||||
let configuration;
|
||||
if (context !== undefined) {
|
||||
// Extract the first target name (assuming there's at least one target)
|
||||
const appOutDir = context.appOutDir;
|
||||
|
||||
if (appOutDir.includes("mas-dev")) {
|
||||
configuration = "Debug";
|
||||
} else if (appOutDir.includes("mas")) {
|
||||
configuration = "ReleaseAppStore";
|
||||
} else if (appOutDir.includes("mac")) {
|
||||
configuration = "ReleaseDeveloper";
|
||||
} else {
|
||||
console.log("########## UNABLE TO DETERMINE CONFIGURATION ##########");
|
||||
console.log("########## Skipping Autofill Extension Build ##########");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
console.log("### No context found, defaulting to the Debug configuration");
|
||||
configuration = "Debug";
|
||||
}
|
||||
|
||||
const proc = child.spawn("xcodebuild", [
|
||||
"-project",
|
||||
paths.macOsProject,
|
||||
"-alltargets",
|
||||
"-configuration",
|
||||
"Release",
|
||||
// Uncomment when signing is fixed
|
||||
"-xcconfig",
|
||||
paths.macOsConfig,
|
||||
configuration,
|
||||
"CODE_SIGN_INJECT_BASE_ENTITLEMENTS=NO",
|
||||
"OTHER_CODE_SIGN_FLAGS='--timestamp'"
|
||||
]);
|
||||
stdOutProc(proc);
|
||||
await new Promise((resolve, reject) =>
|
||||
|
||||
Reference in New Issue
Block a user