Revert of Rename isSystemLocationEnabled to isLocationEnabled. (patchset #1 id:1...
[chromium-blink-merge.git] / chrome / BUILD.gn
blob30402328c9a1ec0d76f7adf9ee4ca54793001510
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
3 # found in the LICENSE file.
5 import("//build/config/features.gni")
6 import("//build/config/locales.gni")
7 import("//build/config/ui.gni")
8 import("//chrome/chrome_repack_locales.gni")
9 import("//chrome/version.gni")
11 if (is_android) {
12   import("//build/config/android/rules.gni")
15 if (!is_android) {
16   # TODO(GYP) for Windows need to the the reorder-imports step which probably
17   # means adding another target and renaming this to chrome_initial like in GYP.
18   executable("chrome") {
19     # Because the sources list varies so significantly per-platform, generally
20     # each platform lists its own files rather than relying on filtering or
21     # removing unused files.
22     sources = [
23       "app/chrome_exe_resource.h",
24     ]
25     deps = []
26     datadeps = []
28     # TODO(GYP) mac_bundle_resources, xcode_settings
30     # TODO(GYP) order_profiling, order_text_section
32     if (is_win) {
33       sources += [
34         "app/chrome_exe_main_win.cc",
35         "app/client_util.cc",
36         "app/client_util.h",
37         "app/signature_validator_win.cc",
38         "app/signature_validator_win.h",
39         "//content/app/startup_helper_win.cc",
40       ]
41       deps += [ "//ui/gfx" ]
42     } else if (use_aura) {
43       # Non-Windows aura entrypoint.
44       sources += [ "app/chrome_exe_main_aura.cc" ]
45     }
47     if (is_linux) {
48       # TODO(GYP) manpage action
50       sources += [
51         "app/chrome_dll_resource.h",
52         "app/chrome_main.cc",
53         "app/chrome_main_delegate.cc",
54         "app/chrome_main_delegate.h",
55       ]
57       deps += [
58         # On Linux, link the dependencies (libraries) that make up actual
59         # Chromium functionality directly into the executable.
60         ":browser_dependencies",
61         ":child_dependencies",
62         "//base/allocator",
64         # Needed to use the master_preferences functions
65         "//chrome/installer/util",
66         "//content/public/app:both",
67       ]
69       # Needed for chrome_main.cc initialization of libraries.
70       configs += [ "//build/config/linux:pangocairo" ]
72       # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
73       #   'ldflags': [
74       #      '-pie',
75       #   ],
76       #}],
78       if (use_x11) {
79         configs += [
80           "//build/config/linux:x11",
81           "//build/config/linux:xext",
82         ]
83       }
84     }
86     if (is_mac) {
87       sources += [ "app/chrome_exe_main_mac.cc" ]
88       # TODO(GYP) lots more stuff in the is_mac block.
89     } else {  # Non-Mac.
90       deps += [
91         ":packed_extra_resources",
92         ":packed_resources",
94         # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
95         # file decide what to do on a per-OS basis; on Mac, internal plugins
96         # go inside the framework, so this dependency is in chrome_dll.gypi.
97         #'../third_party/adobe/flash/flash_player.gyp:flapper_binaries',  TODO(GYP)
99         # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
100         # file decide what to do on a per-OS basis; on Mac, internal plugins
101         # go inside the framework, so this dependency is in chrome_dll.gypi.
102         #'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter',  TODO(GYP)
103       ]
104       # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
105     }
107     if (!is_mac) {
108       # On Mac this is done in chrome_dll.gypi.
109       datadeps += [ "//pdf" ]
110       # TODO(GYP) pdf linux symbols
111     }
112   }
113 }  # !is_android
115 shared_library("main_dll") {
116   configs += [ "//build/config/compiler:wexit_time_destructors" ]
118   deps = [
119     ":browser_dependencies",
120     "//base/allocator",
121   ]
122   if (is_win) {
123     output_name = "chrome"
125     sources = [
126       "app/chrome_command_ids.h",
127       "app/chrome_dll.rc",
128       "app/chrome_dll_resource.h",
129       "app/chrome_main.cc",
130       "app/chrome_main_delegate.cc",
131       "app/chrome_main_delegate.h",
132       "app/close_handle_hook_win.cc",
133       "app/close_handle_hook_win.h",
134       "app/delay_load_hook_win.cc",
135       "app/delay_load_hook_win.h",
136       "//base/win/dllmain.cc",
137     ]
139     deps += [
140       # On Windows, link the dependencies (libraries) that make up actual
141       # Chromium functionality into this .dll.
142       #'chrome_version_resources',  TODO(GYP)
143       "//chrome/app/theme:chrome_unscaled_resources",
144       "//content/app/resources",
145       "//crypto",
146       "//net:net_resources",
147       "//third_party/wtl",
148       "//ui/views",
150       #'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf' ]  TODO(GYP)
151     ]
152     if (enable_configuration_policy) {
153       deps += [ "//components/policy" ]
154     }
155     if (cpu_arch == "x86") {
156       # Add a dependency to custom import library for user32 delay imports only
157       # in x86 builds.
158       #deps += [ 'chrome_user32_delay_imports' ]  TODO(GYP)
159     }
161     # TODO(GYP) incremental linking flags in debug builds
162     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
164     # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
166     # TODO(GYP) chrome_pgo_phase on Windows.
167   }
169   if (use_aura) {
170     deps += [ "//ui/compositor" ]
171   }
173   #TODO(GYP) add chrome_multiple_dll support
174   if (false) {  #chrome_multiple_dll) {
175     defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
176     deps += [ "//content/public/app:browser" ]
177   } else {
178     deps += [
179       ":child_dependencies",
180       "//content/public/app:both",
181     ]
182   }
184   if (cld_version == 0 || cld_version == 2) {
185     deps += [ "//third_party/cld_2" ]
186   }
188   if (is_mac) {
189     #['OS=="mac" and component!="shared_library"', {  TODO(GYP)
190     #  'includes': [ 'chrome_dll_bundle.gypi' ],
191     #}],
192     # TODO(GYP) Lots of other stuff in the OS=="mac" block.
193   }
196 # GYP version: chromium_browser_dependencies variable in chrome.gyp
197 group("browser_dependencies") {
198   deps = [
199     "//chrome/browser",
200     "//chrome/common",
201     "//sync",
202   ]
203   if (!is_ios) {
204     deps += [ "//ppapi:ppapi_host" ]
205   }
207   if (enable_basic_printing || enable_print_preview) {
208     deps += [ "//printing" ]
209     if (enable_print_preview) {
210       deps += [ "//chrome/service" ]
211     }
212   }
215 # GYP version: chromium_child_dependencies variable in chrome.gyp
216 group("child_dependencies") {
217   deps = [
218     "//chrome/common",
219     "//sync",
220   ]
221   if (!is_ios) {
222     deps += [
223       "//chrome/browser/devtools",
224       "//chrome/plugin",
225       "//chrome/renderer",
226       "//chrome/utility",
227       "//content/public/child",
228       "//third_party/WebKit/public:blink_devtools_frontend_resources",
229     ]
230   }
231   if (cld_version == 0 || cld_version == 2) {
232     deps += [ "//third_party/cld_2:cld2_platform_impl" ]
233   }
236 if (is_win) {
237   # TODO(brettw) this duplicates "//chrome/common:version" which applies to
238   # Linux.
239   process_version("version_header") {
240     # TODO(brettW) this should have more reduced visibility, but chrome/browser
241     # currently depends on this.
242     #visibility = [ ":*" ]
243     source = "version.h.in"
245     # TODO(brettw) this should move to $target_gen_dir/version.h and
246     # source files including it should reference it via "chrome/version.h"
247     output = "$root_gen_dir/version.h"
248   }
251 # GYP version: chrome/chrome_resources.gyp:chrome_resources
252 group("resources") {
253   deps = [
254     # Note: GYP lists some dependencies in addition to these actions. However,
255     # these are just dependencies for the actions themselves, which our actions
256     # list individually when needed.
257     "//chrome/browser:resources",
258     "//chrome/common:resources",
259     "//chrome/renderer:resources",
260   ]
262   if (enable_extensions) {
263     deps += [ "//chrome/common:extensions_api_resources" ]
264   }
267 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
268 group("extra_resources") {
269   deps = [
270     "//chrome/browser/resources:invalidations_resources",
271     "//chrome/browser/resources:memory_internals_resources",
272     "//chrome/browser/resources:net_internals_resources",
273     "//chrome/browser/resources:password_manager_internals_resources",
274     "//chrome/browser/resources:signin_internals_resources",
275     "//chrome/browser/resources:sync_internals_resources",
276     "//chrome/browser/resources:translate_internals_resources",
277   ]
278   if (!is_ios) {
279     deps += [
280       "//chrome/browser/resources:component_extension_resources",
281       "//chrome/browser/resources:options_resources",
282     ]
283   }
285   if (enable_chromevox_next) {
286     deps += [
287       #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2',  TODO(GYP)
288     ]
289   } else {
290     deps += [
291       #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox',  TODO(GYP)
292     ]
293   }
295   if (enable_extensions) {
296     deps += [
297       "//chrome/browser/resources:quota_internals_resources",
298       "//chrome/browser/resources:sync_file_system_internals_resources",
299     ]
300   }
303 group("packed_resources") {
304   deps = [
305     ":repack_locales_pack",
306     ":repack_pseudo_locales_pack",
307     ":repack_chrome_100_percent",
308   ]
310   # TODO(GYP) if (is_chrome_branded) {
311   # ... copy default_apps from default_apps_list
313   if (enable_hidpi) {
314     deps += [ ":repack_chrome_200_percent" ]
315   }
318 repack("packed_extra_resources") {
319   visibility = [ "./*" ]
320   sources = [
321     "$root_gen_dir/chrome/browser_resources.pak",
322     "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
323     "$root_gen_dir/chrome/common_resources.pak",
324     "$root_gen_dir/chrome/invalidations_resources.pak",
325     "$root_gen_dir/chrome/memory_internals_resources.pak",
326     "$root_gen_dir/chrome/net_internals_resources.pak",
327     "$root_gen_dir/chrome/password_manager_internals_resources.pak",
328     "$root_gen_dir/chrome/signin_internals_resources.pak",
329     "$root_gen_dir/chrome/sync_internals_resources.pak",
330     "$root_gen_dir/chrome/translate_internals_resources.pak",
331     "$root_gen_dir/components/components_resources.pak",
332     "$root_gen_dir/net/net_resources.pak",
333     "$root_gen_dir/ui/resources/webui_resources.pak",
334   ]
335   deps = [
336     "//chrome/browser:resources",
337     "//chrome/app/theme:chrome_unscaled_resources",
338     "//chrome/common:resources",
339     "//chrome/browser/resources:invalidations_resources",
340     "//chrome/browser/resources:memory_internals_resources",
341     "//chrome/browser/resources:net_internals_resources",
342     "//chrome/browser/resources:password_manager_internals_resources",
343     "//chrome/browser/resources:signin_internals_resources",
344     "//chrome/browser/resources:sync_internals_resources",
345     "//chrome/browser/resources:translate_internals_resources",
346     "//components/resources",
347     "//net:net_resources",
348     "//ui/resources",
349   ]
351   if (!is_ios && !is_android) {
352     # New paks should be added here by default.
353     sources += [
354       "$root_gen_dir/chrome/component_extension_resources.pak",
355       "$root_gen_dir/chrome/options_resources.pak",
356       "$root_gen_dir/chrome/quota_internals_resources.pak",
357       "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
358       "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
359       "$root_gen_dir/webkit/devtools_resources.pak",
360     ]
361     deps += [
362       "//chrome/browser/devtools:webrtc_device_provider_resources",
363       "//chrome/browser/resources:component_extension_resources",
364       "//chrome/browser/resources:options_resources",
365       "//chrome/browser/resources:quota_internals_resources",
366       "//chrome/browser/resources:sync_file_system_internals_resources",
367       "//content/browser/devtools:devtools_resources",
368     ]
369   }
370   if (!is_ios) {
371     sources += [
372       "$root_gen_dir/blink/public/resources/blink_resources.pak",
373       "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
374       "$root_gen_dir/content/content_resources.pak",
375     ]
376   }
377   if (is_chromeos) {
378     sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
379     deps += [ "//ui/file_manager:resources" ]
380   }
381   if (enable_extensions) {
382     sources += [
383       "$root_gen_dir/chrome/extensions_api_resources.pak",
384       "$root_gen_dir/extensions/extensions_renderer_resources.pak",
385       "$root_gen_dir/extensions/extensions_resources.pak",
386     ]
387     deps += [ "//chrome/common:extensions_api_resources" ]
388   }
390   # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
391   # it them copies it. This skipes the copy step and writes it to the final
392   # location.
393   if (is_mac || is_ios) {
394     output = "$root_gen_dir/repack/resources.pak"
395   } else {
396     output = "$root_out_dir/resources.pak"
397   }
400 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
401 repack("browser_tests_pak") {
402   sources = [
403     "$root_gen_dir/chrome/options_test_resources.pak",
404   ]
405   output = "$root_out_dir/browser_tests.pak"
408 # Collects per-locale grit files from many sources into global per-locale files.
409 chrome_repack_locales("repack_locales_pack") {
410   visibility = [ ":*" ]
412   input_locales = locales
414   if (is_mac) {
415     output_locales = locales_as_mac_outputs
416   } else {
417     output_locales = locales
418   }
421 chrome_repack_locales("repack_pseudo_locales_pack") {
422   visibility = [ ":*" ]
424   input_locales = [ "fake-bidi" ]
426   if (is_mac) {
427     output_locales = [ "fake_bidi" ]  # Mac uses underscores.
428   } else {
429     output_locales = [ "fake-bidi" ]
430   }
433 # Generates a rule to repack a set of resources, substituting a given string
434 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
435 # the "gen" directory, and then introduces a copy rule to copy it to the root
436 # build directory.
438 # It's not clear why this two-step dance is necessary as opposed to just
439 # generating the file in the destination. However, this is what the GYP build
440 # does, and for maintenance purposes, this keeps the same files in the same
441 # place between the two builds when possible.
443 # Argument:
444 #   percent [required]
445 #      String to substitute for the percentage.
446 template("chrome_repack_percent") {
447   percent = invoker.percent
449   repack_name = "${target_name}_repack"
450   repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
452   copy_name = target_name
454   repack(repack_name) {
455     visibility = [ ":$copy_name" ]
457     # All sources should also have deps for completeness.
458     sources = [
459       "$root_gen_dir/components/components_resources_${percent}_percent.pak",
460       "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
461       "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
462       "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
463     ]
465     deps = [
466       "//chrome/app/theme:theme_resources",
467       "//chrome/renderer:resources",
468       "//components/strings",
469       "//net:net_resources",
470     ]
472     if (!is_ios) {
473       sources += [ "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak" ]
474       deps += [ "//content:resources" ]
475     }
476     if (use_ash) {
477       sources +=
478           [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
479       deps += [ "//ash/resources" ]
480     }
481     if (use_athena) {
482       sources += [ "$root_gen_dir/athena/resources/athena_resources_${percent}_percent.pak" ]
483       deps += [ "//athena/resources" ]
484     }
485     if (is_chromeos) {
486       sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
487       deps += [ "//ui/chromeos/resources" ]
488     }
489     if (enable_extensions) {
490       sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
491     }
493     output = repack_output_file
494   }
496   copy(copy_name) {
497     visibility = [ ":*" ]
498     deps = [
499       ":$repack_name",
500     ]
501     sources = [
502       repack_output_file,
503     ]
504     outputs = [
505       "$root_build_dir/chrome_${percent}_percent.pak",
506     ]
507   }
510 chrome_repack_percent("repack_chrome_100_percent") {
511   percent = "100"
514 if (enable_hidpi) {
515   chrome_repack_percent("repack_chrome_200_percent") {
516     percent = "200"
517   }
520 # GYP version: chrome/chrome_resources.gyp:chrome_strings
521 group("strings") {
522   deps = [
523     "//chrome/app:chromium_strings",
524     "//chrome/app:generated_resources",
525     "//chrome/app:google_chrome_strings",
526     "//chrome/app/resources:locale_settings",
527   ]
530 if (is_android) {
531   # GYP: //chrome/chrome.gyp:content_setting_java
532   java_cpp_enum("content_setting_javagen") {
533     sources = [
534       "../components/content_settings/core/common/content_settings.h",
535     ]
536     outputs = [
537       "org/chromium/chrome/browser/ContentSetting.java",
538     ]
539   }
541   # GYP: //chrome/chrome.gyp:content_settings_type_java
542   java_cpp_enum("content_settings_type_javagen") {
543     sources = [
544       "../components/content_settings/core/common/content_settings_types.h",
545     ]
546     outputs = [
547       "org/chromium/chrome/browser/ContentSettingsType.java",
548     ]
549   }
551   # GYP: //chrome/chrome.gyp:page_info_connection_type_java
552   java_cpp_enum("page_info_connection_type_javagen") {
553     sources = [
554       "browser/ui/android/website_settings_popup_android.h",
555     ]
556     outputs = [
557       "org/chromium/chrome/browser/PageInfoConnectionType.java",
558     ]
559   }
561   # GYP: //chrome/chrome_android.gypi:chrome_android_core
562   static_library("chrome_android_core") {
563     sources = [
564       "app/android/chrome_android_initializer.cc",
565       "app/android/chrome_android_initializer.h",
566       "app/android/chrome_main_delegate_android.cc",
567       "app/android/chrome_main_delegate_android.h",
568       "app/chrome_main_delegate.cc",
569       "app/chrome_main_delegate.h",
570     ]
572     include_dirs = [ android_ndk_include_dir ]
574     libs = [
575       "android",
576       "jnigraphics",
577     ]
579     deps = [
580       "//chrome/browser",
581       "//chrome/browser/ui",
582       "//chrome/plugin",
583       "//chrome/renderer",
584       "//chrome/utility",
585       "//components/enhanced_bookmarks",
586       "//content/public/app:browser",
587     ]
588   }