OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/chrome_build.gni") | 5 import("//build/config/chrome_build.gni") |
6 import("//testing/test.gni") | 6 import("//testing/test.gni") |
7 | 7 |
8 # Generally you should depend on this target, see below for discussion. | 8 # This file deliberately has no default "util" target so dependants have to |
9 group("util") { | 9 # specify with the ":with_no_strings" or ":with_rc_strings" variants. Random |
10 public_deps = [ | 10 # code that ends up getting linked into chrome proper should depend on the |
11 ":with_no_strings_some_things_wont_work", | 11 # ":with_no_strings" variant. Other standalone apps will need to decide if they |
12 ] | 12 # need the resource strings or not. |
13 if (is_win) { | 13 # |
14 public_deps += [ ":strings" ] | |
15 } | |
16 } | |
17 | |
18 # chrome/installer/util has generated strings on Windows. These appear as | 14 # chrome/installer/util has generated strings on Windows. These appear as |
19 # Windows resources and are fairly large (~200KB). They are generated by the | 15 # Windows resources and are fairly large (~200KB). They are generated by the |
20 # ":generate_strings" target and compiled by the ":strings" target. | 16 # ":generate_strings" target and compiled by the ":strings" target. |
21 # | 17 # |
22 # Some code, like the Windows chrome.exe (the small bootstrap binary, not | 18 # Some code, like the Windows chrome.exe (the small bootstrap binary, not |
23 # all of chrome.dll) code uses installer_util functions without calling any | 19 # all of chrome.dll) code uses installer_util functions without calling any |
24 # functions that use the strings. And historically in the GYP build the strings | 20 # functions that use the strings. And historically in the GYP build the strings |
25 # resource had to be manually linked, so the strings never ended up being in | 21 # resource had to be manually linked, so the strings never ended up being in |
26 # chrome.exe and everything was fine. | 22 # chrome.exe and everything was fine. |
27 # | 23 # |
28 # However, this is obviously a fragile and confusing situation. If you depend | 24 # Other code, like chrome.dll links to installer util, and hooks up a |
29 # on this target rather than going through the ":util" version that links the | 25 # TranslationDelegate which overrides the strings retrieved from the resources |
30 # strings above, anything that uses localized strings won't work. There is | 26 # with grit pak strings. |
31 # no definition of what works and doesn't work, and this may also change over | 27 # |
32 # time. As an example at the time of this writing, chrome.exe calls | 28 # In both of these cases, link to the ":with_no_strings" variant. However, this |
33 # BrowserDistribution::GetRegistryPath. This function doesn't use any strings, | 29 # is obviously a fragile and confusing situation. In the "I don't use strings |
34 # but lots of other functions in BrowserDistribution do use localized strings. | 30 # at all case", there is no definition of what works and doesn't work, and this |
| 31 # may also change over time. As an example at the time of this writing, |
| 32 # chrome.exe calls BrowserDistribution::GetRegistryPath. This function doesn't |
| 33 # use any strings, but lots of other functions in BrowserDistribution do use |
| 34 # localized strings. |
35 # | 35 # |
36 # Ideally, this should be cleaved in two parts: the main "installer util" and | 36 # Ideally, this should be cleaved in two parts: the main "installer util" and |
37 # some kind of mini installer util that just contains the functions needed by | 37 # some kind of mini installer util that just contains the functions needed by |
38 # chrome.exe and any other clients that don't need the strings. | 38 # chrome.exe and any other clients that don't need the strings. It's likely |
39 static_library("with_no_strings_some_things_wont_work") { | 39 # we would still need the variant with no strings for when chrome.dll replaces |
| 40 # all strings with its own versions. |
| 41 static_library("with_no_strings") { |
40 deps = [ | 42 deps = [ |
41 "//base", | 43 "//base", |
42 "//chrome:strings", | 44 "//chrome:strings", |
43 "//chrome/common:constants", | 45 "//chrome/common:constants", |
44 "//components/variations", | 46 "//components/variations", |
45 "//content/public/common:result_codes", | 47 "//content/public/common:result_codes", |
46 ] | 48 ] |
47 | 49 |
48 # The constants target checks the Chrome distribution from this target. Both | 50 # The constants target checks the Chrome distribution from this target. Both |
49 # targets have to be linked together in practice. | 51 # targets have to be linked together in practice. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } else { | 216 } else { |
215 sources = [ | 217 sources = [ |
216 "master_preferences.cc", | 218 "master_preferences.cc", |
217 "master_preferences.h", | 219 "master_preferences.h", |
218 "master_preferences_constants.cc", | 220 "master_preferences_constants.cc", |
219 "master_preferences_constants.h", | 221 "master_preferences_constants.h", |
220 ] | 222 ] |
221 } | 223 } |
222 } | 224 } |
223 | 225 |
| 226 # Use this version of installer_util to link to the generated strings in .rc |
| 227 # format. |
| 228 group("with_rc_strings") { |
| 229 public_deps = [ |
| 230 ":with_no_strings", |
| 231 ] |
| 232 if (is_win) { |
| 233 public_deps += [ ":strings" ] |
| 234 } |
| 235 } |
| 236 |
224 action("generate_strings") { | 237 action("generate_strings") { |
225 visibility = [ | 238 visibility = [ |
226 ":strings", | 239 ":strings", |
227 ":with_no_strings_some_things_wont_work", | 240 ":with_no_strings", |
228 ] | 241 ] |
229 script = "prebuild/create_string_rc.py" | 242 script = "prebuild/create_string_rc.py" |
230 | 243 |
231 if (is_chrome_branded) { | 244 if (is_chrome_branded) { |
232 grdfile = "//chrome/app/google_chrome_strings.grd" | 245 grdfile = "//chrome/app/google_chrome_strings.grd" |
233 } else { | 246 } else { |
234 grdfile = "//chrome/app/chromium_strings.grd" | 247 grdfile = "//chrome/app/chromium_strings.grd" |
235 } | 248 } |
236 | 249 |
237 inputs = [ | 250 inputs = [ |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 "set_reg_value_work_item_unittest.cc", | 318 "set_reg_value_work_item_unittest.cc", |
306 "shell_util_unittest.cc", | 319 "shell_util_unittest.cc", |
307 "test_app_registration_data.cc", | 320 "test_app_registration_data.cc", |
308 "test_app_registration_data.h", | 321 "test_app_registration_data.h", |
309 "uninstall_metrics_unittest.cc", | 322 "uninstall_metrics_unittest.cc", |
310 "wmi_unittest.cc", | 323 "wmi_unittest.cc", |
311 "work_item_list_unittest.cc", | 324 "work_item_list_unittest.cc", |
312 ] | 325 ] |
313 | 326 |
314 deps = [ | 327 deps = [ |
315 ":strings", | 328 ":with_rc_strings", |
316 ":util", | |
317 "//base", | 329 "//base", |
318 "//base:i18n", | 330 "//base:i18n", |
319 "//base/test:test_support", | 331 "//base/test:test_support", |
320 "//chrome:other_version", | 332 "//chrome:other_version", |
321 "//chrome/common", | 333 "//chrome/common", |
322 "//chrome/installer/setup:lib", | 334 "//chrome/installer/setup:lib", |
323 "//chrome/installer/test:alternate_version_generator_lib", | 335 "//chrome/installer/test:alternate_version_generator_lib", |
324 "//components/variations", | 336 "//components/variations", |
325 "//content/public/common", | 337 "//content/public/common", |
326 "//testing/gmock", | 338 "//testing/gmock", |
327 "//testing/gtest", | 339 "//testing/gtest", |
328 ] | 340 ] |
329 | 341 |
330 # TODO(GYP) manifest: $(ProjectDir)\\installer\\mini_installer\\mini_install
er.exe.manifest | 342 # TODO(GYP) manifest: $(ProjectDir)\\installer\\mini_installer\\mini_install
er.exe.manifest |
331 } | 343 } |
332 } # is_win | 344 } # is_win |
OLD | NEW |