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.
4
5import("//tools/grit/grit_rule.gni")
6import("//tools/grit/repack.gni")
7
8# GYP version: ui/resources/ui_resources.gyp:ui_resources
9group("resources") {
10  deps = [
11    ":ui_resources_grd",
12    ":ui_unscaled_resources_grd",
13    ":webui_resources_grd",
14  ]
15}
16
17grit("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  ]
26}
27
28grit("ui_unscaled_resources_grd") {
29  source = "ui_unscaled_resources.grd"
30  use_qualified_include = true
31  outputs = [
32    "grit/ui_unscaled_resources.h",
33    "ui_unscaled_resources.rc",
34  ]
35}
36
37grit("webui_resources_grd") {
38  source = "../webui/resources/webui_resources.grd"
39  outputs = [
40    "grit/webui_resources.h",
41    "grit/webui_resources_map.cc",
42    "grit/webui_resources_map.h",
43    "webui_resources.pak",
44  ]
45}
46
47if (!is_mac) {
48  copy("copy_ui_resources_100_percent") {
49    sources = [ "$root_gen_dir/ui/resources/ui_resources_100_percent.pak" ]
50    outputs = [ "$root_out_dir/ui_resources_100_percent.pak" ]
51    deps = [ "//ui/resources" ]
52  }
53}
54
55# On iOS and Mac the string resources need to go into a locale subfolder, which
56# introduces an extra dependency.
57#
58# GYP version: ui/resources/ui_resources.gyp:ui_test_pak
59#              (copy_ui_test_pak action)
60if (is_ios || is_mac) {
61  group("ui_test_pak") {
62    deps = [ ":repack_ui_test_pak", ":repack_ui_test_mac_locale_pack" ]
63  }
64} else {
65  group("ui_test_pak") {
66    deps = [ ":repack_ui_test_pak" ]
67  }
68}
69
70# GYP version: ui/resources/ui_resources.gyp:ui_test_pak
71repack("repack_ui_test_pak") {
72  # Depend on ui_test_pak instead of this one.
73  visibility = [ ":ui_test_pak" ]
74
75  sources = [
76    "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
77    "$root_gen_dir/ui/resources/webui_resources.pak",
78    "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
79    "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
80  ]
81
82  output = "$root_out_dir/ui_test.pak"
83
84  deps = [
85    "//ui/resources",
86    "//ui/strings",
87  ]
88
89  if (!is_mac) {
90    deps += [ ":copy_ui_resources_100_percent" ]
91  }
92}
93
94# Repack just the strings for the framework locales on Mac and iOS. This
95# emulates repack_locales.py, but just for en-US. Note ui_test.pak is not simply
96# copied, because it causes leaks from allocations within system libraries when
97# trying to load non-string resources. http://crbug.com/413034.
98repack("repack_ui_test_mac_locale_pack") {
99  visibility = [ ":ui_test_pak" ]
100
101  sources = [
102    "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
103    "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
104  ]
105
106  output = "$root_out_dir/ui/en.lproj/locale.pak"
107
108  deps = [
109    "//ui/strings",
110  ]
111}
112