Index: chrome/installer/util/BUILD.gn |
diff --git a/chrome/installer/util/BUILD.gn b/chrome/installer/util/BUILD.gn |
index ca137997c46c8cb6caabe52c4b23e36d6fe80f1d..fa0d4ba04e68ba1f4054e2e6658a4a91280fbb15 100644 |
--- a/chrome/installer/util/BUILD.gn |
+++ b/chrome/installer/util/BUILD.gn |
@@ -5,7 +5,38 @@ |
import("//build/config/chrome_build.gni") |
import("//testing/test.gni") |
-static_library("util") { |
+# Generally you should depend on this target, see below for discussion. |
+group("util") { |
+ public_deps = [ |
+ ":with_no_strings_some_things_wont_work", |
+ ] |
+ if (is_win) { |
+ public_deps += [ ":strings" ] |
+ } |
+} |
+ |
+# chrome/installer/util has generated strings on Windows. These appear as |
+# Windows resources and are fairly large (~200KB). They are generated by the |
+# ":generate_strings" target and compiled by the ":strings" target. |
+# |
+# Some code, like the Windows chrome.exe (the small bootstrap binary, not |
+# all of chrome.dll) code uses installer_util functions without calling any |
+# functions that use the strings. And historically in the GYP build the strings |
+# resource had to be manually linked, so the strings never ended up being in |
+# chrome.exe and everything was fine. |
+# |
+# However, this is obviously a fragile and confusing situation. If you depend |
+# on this target rather than going through the ":util" version that links the |
+# strings above, anything that uses localized strings won't work. There is |
+# no definition of what works and doesn't work, and this may also change over |
+# time. As an example at the time of this writing, chrome.exe calls |
+# BrowserDistribution::GetRegistryPath. This function doesn't use any strings, |
+# but lots of other functions in BrowserDistribution do use localized strings. |
+# |
+# Ideally, this should be cleaved in two parts: the main "installer util" and |
+# some kind of mini installer util that just contains the functions needed by |
+# chrome.exe and any other clients that don't need the strings. |
+static_library("with_no_strings_some_things_wont_work") { |
deps = [ |
"//base", |
"//chrome:strings", |
@@ -66,10 +97,12 @@ static_library("util") { |
"user_experiment.h", |
] |
- public_deps = [ |
- ":strings", |
- ] |
deps += [ |
+ # Need to depend on the generated strings target since files here |
+ # depend on the generated header, but only depend on the ":strings" |
+ # target (which actually compiles and causes the generated code to be |
+ # linked) from the ":util" target. |
+ ":generate_strings", |
"//base/third_party/dynamic_annotations", |
"//components/metrics", |
"//courgette:courgette_lib", |
@@ -187,7 +220,10 @@ static_library("util") { |
} |
action("generate_strings") { |
- visibility = [ ":strings" ] |
+ visibility = [ |
+ ":strings", |
+ ":with_no_strings_some_things_wont_work", |
+ ] |
script = "prebuild/create_string_rc.py" |
if (is_chrome_branded) { |