refactor: change defined(MAS_BUILD) to IS_MAS_BUILD() (#36332)
* refactor: change defined(MAS_BUILD) to IS_MAS_BUILD() This is missing-definition safe and thus allows us to move the definition of this macro away from "all compilation targets" to "just the compilation targets that depend on this macro". In turn this makes the rebuild time changing from mas <-> darwin only 80 seconds on my machine, instead of the 12-15 minutes it used to take. This will also allow us in the future to build both MAS and darwin on the same CI machine. Costing us ~2 minutes on one machine but saving us anywhere from 30 minutes to an hour of CI time on other parts of the matrix. * build: always define IS_MAS_BUILD even on non-mac builds * build: use extra_configs
This commit is contained in:
parent
d8bb172318
commit
a9ef68f126
30 changed files with 455 additions and 167 deletions
|
@ -62,7 +62,7 @@
|
|||
#include "v8/include/v8.h"
|
||||
#endif
|
||||
|
||||
#if !defined(MAS_BUILD)
|
||||
#if !IS_MAS_BUILD()
|
||||
#include "components/crash/core/app/crash_switches.h" // nogncheck
|
||||
#include "components/crash/core/app/crashpad.h" // nogncheck
|
||||
#include "components/crash/core/common/crash_key.h"
|
||||
|
@ -301,7 +301,7 @@ absl::optional<int> ElectronMainDelegate::BasicStartupComplete() {
|
|||
<< " is not supported. See https://crbug.com/638180.";
|
||||
#endif
|
||||
|
||||
#if defined(MAS_BUILD)
|
||||
#if IS_MAS_BUILD()
|
||||
// In MAS build we are using --disable-remote-core-animation.
|
||||
//
|
||||
// According to ccameron:
|
||||
|
@ -345,7 +345,7 @@ void ElectronMainDelegate::PreSandboxStartup() {
|
|||
process_type == ::switches::kZygoteProcess);
|
||||
#endif
|
||||
|
||||
#if !defined(MAS_BUILD)
|
||||
#if !IS_MAS_BUILD()
|
||||
crash_reporter::InitializeCrashKeys();
|
||||
#endif
|
||||
|
||||
|
@ -357,7 +357,7 @@ void ElectronMainDelegate::PreSandboxStartup() {
|
|||
LoadResourceBundle(locale);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_MAC) && !defined(MAS_BUILD))
|
||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_MAC) && !IS_MAS_BUILD())
|
||||
// In the main process, we wait for JS to call crashReporter.start() before
|
||||
// initializing crashpad. If we're in the renderer, we want to initialize it
|
||||
// immediately at boot.
|
||||
|
@ -380,7 +380,7 @@ void ElectronMainDelegate::PreSandboxStartup() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(MAS_BUILD)
|
||||
#if !IS_MAS_BUILD()
|
||||
crash_keys::SetCrashKeysFromCommandLine(*command_line);
|
||||
crash_keys::SetPlatformCrashKey();
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "shell/app/electron_library_main.h"
|
||||
#include "shell/app/uv_stdio_fix.h"
|
||||
|
||||
#if defined(HELPER_EXECUTABLE) && !defined(MAS_BUILD)
|
||||
#if defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD()
|
||||
#include <mach-o/dyld.h>
|
||||
#include <cstdio>
|
||||
|
||||
|
@ -38,7 +38,7 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(HELPER_EXECUTABLE) && !defined(MAS_BUILD)
|
||||
#if defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD()
|
||||
uint32_t exec_path_size = 0;
|
||||
int rv = _NSGetExecutablePath(NULL, &exec_path_size);
|
||||
if (rv != -1) {
|
||||
|
@ -65,7 +65,7 @@ int main(int argc, char* argv[]) {
|
|||
abort();
|
||||
}
|
||||
}
|
||||
#endif // defined(HELPER_EXECUTABLE) && !defined(MAS_BUILD)
|
||||
#endif // defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD
|
||||
|
||||
return ElectronMain(argc, argv);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "chrome/child/v8_crashpad_support_win.h"
|
||||
#endif
|
||||
|
||||
#if !defined(MAS_BUILD)
|
||||
#if !IS_MAS_BUILD()
|
||||
#include "components/crash/core/app/crashpad.h" // nogncheck
|
||||
#include "shell/app/electron_crash_reporter_client.h"
|
||||
#include "shell/common/crash_keys.h"
|
||||
|
@ -86,7 +86,7 @@ int SetNodeCliFlags() {
|
|||
node::kDisallowedInEnvironment);
|
||||
}
|
||||
|
||||
#if defined(MAS_BUILD)
|
||||
#if IS_MAS_BUILD()
|
||||
void SetCrashKeyStub(const std::string& key, const std::string& value) {}
|
||||
void ClearCrashKeyStub(const std::string& key) {}
|
||||
#endif
|
||||
|
@ -97,7 +97,7 @@ namespace electron {
|
|||
|
||||
v8::Local<v8::Value> GetParameters(v8::Isolate* isolate) {
|
||||
std::map<std::string, std::string> keys;
|
||||
#if !defined(MAS_BUILD)
|
||||
#if !IS_MAS_BUILD()
|
||||
electron::crash_keys::GetCrashKeys(&keys);
|
||||
#endif
|
||||
return gin::ConvertToV8(isolate, keys);
|
||||
|
@ -113,7 +113,7 @@ int NodeMain(int argc, char* argv[]) {
|
|||
// TODO(deepak1556): Enable crashpad support on linux for
|
||||
// ELECTRON_RUN_AS_NODE processes.
|
||||
// Refs https://github.com/electron/electron/issues/36030
|
||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_MAC) && !defined(MAS_BUILD))
|
||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_MAC) && !IS_MAS_BUILD())
|
||||
ElectronCrashReporterClient::Create();
|
||||
crash_reporter::InitializeCrashpad(false, "node");
|
||||
crash_keys::SetCrashKeysFromCommandLine(
|
||||
|
@ -189,7 +189,7 @@ int NodeMain(int argc, char* argv[]) {
|
|||
// Setup process.crashReporter in child node processes
|
||||
gin_helper::Dictionary reporter = gin::Dictionary::CreateEmpty(isolate);
|
||||
reporter.SetMethod("getParameters", &GetParameters);
|
||||
#if defined(MAS_BUILD)
|
||||
#if IS_MAS_BUILD()
|
||||
reporter.SetMethod("addExtraParameter", &SetCrashKeyStub);
|
||||
reporter.SetMethod("removeExtraParameter", &ClearCrashKeyStub);
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue