diff --git a/BUILD.gn b/BUILD.gn index 9dc7f22a66..781d80f718 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -420,6 +420,37 @@ action("electron_generate_node_defines") { args = [ rebase_path(target_gen_dir) ] + rebase_path(inputs) } +# MSIX updater needs to be in a separate source_set because it uses C++/WinRT +# headers that require exceptions to be enabled. +source_set("electron_msix_updater") { + sources = [ + "shell/browser/api/electron_api_msix_updater.cc", + "shell/browser/api/electron_api_msix_updater.h", + ] + + configs += [ "//third_party/electron_node:node_external_config" ] + + public_configs = [ ":electron_lib_config" ] + + if (is_win) { + cflags_cc = [ + "/EHsc", # Enable C++ exceptions for C++/WinRT + "-Wno-c++98-compat-extra-semi", #Suppress C++98 compatibility warnings + ] + + include_dirs = [ "//third_party/nearby/src/internal/platform/implementation/windows/generated" ] + } + + deps = [ + "//base", + "//content/public/browser", + "//gin", + "//third_party/electron_node/deps/simdjson", + "//third_party/electron_node/deps/uv", + "//v8", + ] +} + source_set("electron_lib") { configs += [ "//v8:external_startup_data", @@ -435,6 +466,7 @@ source_set("electron_lib") { ":electron_fuses", ":electron_generate_node_defines", ":electron_js2c", + ":electron_msix_updater", ":electron_version_header", ":resources", "buildflags", diff --git a/filenames.gni b/filenames.gni index 6b93b01b8e..3c351e260a 100644 --- a/filenames.gni +++ b/filenames.gni @@ -279,8 +279,6 @@ filenames = { "shell/browser/api/electron_api_in_app_purchase.h", "shell/browser/api/electron_api_menu.cc", "shell/browser/api/electron_api_menu.h", - "shell/browser/api/electron_api_msix_updater.cc", - "shell/browser/api/electron_api_msix_updater.h", "shell/browser/api/electron_api_native_theme.cc", "shell/browser/api/electron_api_native_theme.h", "shell/browser/api/electron_api_net_log.cc", diff --git a/shell/browser/api/electron_api_msix_updater.cc b/shell/browser/api/electron_api_msix_updater.cc index 605e7a45d0..21ed3fc33e 100644 --- a/shell/browser/api/electron_api_msix_updater.cc +++ b/shell/browser/api/electron_api_msix_updater.cc @@ -33,13 +33,14 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +// Use pre-generated C++/WinRT headers from //third_party/nearby instead of the +// SDK's cppwinrt headers, which are missing implementation files. +#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.ApplicationModel.h" +#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.Foundation.Collections.h" +#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.Foundation.Metadata.h" +#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.Foundation.h" +#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.Management.Deployment.h" +#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/base.h" #include "base/win/scoped_com_initializer.h" #endif