| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/locales.gni") | 5 import("//build/config/locales.gni") |
| 6 import("//ui/base/ui_features.gni") | |
| 7 import("chrome_repack_locales.gni") | 6 import("chrome_repack_locales.gni") |
| 8 | 7 |
| 9 # Generates a rule to repack a set of resources, substituting a given string | 8 # Generates a rule to repack a set of resources, substituting a given string |
| 10 # in for the percentage (e.g. "100", "200"). It generates the repacked files in | 9 # in for the percentage (e.g. "100", "200"). It generates the repacked files in |
| 11 # the "gen" directory, and then introduces a copy rule to copy it to the root | 10 # the "gen" directory, and then introduces a copy rule to copy it to the root |
| 12 # build directory. | 11 # build directory. |
| 13 # | 12 # |
| 14 # Argument: | 13 # Argument: |
| 15 # percent [required] | 14 # percent [required] |
| 16 # String to substitute for the percentage. | 15 # String to substitute for the percentage. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 68 } |
| 70 if (enable_app_list) { | 69 if (enable_app_list) { |
| 71 sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_${per
cent}_percent.pak" ] | 70 sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_${per
cent}_percent.pak" ] |
| 72 deps += [ "//ui/app_list/resources" ] | 71 deps += [ "//ui/app_list/resources" ] |
| 73 } | 72 } |
| 74 | 73 |
| 75 output = "${invoker.output_dir}/chrome_${percent}_percent.pak" | 74 output = "${invoker.output_dir}/chrome_${percent}_percent.pak" |
| 76 } | 75 } |
| 77 } | 76 } |
| 78 | 77 |
| 78 # Paramters: |
| 79 # output_dir: |
| 80 # |
| 81 template("chrome_paks") { |
| 82 chrome_repack_percent("${target_name}_100_percent") { |
| 83 percent = "100" |
| 84 forward_variables_from(invoker, |
| 85 [ |
| 86 "copy_data_to_bundle", |
| 87 "deps", |
| 88 "output_dir", |
| 89 "repack_whitelist", |
| 90 "visibility", |
| 91 ]) |
| 92 } |
| 93 |
| 94 if (invoker.enable_hidpi) { |
| 95 chrome_repack_percent("${target_name}_200_percent") { |
| 96 percent = "200" |
| 97 forward_variables_from(invoker, |
| 98 [ |
| 99 "copy_data_to_bundle", |
| 100 "deps", |
| 101 "output_dir", |
| 102 "repack_whitelist", |
| 103 "visibility", |
| 104 ]) |
| 105 } |
| 106 } |
| 107 |
| 108 chrome_repack_locales("${target_name}_locales") { |
| 109 forward_variables_from(invoker, |
| 110 [ |
| 111 "copy_data_to_bundle", |
| 112 "deps", |
| 113 "repack_whitelist", |
| 114 "visibility", |
| 115 ]) |
| 116 |
| 117 input_locales = locales |
| 118 output_dir = "${invoker.output_dir}/locales" |
| 119 |
| 120 if (is_mac) { |
| 121 output_locales = locales_as_mac_outputs |
| 122 } else { |
| 123 output_locales = locales |
| 124 } |
| 125 } |
| 126 |
| 127 group(target_name) { |
| 128 forward_variables_from(invoker, [ "deps" ]) |
| 129 public_deps = [ |
| 130 ":${target_name}_100_percent", |
| 131 ":${target_name}_locales", |
| 132 ] |
| 133 if (invoker.enable_hidpi) { |
| 134 public_deps += [ ":${target_name}_200_percent" ] |
| 135 } |
| 136 if (defined(invoker.public_deps)) { |
| 137 public_deps += invoker.public_deps |
| 138 } |
| 139 } |
| 140 } |
| 141 |
| 79 template("chrome_extra_paks") { | 142 template("chrome_extra_paks") { |
| 80 repack(target_name) { | 143 repack(target_name) { |
| 81 forward_variables_from(invoker, | 144 forward_variables_from(invoker, |
| 82 [ | 145 [ |
| 83 "copy_data_to_bundle", | 146 "copy_data_to_bundle", |
| 84 "repack_whitelist", | 147 "repack_whitelist", |
| 85 "visibility", | 148 "visibility", |
| 86 ]) | 149 ]) |
| 87 output = "${invoker.output_dir}/resources.pak" | 150 output = "${invoker.output_dir}/resources.pak" |
| 88 sources = [ | 151 sources = [ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 113 "//components/resources", | 176 "//components/resources", |
| 114 "//content:resources", | 177 "//content:resources", |
| 115 "//content/browser/tracing:resources", | 178 "//content/browser/tracing:resources", |
| 116 "//net:net_resources", | 179 "//net:net_resources", |
| 117 "//third_party/WebKit/public:resources", | 180 "//third_party/WebKit/public:resources", |
| 118 "//ui/resources", | 181 "//ui/resources", |
| 119 ] | 182 ] |
| 120 if (defined(invoker.deps)) { | 183 if (defined(invoker.deps)) { |
| 121 deps += invoker.deps | 184 deps += invoker.deps |
| 122 } | 185 } |
| 123 if (defined(invoker.additional_paks)) { | |
| 124 sources += invoker.additional_paks | |
| 125 } | |
| 126 | 186 |
| 127 if (!is_android) { | 187 if (is_android) { |
| 188 sources += [ "$root_gen_dir/android_webview/aw_resources.pak" ] |
| 189 deps += [ "//android_webview:generate_aw_resources" ] |
| 190 } else { # Non-Android. |
| 128 # New paks should be added here by default. | 191 # New paks should be added here by default. |
| 129 sources += [ | 192 sources += [ |
| 130 "$root_gen_dir/blink/devtools_resources.pak", | 193 "$root_gen_dir/blink/devtools_resources.pak", |
| 131 "$root_gen_dir/chrome/component_extension_resources.pak", | 194 "$root_gen_dir/chrome/component_extension_resources.pak", |
| 132 "$root_gen_dir/chrome/options_resources.pak", | 195 "$root_gen_dir/chrome/options_resources.pak", |
| 133 "$root_gen_dir/chrome/quota_internals_resources.pak", | 196 "$root_gen_dir/chrome/quota_internals_resources.pak", |
| 134 "$root_gen_dir/chrome/settings_resources.pak", | 197 "$root_gen_dir/chrome/settings_resources.pak", |
| 135 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak", | 198 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak", |
| 136 ] | 199 ] |
| 137 deps += [ | 200 deps += [ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 149 } | 212 } |
| 150 if (enable_extensions) { | 213 if (enable_extensions) { |
| 151 sources += [ | 214 sources += [ |
| 152 "$root_gen_dir/extensions/extensions_renderer_resources.pak", | 215 "$root_gen_dir/extensions/extensions_renderer_resources.pak", |
| 153 "$root_gen_dir/extensions/extensions_resources.pak", | 216 "$root_gen_dir/extensions/extensions_resources.pak", |
| 154 ] | 217 ] |
| 155 deps += [ "//extensions:extensions_resources" ] | 218 deps += [ "//extensions:extensions_resources" ] |
| 156 } | 219 } |
| 157 } | 220 } |
| 158 } | 221 } |
| 159 | |
| 160 # Defines repack() targets used by Chrome. Specifically: | |
| 161 # * chrome_100_percent.pak | |
| 162 # * chrome_200_percent.pak (optionally) | |
| 163 # * resources.pak | |
| 164 # * locale .pak files | |
| 165 # | |
| 166 # Paramters: | |
| 167 # output_dir [required]: Directory to output .pak files. Locale .pak files | |
| 168 # will always be place in $output_dir/locales | |
| 169 # additional_extra_paks: List of extra .pak sources for resources.pak. | |
| 170 # copy_data_to_bundle: | |
| 171 # deps: | |
| 172 # output_dir: | |
| 173 # public_deps: | |
| 174 # repack_whitelist: | |
| 175 # visibility: | |
| 176 # Normal meanings. | |
| 177 # | |
| 178 template("chrome_paks") { | |
| 179 chrome_repack_percent("${target_name}_100_percent") { | |
| 180 percent = "100" | |
| 181 forward_variables_from(invoker, | |
| 182 [ | |
| 183 "copy_data_to_bundle", | |
| 184 "deps", | |
| 185 "output_dir", | |
| 186 "repack_whitelist", | |
| 187 "visibility", | |
| 188 ]) | |
| 189 } | |
| 190 | |
| 191 if (enable_hidpi) { | |
| 192 chrome_repack_percent("${target_name}_200_percent") { | |
| 193 percent = "200" | |
| 194 forward_variables_from(invoker, | |
| 195 [ | |
| 196 "copy_data_to_bundle", | |
| 197 "deps", | |
| 198 "output_dir", | |
| 199 "repack_whitelist", | |
| 200 "visibility", | |
| 201 ]) | |
| 202 } | |
| 203 } | |
| 204 | |
| 205 chrome_extra_paks("${target_name}_extra") { | |
| 206 forward_variables_from(invoker, | |
| 207 [ | |
| 208 "copy_data_to_bundle", | |
| 209 "deps", | |
| 210 "output_dir", | |
| 211 "repack_whitelist", | |
| 212 "visibility", | |
| 213 ]) | |
| 214 if (defined(invoker.additional_extra_paks)) { | |
| 215 additional_paks = invoker.additional_extra_paks | |
| 216 } | |
| 217 } | |
| 218 | |
| 219 chrome_repack_locales("${target_name}_locales") { | |
| 220 forward_variables_from(invoker, | |
| 221 [ | |
| 222 "copy_data_to_bundle", | |
| 223 "deps", | |
| 224 "repack_whitelist", | |
| 225 "visibility", | |
| 226 ]) | |
| 227 | |
| 228 input_locales = locales | |
| 229 output_dir = "${invoker.output_dir}/locales" | |
| 230 | |
| 231 if (is_mac) { | |
| 232 output_locales = locales_as_mac_outputs | |
| 233 } else { | |
| 234 output_locales = locales | |
| 235 } | |
| 236 } | |
| 237 | |
| 238 group(target_name) { | |
| 239 forward_variables_from(invoker, [ "deps" ]) | |
| 240 public_deps = [ | |
| 241 ":${target_name}_100_percent", | |
| 242 ":${target_name}_extra", | |
| 243 ":${target_name}_locales", | |
| 244 ] | |
| 245 if (enable_hidpi) { | |
| 246 public_deps += [ ":${target_name}_200_percent" ] | |
| 247 } | |
| 248 if (defined(invoker.public_deps)) { | |
| 249 public_deps += invoker.public_deps | |
| 250 } | |
| 251 } | |
| 252 } | |
| OLD | NEW |