blob: 366e22fa6432c208e897f62ceb8c3d6b722a4a00 [file] [log] [blame]
# 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("//build/config/chromeos/ui_mode.gni")
import("//chrome/browser/buildflags.gni")
import("//chrome/common/features.gni")
import("//chrome/test/base/js2gtest.gni")
import("//chrome/test/include_js_tests.gni")
import("//chromeos/components/chromebox_for_meetings/buildflags/buildflags.gni")
import("//components/nacl/features.gni")
import("//pdf/features.gni")
import("//printing/buildflags/buildflags.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")
group("resources") {
public_deps = []
if (!is_android) {
public_deps += [
":component_extension_resources",
":dev_ui_paks",
":webid_resources",
"app_service_internals:resources",
"bookmarks:resources",
"commander:resources",
"download_shelf:resources",
"downloads:resources",
"federated_learning:resources",
"feedback_webui:resources",
"gaia_auth_host:resources",
"history:resources",
"management:resources",
"memories:resources",
"new_tab_page:resources",
"new_tab_page_instant:resources",
"new_tab_page_third_party:resources",
"read_later:resources",
"settings:resources",
"tab_search:resources",
"whats_new:resources",
]
if (is_chrome_branded) {
public_deps += [ "media_router:cast_feedback_ui_resources" ]
}
}
if (is_chromeos_ash) {
public_deps += [
":bluetooth_pairing_dialog_resources",
":internet_config_dialog_resources",
":internet_detail_dialog_resources",
"chromeos:multidevice_setup_resources",
"chromeos/accessibility:build",
"chromeos/emoji_picker:resources",
"chromeos/enterprise_casting:resources",
"chromeos/launcher_internals:resources",
"chromeos/login:modulized_resources",
"chromeos/login:resources",
"chromeos/multidevice_internals:resources",
"chromeos/network_ui:resources",
"chromeos/projector:resources",
"nearby_internals:resources",
"nearby_share:resources",
"settings/chromeos:resources",
]
}
if (is_win || is_mac || is_linux || is_chromeos_lacros) {
public_deps += [ "browser_switch:resources" ]
}
if (is_linux || is_chromeos) {
public_deps += [ "webui_js_error:resources" ]
}
if (!is_android && !is_chromeos_ash) {
public_deps += [
"ntp4:apps_resources",
"signin/profile_picker:resources",
"welcome:resources",
]
}
if (enable_extensions) {
public_deps += [
"extensions:resources",
"sync_file_system_internals:resources",
]
}
if (enable_pdf) {
public_deps += [ "pdf:resources" ]
}
if (enable_print_preview) {
public_deps += [ "print_preview:resources" ]
}
if (is_cfm) {
public_deps += [ "chromeos/chromebox_for_meetings:resources" ]
}
}
if (enable_js_type_check) {
group("closure_compile") {
deps = [
"accessibility:closure_compile",
"components:closure_compile",
"domain_reliability_internals:closure_compile",
"engagement:closure_compile",
"media:closure_compile",
"memory_internals:closure_compile",
"predictors:closure_compile",
"reset_password:closure_compile",
]
if (is_linux || is_chromeos || is_win || is_mac) {
deps += [
"bluetooth_internals:closure_compile",
"commander:closure_compile",
"discards:closure_compile",
"download_internals:closure_compile",
"federated_learning:closure_compile",
"feedback_webui/js:closure_compile",
"gaia_auth_host:closure_compile",
"inline_login:closure_compile",
"internals/user_education:closure_compile",
"media_router:closure_compile",
"nearby_internals:closure_compile",
"new_tab_page:closure_compile",
"new_tab_page_instant:closure_compile",
"new_tab_page_third_party:closure_compile",
"ntp4:closure_compile",
"omnibox:closure_compile",
"quota_internals:closure_compile",
"read_later:closure_compile",
"settings:closure_compile",
"signin:closure_compile",
"sync_file_system_internals:closure_compile",
"tab_search:closure_compile",
"usb_internals:closure_compile",
]
}
if (is_win || is_android || is_linux || is_chromeos) {
deps += [ "sandbox_internals:closure_compile" ]
}
if (is_linux || is_chromeos) {
deps += [ "webui_js_error:closure_compile" ]
}
if (is_chromeos_ash) {
deps += [
"chromeos:closure_compile",
"chromeos/projector:closure_compile",
"nearby_share:closure_compile",
"nearby_share/shared:closure_compile",
"nearby_share/shared:closure_compile_module",
]
}
if (enable_nacl) {
deps += [ "about_nacl:closure_compile" ]
}
if (enable_pdf) {
deps += [ "pdf:closure_compile" ]
}
if (enable_print_preview) {
deps += [ "print_preview:closure_compile" ]
}
if (enable_webui_tab_strip) {
deps += [ "tab_strip:closure_compile" ]
}
if (is_android) {
deps += [
"explore_sites_internals:closure_compile",
"feed_internals:closure_compile",
"internals/lens:closure_compile",
"internals/notifications:closure_compile",
"internals/query_tiles:closure_compile",
"offline_pages:closure_compile",
"video_tutorials:closure_compile",
"webapks: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_linux || is_chromeos) {
deps += [ "certificate_viewer:closure_compile" ]
}
}
}
if (!is_android) {
grit("component_extension_resources") {
source = "component_extension_resources.grd"
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("webid_resources") {
source = "webid/webid_resources.grd"
defines = chrome_grit_defines
outputs = [
"grit/webid_resources.h",
"grit/webid_resources_map.cc",
"grit/webid_resources_map.h",
"webid_resources_100_percent.pak",
]
output_dir = "$root_gen_dir/chrome"
}
if (is_chrome_branded) {
grit("preinstalled_web_apps_resources") {
source = "preinstalled_web_apps/resources.grd"
defines = chrome_grit_defines
outputs = [
"grit/preinstalled_web_apps_resources.h",
"grit/preinstalled_web_apps_resources_map.cc",
"grit/preinstalled_web_apps_resources_map.h",
"preinstalled_web_apps_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
}
}
if (is_chromeos_ash) {
grit("bluetooth_pairing_dialog_resources") {
defines = chrome_grit_defines
# These arguments are needed since the grd is generated at build time.
enable_input_discovery_for_gn_analyze = false
bluetooth_gen_dir = "$root_gen_dir/chrome/browser/resources/chromeos/bluetooth_pairing_dialog"
source = "$bluetooth_gen_dir/bluetooth_pairing_dialog_resources.grd"
deps = [
"//chrome/browser/resources/chromeos/bluetooth_pairing_dialog:build_grd",
]
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"
}
grit("internet_config_dialog_resources") {
defines = chrome_grit_defines
# These arguments are needed since the grd is generated at build time.
enable_input_discovery_for_gn_analyze = false
internet_gen_dir =
"$root_gen_dir/chrome/browser/resources/chromeos/internet_config_dialog"
source = "$internet_gen_dir/internet_config_dialog_resources.grd"
deps = [
"//chrome/browser/resources/chromeos/internet_config_dialog:build_grd",
]
outputs = [
"grit/internet_config_dialog_resources.h",
"grit/internet_config_dialog_resources_map.cc",
"grit/internet_config_dialog_resources_map.h",
"internet_config_dialog_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
grit("internet_detail_dialog_resources") {
defines = chrome_grit_defines
# These arguments are needed since the grd is generated at build time.
enable_input_discovery_for_gn_analyze = false
internet_detail_gen_dir =
"$root_gen_dir/chrome/browser/resources/chromeos/internet_detail_dialog"
source = "$internet_detail_gen_dir/internet_detail_dialog_resources.grd"
deps = [
"//chrome/browser/resources/chromeos/internet_detail_dialog:build_grd",
]
outputs = [
"grit/internet_detail_dialog_resources.h",
"grit/internet_detail_dialog_resources_map.cc",
"grit/internet_detail_dialog_resources_map.h",
"internet_detail_dialog_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
}
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/download_internals_resources.pak",
"$root_gen_dir/chrome/floc_internals_resources.pak",
"$root_gen_dir/chrome/internals_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_sync_internals_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/download_internals:resources",
"//chrome/browser/resources/federated_learning:resources",
"//chrome/browser/resources/internals:resources",
"//chrome/browser/resources/invalidations:resources",
"//chrome/browser/resources/media:webrtc_logs_resources",
"//chrome/browser/resources/net_internals:resources",
"//chrome/browser/resources/omnibox:resources",
"//chrome/browser/resources/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:resources",
"//content/browser/webrtc/resources",
]
if (is_android) {
sources += [ "$root_gen_dir/chrome/webapks_resources.pak" ]
deps += [ "//chrome/browser/resources/webapks: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" ]
}
}