build: make is_mas_build a generated header instead of config (#43737)

This commit is contained in:
Samuel Attard 2024-09-17 01:38:56 -07:00 committed by GitHub
parent b83810982e
commit c1c8fbfd9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 601 additions and 306 deletions

View file

@ -532,7 +532,7 @@ source_set("electron_lib") {
]
}
configs += [ "//electron/build/config:mas_build" ]
deps += [ "//electron/build/config:generate_mas_config" ]
sources = filenames.lib_sources
if (is_win) {
@ -906,12 +906,14 @@ if (is_mac) {
assert(defined(invoker.helper_name_suffix))
output_name = electron_helper_name + invoker.helper_name_suffix
deps = [ ":electron_framework+link" ]
deps = [
":electron_framework+link",
"//electron/build/config:generate_mas_config",
]
if (!is_mas_build) {
deps += [ "//sandbox/mac:seatbelt" ]
}
defines = [ "HELPER_EXECUTABLE" ]
configs += [ "//electron/build/config:mas_build" ]
sources = [
"shell/app/electron_main_mac.cc",
"shell/app/uv_stdio_fix.cc",
@ -1067,6 +1069,7 @@ if (is_mac) {
":electron_app_plist",
":electron_app_resources",
":electron_fuses",
"//electron/build/config:generate_mas_config",
"//electron/buildflags",
]
if (is_mas_build) {
@ -1081,7 +1084,6 @@ if (is_mac) {
"-rpath",
"@executable_path/../Frameworks",
]
configs += [ "//electron/build/config:mas_build" ]
}
if (enable_dsyms) {

View file

@ -1,8 +1,11 @@
# For MAS build, we force defining "MAS_BUILD".
config("mas_build") {
action("generate_mas_config") {
outputs = [ "$target_gen_dir/../../mas.h" ]
script = "../../script/generate-mas-config.py"
if (is_mas_build) {
defines = [ "IS_MAS_BUILD()=1" ]
args = [ "true" ]
} else {
defines = [ "IS_MAS_BUILD()=0" ]
args = [ "false" ]
}
args += rebase_path(outputs)
}

View file

@ -33,10 +33,10 @@ index 78923a81c64fb7738f4e457e3166a88f3c150564..ee348433544550f99622b52252fd1064
"//base",
"//build:branding_buildflags",
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 7a23e63b800f87b6189ca04ce33c2c9b971e1152..50c51fad27925adf4a1e5fc9e03f7bca2153daa5 100644
index 42f5441b7e78d0359727b3ca7702c80b9f6eeff8..2f154bbfde483f0cdeb336b631d238b8677b8486 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -4482,7 +4482,7 @@ static_library("browser") {
@@ -4480,7 +4480,7 @@ static_library("browser") {
]
}
@ -46,10 +46,10 @@ index 7a23e63b800f87b6189ca04ce33c2c9b971e1152..50c51fad27925adf4a1e5fc9e03f7bca
# than here in :chrome_dll.
deps += [ "//chrome:packed_resources_integrity_header" ]
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 633854df22c94cb2b7e02c1eda2663ca8091e11e..79ed45cf2b14ac3f504317305f4ae10e5413ff63 100644
index de4a98c1bdb0c0e8a4a4051496fe4bb8c246e106..7a4594882a30f4d83b791d97a0f72842888197dc 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -7050,9 +7050,12 @@ test("unit_tests") {
@@ -7054,9 +7054,12 @@ test("unit_tests") {
"//chrome/notification_helper",
]
@ -63,7 +63,7 @@ index 633854df22c94cb2b7e02c1eda2663ca8091e11e..79ed45cf2b14ac3f504317305f4ae10e
"//chrome//services/util_win:unit_tests",
"//chrome/app:chrome_dll_resources",
"//chrome/app:win_unit_tests",
@@ -8079,6 +8082,10 @@ test("unit_tests") {
@@ -8083,6 +8086,10 @@ test("unit_tests") {
"../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc",
]
@ -74,7 +74,7 @@ index 633854df22c94cb2b7e02c1eda2663ca8091e11e..79ed45cf2b14ac3f504317305f4ae10e
sources += [
# The importer code is not used on Android.
"../common/importer/firefox_importer_utils_unittest.cc",
@@ -8146,7 +8153,6 @@ test("unit_tests") {
@@ -8150,7 +8157,6 @@ test("unit_tests") {
# Non-android deps for "unit_tests" target.
deps += [
"../browser/screen_ai:screen_ai_install_state",

View file

@ -6,10 +6,10 @@ Subject: fix: disabling compositor recycling
Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron.
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 6a595dfebeeb53706b60429bc904095a2ab4cba9..dfed708b59a3b5f8e898e428b98adbc76f55fdf8 100644
index 962dd6c34974a9377ca5a87425b1b801ba0a3f4d..550d59edbad2c0bb2b8f9c783433f138ffbe8c15 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -558,7 +558,11 @@
@@ -559,7 +559,11 @@
return;
host()->WasHidden();

View file

@ -199,7 +199,7 @@ index 58985ce62dc569256bad5e94de9c0d125fc470d0..33436784b691c860d58f8b4dfcc6718e
&SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse, this,
parent));
diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.cc b/ui/shell_dialogs/select_file_dialog_linux_portal.cc
index 61ddcbf7bf57e423099c7d392a19b3ec79b5d03f..b2d2e11f72dcca5b3791a6dd3e9e5ae930a1f701 100644
index 61ddcbf7bf57e423099c7d392a19b3ec79b5d03f..920d0610943091f850e44e3e0481abd7fe08f881 100644
--- a/ui/shell_dialogs/select_file_dialog_linux_portal.cc
+++ b/ui/shell_dialogs/select_file_dialog_linux_portal.cc
@@ -44,7 +44,9 @@ constexpr char kMethodStartServiceByName[] = "StartServiceByName";

View file

@ -90,7 +90,7 @@ index 8af69cac78b7488d28f1f05ccb174793fe5148cd..9f74e511c263d147b5fbe81fe100d217
private:
const HWND hwnd_;
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
index f907a3eea3843ccad7b15ca34137f42dbe57baa1..f3f0812be22067a06fc0afc3e52ffc252cd33f86 100644
index 239fdc5a9ffef56f3b2c6667b1324c9f0a75c58e..dc3bf4440470da55193897aee6b431a475cffc84 100644
--- a/components/viz/service/BUILD.gn
+++ b/components/viz/service/BUILD.gn
@@ -172,6 +172,8 @@ viz_component("service") {

View file

@ -12,10 +12,10 @@ We attempt to migrate the safe storage key from the old account, if that migrati
Existing apps that aren't built for the app store should be unimpacted, there is one edge case where a user uses BOTH an AppStore and a darwin build of the same app only one will keep it's access to the safestorage key as during the migration we delete the old account. This is an acceptable edge case as no one should be actively using two versions of the same app.
diff --git a/components/os_crypt/sync/keychain_password_mac.mm b/components/os_crypt/sync/keychain_password_mac.mm
index e7a65e97b51d93bff864889813317fb7c6ffc846..2b93da301b664f90720d2d2b5407be0985d7f334 100644
index bb1fc0c99164ae4bdaaaa78e87c30e88932a928c..82d235709b79b1b3689b28ec8bfa02663ba219d6 100644
--- a/components/os_crypt/sync/keychain_password_mac.mm
+++ b/components/os_crypt/sync/keychain_password_mac.mm
@@ -22,6 +22,12 @@
@@ -23,6 +23,12 @@
using KeychainNameContainerType = const base::NoDestructor<std::string>;
#endif
@ -28,7 +28,7 @@ index e7a65e97b51d93bff864889813317fb7c6ffc846..2b93da301b664f90720d2d2b5407be09
namespace {
// These two strings ARE indeed user facing. But they are used to access
@@ -81,11 +87,18 @@
@@ -82,11 +88,18 @@
std::string KeychainPassword::GetPassword() const {
UInt32 password_length = 0;
void* password_data = nullptr;
@ -49,7 +49,7 @@ index e7a65e97b51d93bff864889813317fb7c6ffc846..2b93da301b664f90720d2d2b5407be09
if (error == noErr) {
std::string password =
std::string(static_cast<char*>(password_data), password_length);
@@ -93,6 +106,49 @@
@@ -94,6 +107,49 @@
return password;
}

View file

@ -36,7 +36,7 @@ index 2096591596a26464ab8f71a399ccb16a04edfd59..9eb966b3ddc3551d6beeff123071b2c9
Microsoft::WRL::ComPtr<ID3D11Texture2D> d3d11_texture;
diff --git a/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc b/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
index 208d048ee68fd92d1fa7b5e8ad79e02e29b8be40..c8c8c32cd44a96dc6a476b8bc02bb13b02f86300 100644
index cf5bde2e431fd137ce3501e2a913aa5a3dad5d5b..2f1d64464d76fdbd9af69c8b122e508219d1cced 100644
--- a/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
+++ b/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
@@ -205,7 +205,7 @@ gfx::Size GetBufferSizeInPixelsForVideoPixelFormat(

View file

@ -11,7 +11,7 @@ majority of changes originally come from these PRs:
This patch also fixes callback for manual user cancellation and success.
diff --git a/BUILD.gn b/BUILD.gn
index cec2b9df48ca16979e3171c4047f8a8326f1cbb3..a5f88ec8b01f8eecc639a0643fc3bbb917a98fb6 100644
index 0b1865464e9edaa90b4077639350d05613da858a..fee38be7ce24d7062b1c4e4a99d320226c40f7c1 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -998,7 +998,6 @@ if (is_win) {
@ -883,7 +883,7 @@ index 14de029740ffbebe06d309651c1a2c007d9fb96b..e9bf9c5bef2a9235260e7d6c8d26d415
ScriptingThrottler scripting_throttler_;
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 3c3dfc789890eda3007c0723e6730e5fb88c4646..00e4d081a6afac7414cb91d7d5bb276881f49ea0 100644
index 149942fbbf832d470b6832a0d33699b3d5aeb558..a6756af31ee4f819d2fb57b945b8535dfa068b5a 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -3025,8 +3025,9 @@ source_set("browser") {

View file

@ -0,0 +1,17 @@
import sys
def main(is_mas_build, out_file):
is_mas_num = 0
if is_mas_build:
is_mas_num = 1
with open(out_file, 'w', encoding="utf-8") as f:
content = ''
content += '#ifndef ELECTRON_GEN_MAS_BUILD_H_\n'
content += '#define ELECTRON_GEN_MAS_BUILD_H_\n'
content += '#define IS_MAS_BUILD() ' + str(is_mas_num) + '\n'
content += '#endif\n'
f.write(content)
if __name__ == '__main__':
sys.exit(main(sys.argv[1] == "true", sys.argv[2]))

View file

@ -25,6 +25,7 @@
#include "content/public/common/content_switches.h"
#include "electron/buildflags/buildflags.h"
#include "electron/fuses.h"
#include "electron/mas.h"
#include "extensions/common/constants.h"
#include "ipc/ipc_buildflags.h"
#include "sandbox/policy/switches.h"

View file

@ -6,6 +6,7 @@
#include <memory>
#include "electron/fuses.h"
#include "electron/mas.h"
#include "shell/app/electron_library_main.h"
#include "shell/app/uv_stdio_fix.h"

View file

@ -20,6 +20,7 @@
#include "base/task/thread_pool/thread_pool_instance.h"
#include "content/public/common/content_switches.h"
#include "electron/fuses.h"
#include "electron/mas.h"
#include "gin/array_buffer.h"
#include "gin/public/isolate_holder.h"
#include "gin/v8_initializer.h"

View file

@ -39,6 +39,7 @@
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/render_frame_host.h"
#include "crypto/crypto_buildflags.h"
#include "electron/mas.h"
#include "gin/handle.h"
#include "media/audio/audio_manager.h"
#include "net/dns/public/dns_over_https_config.h"

View file

@ -17,6 +17,7 @@
#include "content/public/browser/gpu_data_manager_observer.h"
#include "content/public/browser/render_process_host.h"
#include "crypto/crypto_buildflags.h"
#include "electron/mas.h"
#include "net/base/completion_once_callback.h"
#include "net/base/completion_repeating_callback.h"
#include "net/ssl/client_cert_identity.h"

View file

@ -17,6 +17,7 @@
#include "chrome/common/chrome_paths.h"
#include "components/upload_list/crash_upload_list.h"
#include "components/upload_list/text_log_upload_list.h"
#include "electron/mas.h"
#include "gin/arguments.h"
#include "gin/data_object_builder.h"
#include "shell/common/electron_paths.h"

View file

@ -67,6 +67,7 @@
#include "content/public/common/result_codes.h"
#include "content/public/common/webplugininfo.h"
#include "electron/buildflags/buildflags.h"
#include "electron/mas.h"
#include "electron/shell/common/api/api.mojom.h"
#include "gin/arguments.h"
#include "gin/data_object_builder.h"

View file

@ -19,6 +19,7 @@
#include <mach/mach.h>
#include "base/process/port_provider_mac.h"
#include "content/public/browser/browser_child_process_host.h"
#include "electron/mas.h"
extern "C" int sandbox_check(pid_t pid, const char* operation, int type, ...);

View file

@ -3,7 +3,9 @@
// found in the LICENSE file.
#include "shell/browser/auto_updater.h"
#include "build/build_config.h"
#include "electron/mas.h"
namespace auto_updater {

View file

@ -18,6 +18,7 @@
#include "base/mac/mac_util.mm"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "electron/mas.h"
#include "net/base/apple/url_conversions.h"
#include "shell/browser/badging/badge_manager.h"
#include "shell/browser/browser_observer.h"

View file

@ -7,6 +7,7 @@
#include <string>
#include "base/logging.h"
#include "electron/mas.h"
#include "shell/browser/notifications/mac/cocoa_notification.h"
#include "shell/browser/notifications/mac/notification_presenter_mac.h"

View file

@ -5,6 +5,7 @@
#include "shell/browser/ui/cocoa/electron_ns_window.h"
#include "base/strings/sys_string_conversions.h"
#include "electron/mas.h"
#include "shell/browser/native_window_mac.h"
#include "shell/browser/ui/cocoa/electron_preview_item.h"
#include "shell/browser/ui/cocoa/electron_touch_bar.h"

View file

@ -19,6 +19,7 @@
#include "base/strings/sys_string_conversions.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "electron/mas.h"
#include "shell/browser/native_window.h"
#include "shell/common/gin_converters/file_path_converter.h"
#include "shell/common/gin_helper/dictionary.h"

View file

@ -14,6 +14,7 @@
#include "base/process/process.h"
#include "base/process/process_handle.h"
#include "base/system/sys_info.h"
#include "electron/mas.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/global_memory_dump.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
#include "shell/browser/browser.h"

View file

@ -25,6 +25,7 @@
#include "electron/buildflags/buildflags.h"
#include "electron/electron_version.h"
#include "electron/fuses.h"
#include "electron/mas.h"
#include "shell/browser/api/electron_api_app.h"
#include "shell/common/api/electron_bindings.h"
#include "shell/common/electron_command_line.h"

View file

@ -21,6 +21,7 @@
#include "base/strings/sys_string_conversions.h"
#include "base/task/thread_pool.h"
#include "content/public/browser/browser_task_traits.h"
#include "electron/mas.h"
#include "net/base/apple/url_conversions.h"
#include "ui/views/widget/widget.h"
#include "url/gurl.h"

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "electron/mas.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"