From 7bf0af7d96f767f6fabb8e97b63dc208684619eb Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 15 Jun 2020 23:42:18 -0700 Subject: [PATCH] Revert "build: remove dead symlink from MAS build (#23831)" (#24146) This reverts commit 7a216a8fab7f386e9113594b8e1ca374470130c5. --- .circleci/config.yml | 5 +-- BUILD.gn | 18 ++------ script/check-symlinks.js | 42 ------------------- .../dist_zip.mac_mas.x64.manifest | 1 + shell/app/electron_crash_reporter_client.h | 2 +- shell/app/electron_main_delegate.cc | 5 +-- shell/app/node_main.cc | 5 +-- .../api/electron_api_crash_reporter.cc | 28 +++---------- shell/browser/electron_browser_client.cc | 4 +- shell/common/crash_keys.cc | 2 +- 10 files changed, 19 insertions(+), 93 deletions(-) delete mode 100644 script/check-symlinks.js diff --git a/.circleci/config.yml b/.circleci/config.yml index fc3c6c5dd8bc..706c19b8048b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -418,7 +418,6 @@ step-electron-build: &step-electron-build fi cd src ninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES - node electron/script/check-symlinks.js step-native-unittests-build: &step-native-unittests-build run: @@ -831,7 +830,7 @@ step-restore-out-cache: &step-restore-out-cache paths: - ./src/out/Default keys: - - v8-out-cache-{{ checksum "src/electron/.depshash" }}-{{ checksum "src/electron/.depshash-target" }} + - v7-out-cache-{{ checksum "src/electron/.depshash" }}-{{ checksum "src/electron/.depshash-target" }} name: Restoring out cache step-set-git-cache-path: &step-set-git-cache-path @@ -855,7 +854,7 @@ step-save-out-cache: &step-save-out-cache save_cache: paths: - ./src/out/Default - key: v8-out-cache-{{ checksum "src/electron/.depshash" }}-{{ checksum "src/electron/.depshash-target" }} + key: v7-out-cache-{{ checksum "src/electron/.depshash" }}-{{ checksum "src/electron/.depshash-target" }} name: Persisting out cache step-run-electron-only-hooks: &step-run-electron-only-hooks diff --git a/BUILD.gn b/BUILD.gn index a241ed572e10..4cd73d5f6243 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -326,6 +326,7 @@ source_set("electron_lib") { "//chrome/app/resources:platform_locale_settings", "//chrome/services/printing/public/mojom", "//components/certificate_transparency", + "//components/crash/core/app", "//components/language/core/browser", "//components/net_log", "//components/network_hints/browser", @@ -433,9 +434,6 @@ source_set("electron_lib") { "*\bviews/*", ] } - if (!is_mas_build) { - deps += [ "//components/crash/core/app" ] - } set_sources_assignment_filter( sources_assignment_filter + extra_source_filters) @@ -461,13 +459,10 @@ source_set("electron_lib") { deps += [ "//components/remote_cocoa/app_shim", "//content/common:mac_helpers", + "//third_party/crashpad/crashpad/client", "//ui/accelerated_widget_mac", ] - if (!is_mas_build) { - deps += [ "//third_party/crashpad/crashpad/client" ] - } - libs = [ "AVFoundation.framework", "Carbon.framework", @@ -778,10 +773,8 @@ if (is_mac) { framework_contents = [ "Resources", "Libraries", + "Helpers", ] - if (!is_mas_build) { - framework_contents += [ "Helpers" ] - } public_deps = [ ":electron_framework_libraries", ":electron_lib", @@ -1012,16 +1005,13 @@ if (is_mac) { group("electron_symbols") { deps = [ + ":crashpad_handler_syms", ":electron_app_syms", ":electron_framework_syms", ":swiftshader_egl_syms", ":swiftshader_gles_syms", ] - if (!is_mas_build) { - deps += [ ":crashpad_handler_syms" ] - } - foreach(helper_params, content_mac_helpers) { _helper_target = helper_params[0] deps += [ ":electron_helper_syms_${_helper_target}" ] diff --git a/script/check-symlinks.js b/script/check-symlinks.js deleted file mode 100644 index db422bb6dc7e..000000000000 --- a/script/check-symlinks.js +++ /dev/null @@ -1,42 +0,0 @@ -const fs = require('fs'); -const path = require('path'); - -const utils = require('./lib/utils'); - -if (process.platform !== 'darwin') { - console.log('Not checking symlinks on non-darwin platform'); - process.exit(0); -} - -const appPath = path.resolve(__dirname, '..', '..', 'out', utils.getOutDir(), 'Electron.app'); -const visited = new Set(); -const traverse = (p) => { - if (visited.has(p)) return; - - visited.add(p); - if (!fs.statSync(p).isDirectory()) return; - - for (const child of fs.readdirSync(p)) { - const childPath = path.resolve(p, child); - let realPath; - try { - realPath = fs.realpathSync(childPath); - } catch (err) { - if (err.path) { - console.error('Detected an invalid symlink'); - console.error('Source:', childPath); - let link = fs.readlinkSync(childPath); - if (!link.startsWith('.')) { - link = `../${link}`; - } - console.error('Target:', path.resolve(childPath, link)); - process.exit(1); - } else { - throw err; - } - } - traverse(realPath); - } -}; - -traverse(appPath); diff --git a/script/zip_manifests/dist_zip.mac_mas.x64.manifest b/script/zip_manifests/dist_zip.mac_mas.x64.manifest index df05fa1caeeb..19fbaebd8551 100644 --- a/script/zip_manifests/dist_zip.mac_mas.x64.manifest +++ b/script/zip_manifests/dist_zip.mac_mas.x64.manifest @@ -3,6 +3,7 @@ Electron.app/Contents/ Electron.app/Contents/Frameworks/ Electron.app/Contents/Frameworks/Electron Framework.framework/ Electron.app/Contents/Frameworks/Electron Framework.framework/Electron Framework +Electron.app/Contents/Frameworks/Electron Framework.framework/Helpers Electron.app/Contents/Frameworks/Electron Framework.framework/Libraries Electron.app/Contents/Frameworks/Electron Framework.framework/Resources Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/ diff --git a/shell/app/electron_crash_reporter_client.h b/shell/app/electron_crash_reporter_client.h index c70620da228a..f811a2c50181 100644 --- a/shell/app/electron_crash_reporter_client.h +++ b/shell/app/electron_crash_reporter_client.h @@ -12,7 +12,7 @@ #include "base/macros.h" #include "base/no_destructor.h" #include "build/build_config.h" -#include "components/crash/core/app/crash_reporter_client.h" // nogncheck +#include "components/crash/core/app/crash_reporter_client.h" class ElectronCrashReporterClient : public crash_reporter::CrashReporterClient { public: diff --git a/shell/app/electron_main_delegate.cc b/shell/app/electron_main_delegate.cc index b463c996667d..a9515c068a81 100644 --- a/shell/app/electron_main_delegate.cc +++ b/shell/app/electron_main_delegate.cc @@ -22,6 +22,7 @@ #include "base/strings/string_split.h" #include "chrome/common/chrome_paths.h" #include "components/content_settings/core/common/content_settings_pattern.h" +#include "components/crash/core/app/crashpad.h" #include "components/crash/core/common/crash_key.h" #include "components/crash/core/common/crash_keys.h" #include "content/public/common/content_switches.h" @@ -63,10 +64,6 @@ #include "v8/include/v8.h" #endif -#if !defined(MAS_BUILD) -#include "components/crash/core/app/crashpad.h" // nogncheck -#endif - namespace electron { namespace { diff --git a/shell/app/node_main.cc b/shell/app/node_main.cc index 5e8b7917faeb..bc1257758b13 100644 --- a/shell/app/node_main.cc +++ b/shell/app/node_main.cc @@ -18,6 +18,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/task/thread_pool/thread_pool_instance.h" #include "base/threading/thread_task_runner_handle.h" +#include "components/crash/core/app/crashpad.h" #include "content/public/common/content_switches.h" #include "electron/electron_version.h" #include "gin/array_buffer.h" @@ -42,10 +43,6 @@ #include "chrome/child/v8_crashpad_support_win.h" #endif -#if !defined(MAS_BUILD) -#include "components/crash/core/app/crashpad.h" // nogncheck -#endif - namespace { // Initialize Node.js cli options to pass to Node.js diff --git a/shell/browser/api/electron_api_crash_reporter.cc b/shell/browser/api/electron_api_crash_reporter.cc index 650fe65cfb56..cc09c82da8c1 100644 --- a/shell/browser/api/electron_api_crash_reporter.cc +++ b/shell/browser/api/electron_api_crash_reporter.cc @@ -16,28 +16,25 @@ #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_restrictions.h" +#include "chrome/browser/crash_upload_list/crash_upload_list_crashpad.h" #include "chrome/common/chrome_paths.h" +#include "components/crash/core/app/crashpad.h" +#include "components/crash/core/common/crash_key.h" #include "components/upload_list/crash_upload_list.h" #include "components/upload_list/text_log_upload_list.h" #include "content/public/common/content_switches.h" #include "gin/arguments.h" #include "gin/data_object_builder.h" #include "services/service_manager/embedder/switches.h" +#include "shell/app/electron_crash_reporter_client.h" +#include "shell/common/crash_keys.h" #include "shell/common/electron_paths.h" #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/file_path_converter.h" #include "shell/common/gin_converters/time_converter.h" #include "shell/common/gin_helper/dictionary.h" #include "shell/common/node_includes.h" - -#if !defined(MAS_BUILD) -#include "chrome/browser/crash_upload_list/crash_upload_list_crashpad.h" -#include "components/crash/core/app/crashpad.h" // nogncheck -#include "components/crash/core/common/crash_key.h" -#include "shell/app/electron_crash_reporter_client.h" -#include "shell/common/crash_keys.h" -#include "third_party/crashpad/crashpad/client/crashpad_info.h" // nogncheck -#endif +#include "third_party/crashpad/crashpad/client/crashpad_info.h" #if defined(OS_LINUX) #include "components/crash/core/app/breakpad_linux.h" @@ -65,14 +62,6 @@ namespace api { namespace crash_reporter { -#if defined(MAS_BUILD) -namespace { - -void NoOp() {} - -} // namespace -#endif - bool IsCrashReporterEnabled() { return g_crash_reporter_initialized; } @@ -214,13 +203,8 @@ void Initialize(v8::Local exports, void* priv) { gin_helper::Dictionary dict(context->GetIsolate(), exports); dict.SetMethod("start", &electron::api::crash_reporter::Start); -#if defined(MAS_BUILD) - dict.SetMethod("addExtraParameter", &electron::api::crash_reporter::NoOp); - dict.SetMethod("removeExtraParameter", &electron::api::crash_reporter::NoOp); -#else dict.SetMethod("addExtraParameter", &electron::crash_keys::SetCrashKey); dict.SetMethod("removeExtraParameter", &electron::crash_keys::ClearCrashKey); -#endif dict.SetMethod("getParameters", &GetParameters); dict.SetMethod("getUploadedReports", &GetUploadedReports); dict.SetMethod("setUploadToServer", &SetUploadToServer); diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 481dfe55a125..ca2984eed528 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -173,8 +173,8 @@ #include "base/debug/leak_annotations.h" #include "components/crash/content/browser/crash_handler_host_linux.h" #include "components/crash/core/app/breakpad_linux.h" -#include "components/crash/core/app/crash_switches.h" // nogncheck -#include "components/crash/core/app/crashpad.h" // nogncheck +#include "components/crash/core/app/crash_switches.h" +#include "components/crash/core/app/crashpad.h" #endif using content::BrowserThread; diff --git a/shell/common/crash_keys.cc b/shell/common/crash_keys.cc index 242d2cbbbe77..a5d92497c9ba 100644 --- a/shell/common/crash_keys.cc +++ b/shell/common/crash_keys.cc @@ -16,7 +16,7 @@ #include "content/public/common/content_switches.h" #include "shell/common/electron_constants.h" #include "shell/common/options_switches.h" -#include "third_party/crashpad/crashpad/client/annotation.h" // nogncheck +#include "third_party/crashpad/crashpad/client/annotation.h" namespace electron {