mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix gn errors
This commit is contained in:
@@ -17,7 +17,6 @@ boringssl_build_gn.patch
|
||||
pepper_plugin_support.patch
|
||||
gtk_visibility.patch
|
||||
sysroot.patch
|
||||
resource_file_conflict.patch
|
||||
scroll_bounce_flag.patch
|
||||
mas_blink_no_private_api.patch
|
||||
mas_no_private_api.patch
|
||||
|
||||
@@ -11,7 +11,7 @@ if we ever align our .pak file generation with Chrome we can remove this
|
||||
patch.
|
||||
|
||||
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
|
||||
index 3c40d999a9545051e91a9f0ad3bf7ca2a95d80c4..b5a20be5e22238e7e1969bdaf52c0b05e84bb846 100644
|
||||
index 7203dde2f96d5e8ed44443e21a2257166b6e6f36..b7eec4e35fc3480ca6779ff17cf714edfd727c48 100644
|
||||
--- a/chrome/BUILD.gn
|
||||
+++ b/chrome/BUILD.gn
|
||||
@@ -171,11 +171,16 @@ if (!is_android && !is_mac) {
|
||||
|
||||
@@ -23,6 +23,19 @@ index 84e83c0dc8eb41f3330adf6df95d11384fbbc98d..462b2586179e00aefae35034c1154e93
|
||||
}
|
||||
|
||||
# This template defines a toolchain for something that works like gcc
|
||||
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
|
||||
index b7eec4e35fc3480ca6779ff17cf714edfd727c48..769ac10ae2935d200c1664366b6a8dbedfab2f06 100644
|
||||
--- a/chrome/BUILD.gn
|
||||
+++ b/chrome/BUILD.gn
|
||||
@@ -1544,7 +1544,7 @@ if (!is_android) {
|
||||
mark_as_data = true
|
||||
}
|
||||
|
||||
- if (enable_resource_allowlist_generation) {
|
||||
+ if (enable_resource_allowlist_generation && is_win) {
|
||||
repack_allowlist = _chrome_resource_allowlist
|
||||
deps = [ ":resource_allowlist" ]
|
||||
}
|
||||
diff --git a/tools/resources/generate_resource_allowlist.py b/tools/resources/generate_resource_allowlist.py
|
||||
index 3fb5ca91e1b3096d650598a98af99f9eda4a1aff..e81c25504141fa6aec569905e78de21b50e4817c 100755
|
||||
--- a/tools/resources/generate_resource_allowlist.py
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Apthorp <nornagon@nornagon.net>
|
||||
Date: Thu, 20 Sep 2018 17:48:59 -0700
|
||||
Subject: resource_file_conflict.patch
|
||||
|
||||
Resolve conflict between //chrome's .pak files and //electron's. The paths
|
||||
that chrome code hardcodes require that we generate resources at these
|
||||
paths, but GN throws errors if there are multiple targets that generate the
|
||||
same files.
|
||||
|
||||
This is due to the hardcoded names here:
|
||||
https://chromium.googlesource.com/chromium/src/+/69.0.3497.106/ui/base/resource/resource_bundle.cc#780
|
||||
and here:
|
||||
https://chromium.googlesource.com/chromium/src/+/69.0.3497.106/ui/base/resource/resource_bundle_mac.mm#50
|
||||
|
||||
This isn't needed on Mac because resource files are copied into the app bundle,
|
||||
and are built in `$root_out_dir/electron_repack` (while Chromium's resources
|
||||
target `$root_out_dir/repack`), but on Windows and Linux, the resource files go
|
||||
directly in `$root_out_dir`, and so they conflict.
|
||||
|
||||
We don't actually ever generate Chromium's resource paks, but without this
|
||||
patch, GN refuses to generate the ninja files:
|
||||
|
||||
ERROR at //tools/grit/repack.gni:35:3: Duplicate output file.
|
||||
action(_repack_target_name) {
|
||||
^----------------------------
|
||||
Two or more targets generate the same output:
|
||||
chrome_100_percent.pak
|
||||
|
||||
This is can often be fixed by changing one of the target names, or by
|
||||
setting an output_name on one of them.
|
||||
|
||||
Collisions:
|
||||
//chrome:packed_resources_100_percent
|
||||
//electron:packed_resources_100_percent
|
||||
|
||||
See //tools/grit/repack.gni:35:3: Collision.
|
||||
action(_repack_target_name) {
|
||||
^----------------------------
|
||||
|
||||
Some alternatives to this patch:
|
||||
|
||||
1. Refactor upstream in such a way that the "chrome" pak names were
|
||||
configurable, for instance by adding a method to ResourceBundle::Delegate that
|
||||
LoadChromeResources would check.
|
||||
2. Pass a Delegate that overrides `GetPathForResourcePack`, check for the
|
||||
`chrome_{100,200}_percent.pak` filenames, and rewrite them to
|
||||
`electron_{100,200}_percent.pak`.
|
||||
3. Initialize the resource bundle with DO_NOT_LOAD_COMMON_RESOURCES and load
|
||||
the paks ourselves.
|
||||
|
||||
None of these options seems like a substantial maintainability win over this patch to me (@nornagon).
|
||||
|
||||
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
|
||||
index 7203dde2f96d5e8ed44443e21a2257166b6e6f36..3c40d999a9545051e91a9f0ad3bf7ca2a95d80c4 100644
|
||||
--- a/chrome/BUILD.gn
|
||||
+++ b/chrome/BUILD.gn
|
||||
@@ -1529,7 +1529,7 @@ if (is_chrome_branded && !is_android) {
|
||||
}
|
||||
}
|
||||
|
||||
-if (!is_android) {
|
||||
+if (!is_android && !is_electron_build) {
|
||||
chrome_paks("packed_resources") {
|
||||
if (is_mac) {
|
||||
output_dir = "$root_gen_dir/repack"
|
||||
@@ -1558,6 +1558,12 @@ if (!is_android) {
|
||||
}
|
||||
}
|
||||
|
||||
+if (is_electron_build) {
|
||||
+ group("packed_resources") {
|
||||
+ public_deps = [ "//electron:packed_resources" ]
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
repack("unit_tests_pak") {
|
||||
sources = [ "$root_gen_dir/chrome/chrome_test_resources.pak" ]
|
||||
output = "$root_out_dir/unit_tests.pak"
|
||||
Reference in New Issue
Block a user