Revert of Add support for escaped target names in isolate driver. (patchset #6 id...
[chromium-blink-merge.git] / chrome / BUILD.gn
blob648524be21f9aba4ac7aca1daaffae67f671ee0d
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         "$target_gen_dir/chrome_exe_version.rc",
35         "//content/app/startup_helper_win.cc",
36         "//content/public/common/content_switches.cc",
37         "app/chrome_crash_reporter_client.cc",
38         "app/chrome_crash_reporter_client.h",
39         "app/chrome_exe.rc",
40         "app/chrome_exe_main_win.cc",
41         "app/chrome_watcher_client_win.cc",
42         "app/chrome_watcher_client_win.h",
43         "app/chrome_watcher_command_line_win.cc",
44         "app/chrome_watcher_command_line_win.h",
45         "app/client_util.cc",
46         "app/client_util.h",
47         "app/signature_validator_win.cc",
48         "app/signature_validator_win.h",
49         "common/crash_keys.cc",
50         "common/crash_keys.h'",
51       ]
52       deps += [
53         ":chrome_version_resources",
54         ":image_pre_reader",
55         ":main_dll",
57         # 'chrome_nacl_win64" TODO(GYP)
58         # '../win8/delegate_execute/delegate_execute.gyp:*', TODO(GYP)
59         # '../win8/metro_driver/metro_driver.gyp:metro_driver', TODO(GYP)
60         "//base",
61         "//breakpad:breakpad_handler",
62         "//breakpad:breakpad_sender",
63         "//chrome/browser:chrome_process_finder",
64         "//chrome/chrome_watcher",
65         "//chrome/chrome_watcher:client",
66         "//chrome/installer/util",
67         "//chrome_elf",
68         "//components/browser_watcher:browser_watcher_client",
69         "//components/crash/app",
70         "//crypto",
71         "//sandbox",
72         "//ui/gfx",
73       ]
74       libs = [
75         "wintrust.lib",
76         "crypt32.lib",
77       ]
78       configs -= [ "//build/config/win:console" ]
79       configs += [ "//build/config/win:windowed" ]
80     } else if (use_aura) {
81       # Non-Windows aura entrypoint.
82       sources += [ "app/chrome_exe_main_aura.cc" ]
83     }
85     if (is_linux) {
86       sources += [
87         "app/chrome_dll_resource.h",
88         "app/chrome_main.cc",
89         "app/chrome_main_delegate.cc",
90         "app/chrome_main_delegate.h",
91       ]
93       deps += [
94         # On Linux, link the dependencies (libraries) that make up actual
95         # Chromium functionality directly into the executable.
96         ":browser_dependencies",
97         ":child_dependencies",
98         ":manpage",
99         "//base/allocator",
101         # Needed to use the master_preferences functions
102         "//chrome/installer/util",
103         "//content/public/app:both",
104       ]
106       # Needed for chrome_main.cc initialization of libraries.
107       configs += [ "//build/config/linux:pangocairo" ]
109       # TODO(GYP) ['profiling==0 and linux_disable_pie==0', {
110       #   'ldflags': [
111       #      '-pie',
112       #   ],
113       #}],
115       if (use_x11) {
116         configs += [
117           "//build/config/linux:x11",
118           "//build/config/linux:xext",
119         ]
120       }
121     }
123     if (is_mac) {
124       sources += [ "app/chrome_exe_main_mac.cc" ]
125       # TODO(GYP) lots more stuff in the is_mac block.
126     } else {  # Non-Mac.
127       deps += [
128         ":packed_extra_resources",
129         ":packed_resources",
130         "//components/startup_metric_utils",
132         # Precompiled plugins that need to get copied to the output directory.
133         # On Mac, internal plugins go inside the framework, so these
134         # dependencies are on chrome.dll.
135         "//third_party/adobe/flash:flapper_binaries",
136         "//third_party/widevine/cdm:adapter",
137       ]
138       # TODO(GYP) some stuff from GYP including chrome_multiple_dll.
139     }
141     if (is_linux && enable_plugins) {
142       deps += [ "//pdf" ]
143     }
144   }
145 }  # !is_android
147 shared_library("main_dll") {
148   configs += [ "//build/config/compiler:wexit_time_destructors" ]
150   deps = [
151     ":browser_dependencies",
152     "//base/allocator",
153   ]
154   if (is_win) {
155     output_name = "chrome"
157     sources = [
158       "//base/win/dllmain.cc",
159       "app/chrome_command_ids.h",
160       "app/chrome_dll.rc",
161       "app/chrome_dll_resource.h",
162       "app/chrome_main.cc",
163       "app/chrome_main_delegate.cc",
164       "app/chrome_main_delegate.h",
165       "app/close_handle_hook_win.cc",
166       "app/close_handle_hook_win.h",
167       "app/delay_load_hook_win.cc",
168       "app/delay_load_hook_win.h",
169     ]
171     deps += [
172       # On Windows, link the dependencies (libraries) that make up actual
173       # Chromium functionality into this .dll.
174       ":chrome_version_resources",
175       "//chrome/app/theme:chrome_unscaled_resources",
176       "//chrome_elf",
177       "//content/app/resources",
178       "//crypto",
179       "//net:net_resources",
180       "//third_party/wtl",
181       "//ui/views",
182     ]
183     if (enable_configuration_policy) {
184       deps += [ "//components/policy" ]
185     }
186     if (current_cpu == "x86") {
187       # Add a dependency to custom import library for user32 delay imports only
188       # in x86 builds.
189       #deps += [ 'chrome_user32_delay_imports' ]  TODO(GYP)
190     }
192     # TODO(GYP) incremental linking flags in debug builds
193     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
195     # TODO(GYP) Lots of VCLinkerTool stuff on Windows.
197     # TODO(GYP) chrome_pgo_phase on Windows.
198   }
200   if (use_aura) {
201     deps += [ "//ui/compositor" ]
202   }
204   #TODO(GYP) add chrome_multiple_dll support
205   if (false) {  #chrome_multiple_dll) {
206     defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
207     deps += [ "//content/public/app:browser" ]
208   } else {
209     deps += [
210       ":child_dependencies",
211       "//content/public/app:both",
212     ]
213   }
215   if (cld_version == 0 || cld_version == 2) {
216     deps += [ "//third_party/cld_2" ]
217   }
219   if (is_mac) {
220     #['OS=="mac" and component!="shared_library"', {  TODO(GYP)
221     #  'includes': [ 'chrome_dll_bundle.gypi' ],
222     #}],
223     # TODO(GYP) Lots of other stuff in the OS=="mac" block.
224   }
226   if (enable_plugins) {
227     deps += [ "//pdf" ]
228   }
231 # GYP version: chromium_browser_dependencies variable in chrome.gyp
232 group("browser_dependencies") {
233   deps = [
234     "//chrome/browser",
235     "//chrome/common",
236     "//sync",
237   ]
238   if (!is_ios) {
239     deps += [ "//ppapi/host" ]
240   }
242   if (enable_basic_printing || enable_print_preview) {
243     deps += [ "//printing" ]
244     if (enable_print_preview) {
245       deps += [ "//chrome/service" ]
246     }
247   }
250 # GYP version: chromium_child_dependencies variable in chrome.gyp
251 group("child_dependencies") {
252   deps = [
253     "//chrome/common",
254     "//sync",
255   ]
256   if (!is_ios) {
257     deps += [
258       "//chrome/browser/devtools",
259       "//chrome/child",
260       "//chrome/plugin",
261       "//chrome/renderer",
262       "//chrome/utility",
263       "//content/public/child",
264       "//third_party/WebKit/public:blink_devtools_frontend_resources",
265     ]
266   }
267   if (cld_version == 0 || cld_version == 2) {
268     deps += [ "//third_party/cld_2:cld2_platform_impl" ]
269   }
271   if (enable_nacl) {
272     deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
273   }
274   if (enable_remoting) {
275     deps += [ "//remoting/client/plugin" ]
276   }
279 if (is_win) {
280   # TODO(brettw) this duplicates "//chrome/common:version" which applies to
281   # Linux.
282   process_version("version_header") {
283     # TODO(brettW) this should have more reduced visibility, but chrome/browser
284     # currently depends on this.
285     #visibility = [ ":*" ]
287     # This one just uses the custom template and no separate sources.
288     sources = []
289     template_file = "version.h.in"
291     # TODO(brettw) this should move to $target_gen_dir/version.h and
292     # source files including it should reference it via "chrome/version.h"
293     output = "$root_gen_dir/version.h"
294   }
296   process_version("chrome_exe_version") {
297     sources = [
298       "app/chrome_exe.ver",
299     ]
300     output = "$target_gen_dir/chrome_exe_version.rc"
301   }
303   process_version("chrome_dll_version") {
304     sources = [
305       "app/chrome_dll.ver",
306     ]
307     output = "$target_gen_dir/chrome_dll_version.rc"
308   }
310   process_version("nacl64_exe_version") {
311     sources = [
312       "app/nacl64_exe.ver",
313     ]
314     output = "$target_gen_dir/nacl64_exe_version.rc"
315   }
317   process_version("other_version") {
318     sources = [
319       "app/other.ver",
320     ]
321     output = "$target_gen_dir/other_version.rc"
322   }
324   group("chrome_version_resources") {
325     deps = [
326       ":chrome_exe_version",
327       ":chrome_dll_version",
328       ":nacl64_exe_version",
329       ":other_version",
330     ]
331   }
333   source_set("image_pre_reader") {
334     sources = [
335       "app/image_pre_reader_win.cc",
336       "app/image_pre_reader_win.h",
337     ]
338     deps = [
339       "//base",
340     ]
341   }
344 # GYP version: chrome/chrome_resources.gyp:chrome_resources
345 group("resources") {
346   deps = [
347     # Note: GYP lists some dependencies in addition to these actions. However,
348     # these are just dependencies for the actions themselves, which our actions
349     # list individually when needed.
350     "//chrome/browser:resources",
351     "//chrome/common:resources",
352     "//chrome/renderer:resources",
353   ]
355   if (enable_extensions) {
356     deps += [ "//chrome/common:extensions_api_resources" ]
357   }
360 # GYP version: chrome/chrome_resources.gyp:chrome_extra_resources
361 group("extra_resources") {
362   deps = [
363     "//chrome/browser/resources:invalidations_resources",
364     "//chrome/browser/resources:memory_internals_resources",
365     "//chrome/browser/resources:net_internals_resources",
366     "//chrome/browser/resources:password_manager_internals_resources",
367     "//chrome/browser/resources:signin_internals_resources",
368     "//chrome/browser/resources:sync_internals_resources",
369     "//chrome/browser/resources:translate_internals_resources",
370   ]
371   if (!is_ios) {
372     deps += [
373       "//chrome/browser/resources:component_extension_resources",
374       "//chrome/browser/resources:options_resources",
375     ]
376   }
378   if (enable_chromevox_next) {
379     deps += [
380       #'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2',  TODO(GYP)
381     ]
382   } else {
383     deps += [
384       #'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox',  TODO(GYP)
385     ]
386   }
388   if (enable_extensions) {
389     deps += [
390       "//chrome/browser/resources:quota_internals_resources",
391       "//chrome/browser/resources:sync_file_system_internals_resources",
392     ]
393   }
396 if (is_chrome_branded) {
397   copy("default_apps") {
398     visibility = [ ":packed_resources" ]
399     sources = [
400       "browser/resources/default_apps/docs.crx",
401       "browser/resources/default_apps/drive.crx",
402       "browser/resources/default_apps/external_extensions.json",
403       "browser/resources/default_apps/gmail.crx",
404       "browser/resources/default_apps/search.crx",
405       "browser/resources/default_apps/youtube.crx",
406     ]
407     outputs = [
408       "$root_out_dir/default_apps/{{source_file_part}}",
409     ]
410   }
413 group("packed_resources") {
414   deps = [
415     ":repack_locales_pack",
416     ":repack_pseudo_locales_pack",
417     ":repack_chrome_100_percent",
418   ]
420   if (is_chrome_branded) {
421     deps += [ ":default_apps" ]
422   }
424   if (enable_hidpi) {
425     deps += [ ":repack_chrome_200_percent" ]
426   }
429 repack("packed_extra_resources") {
430   visibility = [ "./*" ]
431   sources = [
432     "$root_gen_dir/chrome/browser_resources.pak",
433     "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
434     "$root_gen_dir/chrome/common_resources.pak",
435     "$root_gen_dir/chrome/invalidations_resources.pak",
436     "$root_gen_dir/chrome/memory_internals_resources.pak",
437     "$root_gen_dir/chrome/net_internals_resources.pak",
438     "$root_gen_dir/chrome/password_manager_internals_resources.pak",
439     "$root_gen_dir/chrome/signin_internals_resources.pak",
440     "$root_gen_dir/chrome/sync_internals_resources.pak",
441     "$root_gen_dir/chrome/translate_internals_resources.pak",
442     "$root_gen_dir/components/components_resources.pak",
443     "$root_gen_dir/net/net_resources.pak",
444     "$root_gen_dir/ui/resources/webui_resources.pak",
445   ]
446   deps = [
447     "//chrome/browser:resources",
448     "//chrome/app/theme:chrome_unscaled_resources",
449     "//chrome/common:resources",
450     "//chrome/browser/resources:invalidations_resources",
451     "//chrome/browser/resources:memory_internals_resources",
452     "//chrome/browser/resources:net_internals_resources",
453     "//chrome/browser/resources:password_manager_internals_resources",
454     "//chrome/browser/resources:signin_internals_resources",
455     "//chrome/browser/resources:sync_internals_resources",
456     "//chrome/browser/resources:translate_internals_resources",
457     "//components/resources",
458     "//net:net_resources",
459     "//ui/resources",
460   ]
462   if (!is_ios && !is_android) {
463     # New paks should be added here by default.
464     sources += [
465       "$root_gen_dir/blink/devtools_resources.pak",
466       "$root_gen_dir/chrome/component_extension_resources.pak",
467       "$root_gen_dir/chrome/options_resources.pak",
468       "$root_gen_dir/chrome/quota_internals_resources.pak",
469       "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
470       "$root_gen_dir/chrome/webrtc_device_provider_resources.pak",
471     ]
472     deps += [
473       "//chrome/browser/devtools:webrtc_device_provider_resources",
474       "//chrome/browser/resources:component_extension_resources",
475       "//chrome/browser/resources:options_resources",
476       "//chrome/browser/resources:quota_internals_resources",
477       "//chrome/browser/resources:sync_file_system_internals_resources",
478       "//content/browser/devtools:devtools_resources",
479     ]
480   }
481   if (!is_ios) {
482     sources += [
483       "$root_gen_dir/blink/public/resources/blink_resources.pak",
484       "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
485       "$root_gen_dir/content/content_resources.pak",
486     ]
487   }
488   if (is_chromeos) {
489     sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
490     sources += [ "$root_gen_dir/ui/oobe/oobe_resources.pak" ]
491     deps += [ "//ui/file_manager:resources" ]
492     deps += [ "//ui/oobe:resources" ]
493   }
494   if (enable_extensions) {
495     sources += [
496       "$root_gen_dir/chrome/extensions_api_resources.pak",
497       "$root_gen_dir/extensions/extensions_renderer_resources.pak",
498       "$root_gen_dir/extensions/extensions_resources.pak",
499     ]
500     deps += [ "//chrome/common:extensions_api_resources" ]
501   }
503   # GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
504   # it them copies it. This skipes the copy step and writes it to the final
505   # location.
506   if (is_mac || is_ios) {
507     output = "$root_gen_dir/repack/resources.pak"
508   } else {
509     output = "$root_out_dir/resources.pak"
510   }
513 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
514 repack("browser_tests_pak") {
515   sources = [
516     "$root_gen_dir/chrome/options_test_resources.pak",
517   ]
518   output = "$root_out_dir/browser_tests.pak"
521 # Collects per-locale grit files from many sources into global per-locale files.
522 chrome_repack_locales("repack_locales_pack") {
523   visibility = [ ":*" ]
525   input_locales = locales
527   if (is_mac) {
528     output_locales = locales_as_mac_outputs
529   } else {
530     output_locales = locales
531   }
534 chrome_repack_locales("repack_pseudo_locales_pack") {
535   visibility = [ ":*" ]
537   input_locales = [ "fake-bidi" ]
539   if (is_mac) {
540     output_locales = [ "fake_bidi" ]  # Mac uses underscores.
541   } else {
542     output_locales = [ "fake-bidi" ]
543   }
546 # Generates a rule to repack a set of resources, substituting a given string
547 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
548 # the "gen" directory, and then introduces a copy rule to copy it to the root
549 # build directory.
551 # It's not clear why this two-step dance is necessary as opposed to just
552 # generating the file in the destination. However, this is what the GYP build
553 # does, and for maintenance purposes, this keeps the same files in the same
554 # place between the two builds when possible.
556 # Argument:
557 #   percent [required]
558 #      String to substitute for the percentage.
559 template("chrome_repack_percent") {
560   percent = invoker.percent
562   repack_name = "${target_name}_repack"
563   repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
565   copy_name = target_name
567   repack(repack_name) {
568     visibility = [ ":$copy_name" ]
570     # All sources should also have deps for completeness.
571     sources = [
572       "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
573       "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
574       "$root_gen_dir/components/components_resources_${percent}_percent.pak",
575       "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
576     ]
578     deps = [
579       "//chrome/app/theme:theme_resources",
580       "//chrome/renderer:resources",
581       "//components/strings",
582       "//net:net_resources",
583     ]
585     if (!is_ios) {
586       sources += [ "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak" ]
587       deps += [ "//content:resources" ]
588     }
589     if (use_ash) {
590       sources +=
591           [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
592       deps += [ "//ash/resources" ]
593     }
594     if (is_chromeos) {
595       sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak" ]
596       deps += [ "//ui/chromeos/resources" ]
597     }
598     if (enable_extensions) {
599       sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
600     }
602     output = repack_output_file
603   }
605   copy(copy_name) {
606     visibility = [ ":*" ]
607     deps = [
608       ":$repack_name",
609     ]
610     sources = [
611       repack_output_file,
612     ]
613     outputs = [
614       "$root_build_dir/chrome_${percent}_percent.pak",
615     ]
616   }
619 chrome_repack_percent("repack_chrome_100_percent") {
620   percent = "100"
623 if (enable_hidpi) {
624   chrome_repack_percent("repack_chrome_200_percent") {
625     percent = "200"
626   }
629 # GYP version: chrome/chrome_resources.gyp:chrome_strings
630 group("strings") {
631   deps = [
632     "//chrome/app:chromium_strings",
633     "//chrome/app:generated_resources",
634     "//chrome/app:google_chrome_strings",
635     "//chrome/app/resources:locale_settings",
636   ]
639 if (is_android) {
640   # GYP: //chrome/chrome.gyp:content_setting_java
641   java_cpp_enum("content_setting_javagen") {
642     sources = [
643       "../components/content_settings/core/common/content_settings.h",
644     ]
645     outputs = [
646       "org/chromium/chrome/browser/ContentSetting.java",
647     ]
648   }
650   # GYP: //chrome/chrome.gyp:content_settings_type_java
651   java_cpp_enum("content_settings_type_javagen") {
652     sources = [
653       "../components/content_settings/core/common/content_settings_types.h",
654     ]
655     outputs = [
656       "org/chromium/chrome/browser/ContentSettingsType.java",
657     ]
658   }
660   # GYP: //chrome/chrome.gyp:page_info_connection_type_java
661   java_cpp_enum("page_info_connection_type_javagen") {
662     sources = [
663       "browser/ui/android/website_settings_popup_android.h",
664     ]
665     outputs = [
666       "org/chromium/chrome/browser/PageInfoConnectionType.java",
667     ]
668   }
670   # GYP: //chrome/chrome_android.gypi:chrome_android_core
671   static_library("chrome_android_core") {
672     sources = [
673       "app/android/chrome_android_initializer.cc",
674       "app/android/chrome_android_initializer.h",
675       "app/android/chrome_jni_onload.cc",
676       "app/android/chrome_jni_onload.h",
677       "app/android/chrome_main_delegate_android.cc",
678       "app/android/chrome_main_delegate_android.h",
679       "app/chrome_main_delegate.cc",
680       "app/chrome_main_delegate.h",
681     ]
683     include_dirs = [ android_ndk_include_dir ]
685     libs = [
686       "android",
687       "jnigraphics",
688     ]
690     deps = [
691       "//chrome/browser",
692       "//chrome/browser/ui",
693       "//chrome/child",
694       "//chrome/plugin",
695       "//chrome/renderer",
696       "//chrome/utility",
697       "//components/enhanced_bookmarks",
698       "//content/public/app:both",
699     ]
700   }
703 if (is_linux) {
704   action("manpage") {
705     if (is_chrome_branded) {
706       name = "Google Chrome"
707       filename = "google-chrome"
708       confdir = "google-chrome"
709     } else {
710       name = "Chromium"
711       filename = "chromium-browser"
712       confdir = "chromium"
713     }
715     script = "//chrome/tools/build/linux/sed.py"
716     infile = "app/resources/manpage.1.in"
717     inputs = [
718       infile,
719     ]
721     outfile = "$root_out_dir/chrome.1"
722     outputs = [
723       outfile,
724     ]
726     args = [
727       rebase_path(infile, root_build_dir),
728       rebase_path(outfile, root_build_dir),
729       "-e s/@@NAME@@/$name/",
730       "-e s/@@FILENAME@@/$filename/",
731       "-e s/@@CONFDIR@@/$confdir/",
732     ]
733   }