Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/chrome_build.gni") | 5 import("//build/config/chrome_build.gni") |
| 6 import("//build/config/features.gni") | 6 import("//build/config/features.gni") |
| 7 import("//build/config/ui.gni") | 7 import("//build/config/ui.gni") |
| 8 import("//tools/grit/repack.gni") | 8 import("//tools/grit/repack.gni") |
| 9 | 9 |
| 10 # Arguments: | 10 # Arguments: |
| 11 # | 11 # |
| 12 # locale | 12 # locale |
| 13 # Internal name of locale. e.g. "pt-BR" | 13 # Internal name of locale. e.g. "pt-BR" |
| 14 # | 14 # |
| 15 # output | 15 # output |
| 16 # Output file name. | 16 # Output file name. |
| 17 # | 17 # |
| 18 # visibility | 18 # visibility |
| 19 # Normal meaning. | 19 # Normal meaning. |
| 20 # | |
| 21 # additional_source_patterns | |
| 22 # The pattern of additional pak files which need repacked, the name of | |
| 23 # pak always ends with '_${locale}.pak' e.g. foo_zh-CN.pak, since the | |
| 24 # locale is argument of template, the sources in this list should be | |
| 25 # the file name without '_${locale}.pak', tempate expands sources to | |
| 26 # the full name, e.g | |
| 27 # ${root_gen_dir}/foo expands to ${root_gen_dir}/foo_zh-CN.pak | |
| 28 # when locale is zh-CN. | |
| 29 # | |
| 30 # additional_deps | |
| 31 # The corresponding deps of additonal_source_patterns. | |
| 32 # | |
| 20 template("_repack_one_locale") { | 33 template("_repack_one_locale") { |
| 21 locale = invoker.locale | 34 locale = invoker.locale |
| 22 | 35 |
| 23 repack(target_name) { | 36 repack(target_name) { |
| 24 visibility = invoker.visibility | 37 visibility = invoker.visibility |
| 25 | 38 |
| 26 # Each input pak file should also have a deps line for completeness. | 39 # Each input pak file should also have a deps line for completeness. |
| 27 sources = [ | 40 sources = [ |
| 28 "${root_gen_dir}/chrome/generated_resources_${locale}.pak", | 41 "${root_gen_dir}/chrome/generated_resources_${locale}.pak", |
| 29 "${root_gen_dir}/chrome/locale_settings_${locale}.pak", | 42 "${root_gen_dir}/chrome/locale_settings_${locale}.pak", |
| 30 "${root_gen_dir}/chrome/platform_locale_settings_${locale}.pak", | 43 "${root_gen_dir}/chrome/platform_locale_settings_${locale}.pak", |
| 31 "${root_gen_dir}/components/strings/components_locale_settings_${locale}.p ak", | 44 "${root_gen_dir}/components/strings/components_locale_settings_${locale}.p ak", |
| 32 "${root_gen_dir}/components/strings/components_strings_${locale}.pak", | 45 "${root_gen_dir}/components/strings/components_strings_${locale}.pak", |
| 33 ] | 46 ] |
| 34 deps = [ | 47 deps = [ |
| 35 "//chrome/app:generated_resources", | 48 "//chrome/app:generated_resources", |
| 36 "//chrome/app/resources:locale_settings", | 49 "//chrome/app/resources:locale_settings", |
| 37 "//chrome/app/resources:platform_locale_settings", | 50 "//chrome/app/resources:platform_locale_settings", |
| 38 "//components/strings:components_locale_settings", | 51 "//components/strings:components_locale_settings", |
| 39 "//components/strings:components_strings", | 52 "//components/strings:components_strings", |
| 40 ] | 53 ] |
| 41 | 54 |
| 42 # The settings strings are not being treated as strings because they are | 55 # The settings strings are not being treated as strings because they are |
| 43 # not translated (English only), this should change in late 2015. | 56 # not translated (English only), this should change in late 2015. |
| 44 sources += [ "${root_gen_dir}/chrome/settings_strings.pak" ] | 57 sources += [ "${root_gen_dir}/chrome/settings_strings.pak" ] |
| 45 deps += [ "//chrome/app:settings_strings" ] | 58 deps += [ "//chrome/app:settings_strings" ] |
| 46 | 59 |
| 60 if (defined(invoker.additional_source_patterns)) { | |
| 61 sources += process_file_template(invoker.additional_source_patterns, | |
| 62 [ "{{source}}_${locale}.pak" ]) | |
| 63 deps += invoker.additional_deps | |
| 64 } | |
| 65 | |
| 47 if (use_ash) { | 66 if (use_ash) { |
| 48 sources += [ "${root_gen_dir}/ash/strings/ash_strings_${locale}.pak" ] | 67 sources += [ "${root_gen_dir}/ash/strings/ash_strings_${locale}.pak" ] |
| 49 deps += [ "//ash/strings" ] | 68 deps += [ "//ash/strings" ] |
| 50 } | 69 } |
| 51 if (is_chromeos) { | 70 if (is_chromeos) { |
| 52 sources += [ | 71 sources += [ |
| 53 "${root_gen_dir}/remoting/resources/${locale}.pak", | 72 "${root_gen_dir}/remoting/resources/${locale}.pak", |
| 54 "${root_gen_dir}/ui/chromeos/strings/ui_chromeos_strings_${locale}.pak", | 73 "${root_gen_dir}/ui/chromeos/strings/ui_chromeos_strings_${locale}.pak", |
| 55 ] | 74 ] |
| 56 deps += [ | 75 deps += [ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 # Arguments | 144 # Arguments |
| 126 # | 145 # |
| 127 # input_locales | 146 # input_locales |
| 128 # List of locale names to use as inputs. | 147 # List of locale names to use as inputs. |
| 129 # | 148 # |
| 130 # output_locales | 149 # output_locales |
| 131 # A list containing the corresponding output names for each of the | 150 # A list containing the corresponding output names for each of the |
| 132 # input names. Mac uses different names in some cases. | 151 # input names. Mac uses different names in some cases. |
| 133 # | 152 # |
| 134 # visibility | 153 # visibility |
| 154 # | |
| 155 # additional_source_patterns | |
| 156 # Pass to template("_repack_one_locale") | |
| 157 # | |
| 158 # additional_deps | |
| 159 # Pass to template("_repack_one_locale") | |
| 160 # | |
| 161 # output_dir | |
| 162 # this is used to override default output dir. | |
| 163 # | |
| 135 template("chrome_repack_locales") { | 164 template("chrome_repack_locales") { |
| 136 # This is the name of the group below that will collect all the invidual | 165 # This is the name of the group below that will collect all the invidual |
| 137 # locale targets. External targets will depend on this. | 166 # locale targets. External targets will depend on this. |
| 138 group_target_name = target_name | 167 group_target_name = target_name |
| 139 | 168 |
| 140 # GN's subscript is too stupid to do invoker.output_locales[foo] so we need | 169 # GN's subscript is too stupid to do invoker.output_locales[foo] so we need |
| 141 # to make a copy and do output_locales[foo]. | 170 # to make a copy and do output_locales[foo]. |
| 142 output_locales = invoker.output_locales | 171 output_locales = invoker.output_locales |
| 143 | 172 |
| 144 # Collects all targets the loop generates. | 173 # Collects all targets the loop generates. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 158 _repack_one_locale(current_name) { | 187 _repack_one_locale(current_name) { |
| 159 visibility = [ ":$group_target_name" ] | 188 visibility = [ ":$group_target_name" ] |
| 160 locale = input_locale | 189 locale = input_locale |
| 161 | 190 |
| 162 # Compute the output name. Mac uses a different location. | 191 # Compute the output name. Mac uses a different location. |
| 163 if (is_mac || is_ios) { | 192 if (is_mac || is_ios) { |
| 164 output = "${root_gen_dir}/repack/locales/${output_locale}.pak" | 193 output = "${root_gen_dir}/repack/locales/${output_locale}.pak" |
| 165 } else { | 194 } else { |
| 166 output = "${root_out_dir}/locales/${output_locale}.pak" | 195 output = "${root_out_dir}/locales/${output_locale}.pak" |
| 167 } | 196 } |
| 197 | |
| 198 if (defined(invoker.output_dir)) { | |
|
agrieve
2016/07/06 19:49:17
nit: this should be made a part of the above if cl
michaelbai
2016/07/06 20:05:17
Done.
| |
| 199 output = "${invoker.output_dir}/${output_locale}.pak" | |
| 200 } | |
| 201 | |
| 202 if (defined(invoker.additional_source_patterns)) { | |
| 203 additional_source_patterns = invoker.additional_source_patterns | |
| 204 additional_deps = invoker.additional_deps | |
| 205 } | |
| 168 } | 206 } |
| 169 | 207 |
| 170 current_index = current_index + 1 | 208 current_index = current_index + 1 |
| 171 } | 209 } |
| 172 | 210 |
| 173 # The group that external targets depend on which collects all deps. | 211 # The group that external targets depend on which collects all deps. |
| 174 group(group_target_name) { | 212 group(group_target_name) { |
| 175 forward_variables_from(invoker, [ "visibility" ]) | 213 forward_variables_from(invoker, [ "visibility" ]) |
| 176 public_deps = locale_targets | 214 public_deps = locale_targets |
| 177 } | 215 } |
| 178 } | 216 } |
| OLD | NEW |