| # Copyright 2014 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//chrome/browser/buildflags.gni") |
| import("//chrome/common/features.gni") |
| import("//chrome/test/base/js2gtest.gni") |
| import("//chrome/test/include_js_tests.gni") |
| import("//components/nacl/features.gni") |
| import("//third_party/closure_compiler/compile_js.gni") |
| import("//tools/grit/grit_rule.gni") |
| import("//tools/grit/repack.gni") |
| |
| assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome") |
| |
| if (enable_js_type_check) { |
| group("closure_compile") { |
| deps = [ |
| "components:closure_compile", |
| "engagement:closure_compile", |
| "interventions_internals:closure_compile", |
| "media:closure_compile", |
| "memory_internals:closure_compile", |
| "reset_password:closure_compile", |
| ] |
| if (is_linux || is_chromeos || is_win || is_mac) { |
| deps += [ |
| "bluetooth_internals:closure_compile", |
| "bookmarks:closure_compile", |
| "discards:closure_compile", |
| "download_internals:closure_compile", |
| "downloads:closure_compile", |
| "gaia_auth_host:closure_compile", |
| "history:closure_compile", |
| "inline_login:closure_compile", |
| "local_ntp:closure_compile", |
| "local_state:closure_compile", |
| "management:closure_compile", |
| "media_router:closure_compile", |
| "nearby_internals:closure_compile", |
| "nearby_share:closure_compile", |
| "nearby_share/shared:closure_compile", |
| "nearby_share/shared:closure_compile_module", |
| "new_tab_page:closure_compile", |
| "ntp4:closure_compile", |
| "omnibox:closure_compile", |
| "pdf:closure_compile", |
| "print_preview:closure_compile", |
| "quota_internals:closure_compile", |
| "settings:closure_compile", |
| "settings:closure_compile_module", |
| "signin:closure_compile", |
| "usb_internals:closure_compile", |
| "user_manager:closure_compile", |
| "web_app_internals:closure_compile", |
| "welcome:closure_compile", |
| ] |
| } |
| if (is_win || is_android || is_linux || is_chromeos) { |
| deps += [ "sandbox_internals:closure_compile" ] |
| } |
| if (is_chromeos) { |
| deps += [ "chromeos:closure_compile" ] |
| } |
| if (enable_extensions) { |
| deps += [ "extensions:closure_compile" ] |
| } |
| if (enable_nacl) { |
| deps += [ "about_nacl:closure_compile" ] |
| } |
| if (enable_tab_search) { |
| deps += [ "tab_search:closure_compile" ] |
| } |
| if (enable_webui_tab_strip) { |
| deps += [ "tab_strip:closure_compile" ] |
| } |
| if (enable_kaleidoscope) { |
| deps += [ "kaleidoscope:closure_compile" ] |
| } |
| if (is_android) { |
| deps += [ |
| "explore_sites_internals:closure_compile", |
| "feed_internals:closure_compile", |
| "internals/notifications:closure_compile", |
| "internals/query_tiles:closure_compile", |
| "offline_pages:closure_compile", |
| "snippets_internals:closure_compile", |
| "webapks:closure_compile", |
| ] |
| } |
| if (is_win || is_mac || is_desktop_linux) { |
| deps += [ "browser_switch:closure_compile" ] |
| } |
| |
| # Note: The following targets should only be type-checked on Windows builds, |
| # but because Window bots don't depend on Java, |closure_compile| is off on |
| # Windows. Adding |is_linux| so that these targets are type-checked on at |
| # least one platform. |
| if (is_win || is_linux || is_chromeos) { |
| deps += [ "conflicts:closure_compile" ] |
| } |
| } |
| } |
| |
| if (!is_android) { |
| grit("bookmarks_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| if (optimize_webui) { |
| source = "bookmarks/bookmarks_resources_vulcanized.grd" |
| |
| deps = [ "//chrome/browser/resources/bookmarks:build" ] |
| } else { |
| source = "bookmarks/bookmarks_resources.grd" |
| |
| deps = [ "//chrome/browser/resources/bookmarks:web_components" ] |
| } |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/bookmarks_resources.h", |
| "grit/bookmarks_resources_map.cc", |
| "grit/bookmarks_resources_map.h", |
| "bookmarks_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("component_extension_resources") { |
| source = "component_extension_resources.grd" |
| |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| deps = [ "//chrome/browser/resources/pdf:web_components" ] |
| |
| defines = chrome_grit_defines |
| if (enable_hangout_services_extension) { |
| defines += [ "enable_hangout_services_extension" ] |
| } |
| |
| outputs = [ |
| "grit/component_extension_resources.h", |
| "grit/component_extension_resources_map.cc", |
| "grit/component_extension_resources_map.h", |
| "component_extension_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("gaia_auth_host_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| source = "gaia_auth_host/gaia_auth_host_resources.grd" |
| deps = [ "//chrome/browser/resources/gaia_auth_host:modulize" ] |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/gaia_auth_host_resources.h", |
| "grit/gaia_auth_host_resources_map.cc", |
| "grit/gaia_auth_host_resources_map.h", |
| "gaia_auth_host_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("history_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| if (optimize_webui) { |
| source = "history/history_resources_vulcanized.grd" |
| |
| deps = [ "//chrome/browser/resources/history:build" ] |
| } else { |
| source = "history/history_resources.grd" |
| |
| deps = [ "//chrome/browser/resources/history:web_components" ] |
| } |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/history_resources.h", |
| "grit/history_resources_map.cc", |
| "grit/history_resources_map.h", |
| "history_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("local_ntp_resources") { |
| source = "local_ntp/local_ntp_resources.grd" |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/local_ntp_resources.h", |
| "local_ntp_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("nearby_internals_resources") { |
| source = "nearby_internals/nearby_internals_resources.grd" |
| |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| deps = [ "//chrome/browser/resources/nearby_internals:web_components" ] |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/nearby_internals_resources.h", |
| "grit/nearby_internals_resources_map.cc", |
| "grit/nearby_internals_resources_map.h", |
| "nearby_internals_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("nearby_share_dialog_resources") { |
| source = "nearby_share/nearby_share_dialog_resources.grd" |
| |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| deps = [ |
| "//chrome/browser/resources/nearby_share:web_components", |
| "//chrome/browser/resources/nearby_share/shared:polymer3_elements", |
| "//chrome/browser/ui/webui/nearby_share:mojom_js", |
| ] |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/nearby_share_dialog_resources.h", |
| "grit/nearby_share_dialog_resources_map.cc", |
| "grit/nearby_share_dialog_resources_map.h", |
| "nearby_share_dialog_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("new_tab_page_resources") { |
| if (optimize_webui) { |
| source = "new_tab_page/new_tab_page_resources_vulcanized.grd" |
| } else { |
| source = "new_tab_page/new_tab_page_resources.grd" |
| } |
| |
| deps = [ |
| "//chrome/browser/promo_browser_command:mojo_bindings_js", |
| "//chrome/browser/ui/webui/new_tab_page:mojo_bindings_js", |
| "//skia/public/mojom:mojom_js", |
| ] |
| if (optimize_webui) { |
| deps += [ "//chrome/browser/resources/new_tab_page:optimized_js" ] |
| } else { |
| deps += [ "//chrome/browser/resources/new_tab_page:web_components" ] |
| } |
| |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/new_tab_page_resources.h", |
| "grit/new_tab_page_resources_map.cc", |
| "grit/new_tab_page_resources_map.h", |
| "new_tab_page_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("settings_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| if (optimize_webui) { |
| source = "settings/settings_resources_vulcanized.grd" |
| |
| deps = [ "//chrome/browser/resources/settings:build_polymer3" ] |
| } else { |
| source = "settings/settings_resources.grd" |
| deps = [ "//chrome/browser/resources/settings:polymer3_elements" ] |
| } |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/settings_resources.h", |
| "grit/settings_resources_map.cc", |
| "grit/settings_resources_map.h", |
| "settings_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("downloads_resources") { |
| if (optimize_webui) { |
| source = "downloads/downloads_resources_vulcanized.grd" |
| |
| deps = [ "//chrome/browser/resources/downloads:build" ] |
| } else { |
| source = "downloads/downloads_resources.grd" |
| |
| deps = [ "//chrome/browser/resources/downloads:web_components" ] |
| } |
| deps += [ "//chrome/browser/ui/webui/downloads:mojo_bindings_js" ] |
| |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/downloads_resources.h", |
| "grit/downloads_resources_map.cc", |
| "grit/downloads_resources_map.h", |
| "downloads_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| } |
| |
| if (is_chromeos) { |
| grit("os_settings_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| deps = [ "//chrome/browser/ui/webui/settings/chromeos:mojom_js" ] |
| if (optimize_webui) { |
| # Required due to flattenhtml="true" on a generated file. |
| enable_input_discovery_for_gn_analyze = false |
| source = "settings/os_settings_resources_vulcanized.grd" |
| |
| deps += [ |
| "//chrome/browser/resources/settings/chromeos:build", |
| "//chrome/browser/resources/settings/chromeos:build_polymer3", |
| ] |
| } else { |
| source = "settings/os_settings_resources.grd" |
| deps += [ |
| "//chrome/browser/resources/settings/chromeos:polymer3_elements", |
| "//chrome/browser/ui/webui/settings/chromeos/search:mojo_bindings_js", |
| ] |
| } |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/os_settings_resources.h", |
| "grit/os_settings_resources_map.cc", |
| "grit/os_settings_resources_map.h", |
| "os_settings_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("bluetooth_pairing_dialog_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| if (optimize_webui) { |
| source = "chromeos/bluetooth_pairing_dialog/bluetooth_pairing_dialog_resources_vulcanized.grd" |
| |
| deps = [ |
| "//chrome/browser/resources/chromeos/bluetooth_pairing_dialog:build", |
| ] |
| } else { |
| source = "chromeos/bluetooth_pairing_dialog/bluetooth_pairing_dialog_resources.grd" |
| |
| deps = [ "//chrome/browser/resources/chromeos/bluetooth_pairing_dialog:web_components" ] |
| } |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/bluetooth_pairing_dialog_resources.h", |
| "grit/bluetooth_pairing_dialog_resources_map.cc", |
| "grit/bluetooth_pairing_dialog_resources_map.h", |
| "bluetooth_pairing_dialog_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| } |
| |
| if (!is_android && !is_chromeos) { |
| grit("welcome_resources") { |
| source = "welcome/welcome_resources.grd" |
| |
| deps = [ "//chrome/browser/resources/welcome:web_components" ] |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/welcome_resources.h", |
| "grit/welcome_resources_map.cc", |
| "grit/welcome_resources_map.h", |
| "welcome_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("profile_picker_resources") { |
| source = "signin/profile_picker/profile_picker_resources.grd" |
| |
| deps = [ "//chrome/browser/resources/signin/profile_picker:web_components" ] |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/profile_picker_resources.h", |
| "grit/profile_picker_resources_map.cc", |
| "grit/profile_picker_resources_map.h", |
| "profile_picker_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| } |
| |
| if (enable_extensions) { |
| grit("extensions_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| if (optimize_webui) { |
| source = "extensions/extensions_resources_vulcanized.grd" |
| |
| deps = [ "//chrome/browser/resources/extensions:build" ] |
| } else { |
| source = "extensions/extensions_resources.grd" |
| |
| deps = [ "//chrome/browser/resources/extensions:web_components" ] |
| } |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/extensions_resources.h", |
| "grit/extensions_resources_map.cc", |
| "grit/extensions_resources_map.h", |
| "extensions_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("sync_file_system_internals_resources") { |
| source = |
| "sync_file_system_internals/sync_file_system_internals_resources.grd" |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/sync_file_system_internals_resources.h", |
| "sync_file_system_internals_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| } |
| |
| if (enable_print_preview) { |
| grit("print_preview_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| if (optimize_webui) { |
| source = "print_preview/print_preview_resources_vulcanized.grd" |
| deps = [ "//chrome/browser/resources/print_preview:build" ] |
| } else { |
| source = "print_preview/print_preview_resources.grd" |
| deps = [ "//chrome/browser/resources/print_preview/ui:web_components" ] |
| } |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/print_preview_resources.h", |
| "grit/print_preview_resources_map.cc", |
| "grit/print_preview_resources_map.h", |
| "print_preview_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| grit("print_preview_pdf_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| |
| source = "print_preview/print_preview_pdf_resources.grd" |
| deps = [ "//chrome/browser/resources/pdf:web_components" ] |
| |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/print_preview_pdf_resources.h", |
| "grit/print_preview_pdf_resources_map.cc", |
| "grit/print_preview_pdf_resources_map.h", |
| "print_preview_pdf_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| } |
| |
| if (enable_tab_search) { |
| grit("tab_search_resources") { |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| source = "tab_search/tab_search_resources.grd" |
| deps = [ |
| "//chrome/browser/resources/tab_search:web_components", |
| "//chrome/browser/ui/webui/tab_search:mojo_bindings_js", |
| ] |
| defines = chrome_grit_defines |
| outputs = [ |
| "grit/tab_search_resources.h", |
| "grit/tab_search_resources_map.cc", |
| "grit/tab_search_resources_map.h", |
| "tab_search_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| } |
| |
| if (enable_webui_tab_strip) { |
| grit("tab_strip_resources") { |
| source = "tab_strip/tab_strip_resources.grd" |
| defines = chrome_grit_defines |
| deps = [ "tab_strip:web_components" ] |
| outputs = [ |
| "grit/tab_strip_resources.h", |
| "grit/tab_strip_resources_map.cc", |
| "grit/tab_strip_resources_map.h", |
| "tab_strip_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| grit_flags = [ |
| "-E", |
| "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), |
| ] |
| } |
| } |
| |
| repack("dev_ui_paks") { |
| output = "$root_gen_dir/chrome/dev_ui_resources.pak" |
| |
| sources = [ |
| "$root_gen_dir/chrome/bluetooth_internals_resources.pak", |
| "$root_gen_dir/chrome/dev_ui_browser_resources.pak", |
| "$root_gen_dir/chrome/invalidations_resources.pak", |
| "$root_gen_dir/chrome/net_internals_resources.pak", |
| "$root_gen_dir/chrome/omnibox_resources.pak", |
| "$root_gen_dir/chrome/quota_internals_resources.pak", |
| "$root_gen_dir/chrome/usb_internals_resources.pak", |
| "$root_gen_dir/chrome/webrtc_logs_resources.pak", |
| "$root_gen_dir/components/dev_ui_components_resources.pak", |
| "$root_gen_dir/components/sync_driver_resources.pak", |
| "$root_gen_dir/content/browser/resources/media/media_internals_resources.pak", |
| "$root_gen_dir/content/browser/webrtc/resources/webrtc_internals_resources.pak", |
| "$root_gen_dir/content/dev_ui_content_resources.pak", |
| ] |
| deps = [ |
| "//chrome/browser:dev_ui_browser_resources", |
| "//chrome/browser/resources/bluetooth_internals:resources", |
| "//chrome/browser/resources/invalidations:invalidations_resources", |
| "//chrome/browser/resources/media:webrtc_logs_resources", |
| "//chrome/browser/resources/net_internals:net_internals_resources", |
| "//chrome/browser/resources/omnibox:resources", |
| "//chrome/browser/resources/quota_internals:quota_internals_resources", |
| "//chrome/browser/resources/usb_internals:resources", |
| "//components/resources:dev_ui_components_resources", |
| "//components/sync/driver:resources", |
| "//content:dev_ui_content_resources", |
| "//content/browser/resources/media:media_internals_resources", |
| "//content/browser/webrtc/resources", |
| ] |
| |
| if (is_android) { |
| sources += [ "$root_gen_dir/chrome/webapks_ui_resources.pak" ] |
| deps += [ "//chrome/browser/resources/webapks:webapks_ui_resources" ] |
| } |
| } |
| |
| # Some targets in this file are depended on independent of include_js_tests, |
| # so this file gets loaded even if !include_js_tests. Since js2gtest()s don't |
| # compile in some scenarios when include_js_tests is false, and since this |
| # file is loaded even when it's false, we need to make sure the js2gtest() |
| # target only exists in this file when it works. (In contrast, most other |
| # BUILD.gn files containing js2gtest()s contain nothing else and hence are only |
| # loaded when include_js_tests is true.) |
| if (!is_android && include_js_tests) { |
| js2gtest("resources_unitjs_tests") { |
| test_type = "webui" |
| sources = [ "gaia_auth_host/password_change_authenticator_test.unitjs" ] |
| |
| # This has to be a gen_include, so it doesn't collide with other js2gtests |
| gen_include_files = [ "//ui/webui/resources/js/cr.js" ] |
| |
| # But these have to be extra_js_files, since it uses a native object |
| # EventTarget, which doesn't work at compile time. |
| extra_js_files = [ |
| "//ui/webui/resources/js/cr/event_target.js", |
| "gaia_auth_host/password_change_authenticator.js", |
| ] |
| defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] |
| } |
| |
| source_set("browser_tests_js") { |
| testonly = true |
| deps = [ ":resources_unitjs_tests" ] |
| } |
| } |