Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / resources / BUILD.gn
blob48a23aeef2945b3eed86fdb2963d78fa9673308c
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("//tools/grit/grit_rule.gni")
6 import("//tools/grit/repack.gni")
8 # GYP version: ui/resources/ui_resources.gyp:ui_resources
9 group("resources") {
10   public_deps = [
11     ":ui_resources_grd",
12     ":ui_unscaled_resources_grd",
13     ":webui_resources_grd",
14   ]
17 grit("ui_resources_grd") {
18   source = "ui_resources.grd"
19   outputs = [
20     "grit/ui_resources.h",
21     "grit/ui_resources_map.cc",
22     "grit/ui_resources_map.h",
23     "ui_resources_100_percent.pak",
24     "ui_resources_200_percent.pak",
25     "ui_resources_300_percent.pak",
26   ]
29 grit("ui_unscaled_resources_grd") {
30   source = "ui_unscaled_resources.grd"
31   use_qualified_include = true
32   outputs = [
33     "grit/ui_unscaled_resources.h",
34     "ui_unscaled_resources.rc",
35   ]
38 grit("webui_resources_grd") {
39   source = "../webui/resources/webui_resources.grd"
40   outputs = [
41     "grit/webui_resources.h",
42     "grit/webui_resources_map.cc",
43     "grit/webui_resources_map.h",
44     "webui_resources.pak",
45   ]
48 if (!is_mac) {
49   copy("copy_ui_resources_100_percent") {
50     sources = [
51       "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
52     ]
53     outputs = [
54       "$root_out_dir/ui_resources_100_percent.pak",
55     ]
56     deps = [
57       "//ui/resources",
58     ]
59   }
62 # On iOS and Mac the string resources need to go into a locale subfolder, which
63 # introduces an extra dependency.
65 # GYP version: ui/resources/ui_resources.gyp:ui_test_pak
66 #              (copy_ui_test_pak action)
67 if (is_ios || is_mac) {
68   group("ui_test_pak") {
69     public_deps = [
70       ":repack_ui_test_pak",
71       ":repack_ui_test_mac_locale_pack",
72     ]
73   }
74 } else {
75   copy("ui_test_pak") {
76     sources = [
77       "$root_out_dir/ui_test.pak",
78     ]
79     outputs = [
80       "$root_out_dir/ui/en-US.pak",
81     ]
82     public_deps = [
83       ":repack_ui_test_pak",
84     ]
85   }
88 # This group exists just for targets that need the data file
89 # to exist in the build directory so it can be loaded for test purposes.
90 group("ui_test_pak_data") {
91   data_deps = [ ":repack_ui_test_pak" ]
94 # GYP version: ui/resources/ui_resources.gyp:ui_test_pak
95 repack("repack_ui_test_pak") {
96   # Depend on ui_test_pak or ui_test_pak_data instead of this one.
97   visibility = [
98     ":ui_test_pak",
99     ":ui_test_pak_data",
100   ]
102   sources = [
103     "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
104     "$root_gen_dir/ui/resources/webui_resources.pak",
105     "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
106     "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
107   ]
109   if (is_chromeos) {
110     sources += [
111       "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_100_percent.pak",
112       "$root_gen_dir/ui/chromeos/strings/ui_chromeos_strings_en-US.pak",
113     ]
114   }
116   output = "$root_out_dir/ui_test.pak"
118   deps = [
119     "//ui/resources",
120     "//ui/strings",
121   ]
123   if (!is_ios) {
124     deps += [ "//third_party/WebKit/public:resources_grit" ]
125   }
127   if (!is_mac) {
128     deps += [ ":copy_ui_resources_100_percent" ]
129   }
131   if (is_chromeos) {
132     deps += [
133       "//ui/chromeos/resources",
134       "//ui/chromeos/strings",
135     ]
136   }
138   if (toolkit_views) {
139     deps += [ "//ui/views/resources" ]
140     sources += [
141       "$root_gen_dir/blink/public/resources/blink_resources.pak",
142       "$root_gen_dir/ui/views/resources/views_resources_100_percent.pak",
143     ]
144   }
146   if (enable_app_list) {
147     deps += [ "//ui/app_list/resources" ]
148     sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_100_percent.pak" ]
149   }
152 # Repack just the strings for the framework locales on Mac and iOS. This
153 # emulates repack_locales.py, but just for en-US. Note ui_test.pak is not simply
154 # copied, because it causes leaks from allocations within system libraries when
155 # trying to load non-string resources. http://crbug.com/413034.
156 repack("repack_ui_test_mac_locale_pack") {
157   visibility = [
158     ":ui_test_pak",
159     "//:gn_visibility",  # TODO(GYP): this shouldn't be necessary.
160   ]
162   sources = [
163     "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
164     "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
165   ]
167   output = "$root_out_dir/ui/en.lproj/locale.pak"
169   deps = [
170     "//ui/strings",
171   ]