Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Side by Side Diff: ios/chrome/app/resources/ios_chrome_repack.gni

Issue 2340673002: Revert of 🍵 Refactor the various locale_paks() templates to be more shared (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/app/resources/BUILD.gn ('k') | ios/chrome/extension_repack.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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("//tools/grit/repack.gni") 5 import("//tools/grit/repack.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 7
8 # Wraps repack_locales(), setting the source_patterns and deps required for 8 # Template to repack resources and copy them to the application bundles.
9 # Chrome. 9 #
10 # Generates a collection of bundle_data targets. 10 # Arguments
11 template("ios_chrome_repack_locales") { 11 #
12 repack_locales(target_name) { 12 # deps
13 forward_variables_from(invoker, "*") 13 # list of strings corresponding to target labels.
14 source_patterns = [ 14 #
15 "${root_gen_dir}/components/strings/components_${branding_path_component}_ strings_", 15 # sources
16 "${root_gen_dir}/components/strings/components_locale_settings_", 16 # list of strings corresponding to path to resources pak to pack.
17 "${root_gen_dir}/components/strings/components_strings_", 17 #
18 "${root_gen_dir}/ios/chrome/ios_${branding_path_component}_strings_", 18 # output
19 "${root_gen_dir}/ios/chrome/ios_strings_", 19 # string, path of the packed resources.
20 "${root_gen_dir}/ui/strings/app_locale_settings_", 20 #
21 "${root_gen_dir}/ui/strings/ui_strings_", 21 # bundle_output
22 # string, path of the packed resources in the bundle.
23 #
24 # Generates a bundle_data target for convenience.
25 template("ios_repack") {
26 assert(defined(invoker.deps), "deps must be defined for $target_name")
27 assert(defined(invoker.sources), "sources must be defined for $target_name")
28 assert(defined(invoker.output), "output must be defined for $target_name")
29 assert(defined(invoker.bundle_output),
30 "bundle_output must be defined for $target_name")
31
32 _target_name = target_name
33
34 repack("${_target_name}_pack") {
35 forward_variables_from(invoker, [ "testonly" ])
36
37 visibility = [ ":${_target_name}" ]
38 sources = invoker.sources
39 output = invoker.output
40 deps = invoker.deps
41 }
42
43 bundle_data(_target_name) {
44 forward_variables_from(invoker,
45 [
46 "testonly",
47 "visibility",
48 ])
49 public_deps = [
50 ":${_target_name}_pack",
51 ]
52 sources = [
53 invoker.output,
54 ]
55 outputs = [
56 invoker.bundle_output,
57 ]
58 }
59 }
60
61 # Template to repack all resources for a given locale.
62 #
63 # Arguments
64 #
65 # input_locale
66 # string, name of the locale to pack.
67 #
68 # output_locale
69 # string, name of the locale (may be different from input_locale
70 # as iOS and Chrome not use the same convention for naming locales
71 # with country variant).
72 #
73 # Generates a bundle_data target for convenience.
74 template("_ios_chrome_repack_one_locale") {
75 assert(defined(invoker.input_locale),
76 "input_locale must be defined for ${target_name}")
77 assert(defined(invoker.output_locale),
78 "output_locale must be defined for ${target_name}")
79
80 ios_repack(target_name) {
81 forward_variables_from(invoker,
82 [
83 "testonly",
84 "visibility",
85 ])
86
87 sources = [
88 "${root_gen_dir}/components/strings/components_${branding_path_component}_ strings_${invoker.input_locale}.pak",
89 "${root_gen_dir}/components/strings/components_locale_settings_${invoker.i nput_locale}.pak",
90 "${root_gen_dir}/components/strings/components_strings_${invoker.input_loc ale}.pak",
91 "${root_gen_dir}/ios/chrome/ios_${branding_path_component}_strings_${invok er.input_locale}.pak",
92 "${root_gen_dir}/ios/chrome/ios_strings_${invoker.input_locale}.pak",
93 "${root_gen_dir}/ui/strings/app_locale_settings_${invoker.input_locale}.pa k",
94 "${root_gen_dir}/ui/strings/ui_strings_${invoker.input_locale}.pak",
22 ] 95 ]
23 96
24 deps = [ 97 deps = [
25 "//components/strings:components_${branding_path_component}_strings", 98 "//components/strings:components_${branding_path_component}_strings",
26 "//components/strings:components_locale_settings", 99 "//components/strings:components_locale_settings",
27 "//components/strings:components_strings", 100 "//components/strings:components_strings",
28 "//ios/chrome/app/strings:ios_${branding_path_component}_strings", 101 "//ios/chrome/app/strings:ios_${branding_path_component}_strings",
29 "//ios/chrome/app/strings:ios_strings", 102 "//ios/chrome/app/strings:ios_strings",
30 "//ui/strings:app_locale_settings", 103 "//ui/strings:app_locale_settings",
31 "//ui/strings:ui_strings", 104 "//ui/strings:ui_strings",
32 ] 105 ]
33 106
34 copy_data_to_bundle = true 107 output = "${target_gen_dir}/${invoker.output_locale}.lproj/locale.pak"
108 bundle_output = "{{bundle_resources_dir}}/${invoker.output_locale}.lproj" +
109 "/{{source_file_part}}"
35 } 110 }
36 } 111 }
37 112
113 # Template to repack all resources for all locales.
114 #
115 # Arguments
116 #
117 # input_locales
118 # list of strings corresponding to all locales to pack.
119 #
120 # output_locales
121 # list of strings corresponding to all locales to pack (may be
122 # different from input_locales as iOS and Chrome do not use the
123 # same convention for naming locales with country variant).
124 #
125 # Must be the same length as input_locales.
126 #
127 # Generates a collection of bundle_data targets for convenience.
128 template("ios_chrome_repack_locales") {
129 assert(defined(invoker.input_locales),
130 "input_locales must be defined for ${target_name}")
131 assert(defined(invoker.output_locales),
132 "output_locales must be defined for ${target_name}")
133
134 _target_name = target_name
135
136 _locale_targets = []
137 _output_locales = invoker.output_locales
138
139 _current_index = 0
140 foreach(_input_locale, invoker.input_locales) {
141 _output_locale = _output_locales[_current_index]
142 _locale_targets += [ ":${_target_name}_${_input_locale}" ]
143
144 _ios_chrome_repack_one_locale("${_target_name}_${_input_locale}") {
145 forward_variables_from(invoker, [ "testonly" ])
146 visibility = [ ":${_target_name}" ]
147 input_locale = _input_locale
148 output_locale = _output_locale
149 }
150
151 _current_index = _current_index + 1
152 }
153
154 group(_target_name) {
155 forward_variables_from(invoker,
156 [
157 "testonly",
158 "visibility",
159 ])
160 public_deps = _locale_targets
161 }
162 }
163
38 # Template to repack all scalable resources at a given scale. 164 # Template to repack all scalable resources at a given scale.
39 # 165 #
40 # Arguments 166 # Arguments
41 # 167 #
42 # scale 168 # scale
43 # string, scale as a percentage, e.g. "200" corresponds to @2x scale. 169 # string, scale as a percentage, e.g. "200" corresponds to @2x scale.
44 # 170 #
45 # Generates a bundle_data target for convenience. 171 # Generates a bundle_data target for convenience.
46 template("_ios_chrome_repack_one_scale") { 172 template("_ios_chrome_repack_one_scale") {
47 assert(defined(invoker.scale), "scale must be defined for ${target_name}") 173 assert(defined(invoker.scale), "scale must be defined for ${target_name}")
48 174
49 repack(target_name) { 175 ios_repack(target_name) {
50 forward_variables_from(invoker, 176 forward_variables_from(invoker,
51 [ 177 [
52 "testonly", 178 "testonly",
53 "visibility", 179 "visibility",
54 ]) 180 ])
55 181
56 sources = [ 182 sources = [
57 "${root_gen_dir}/components/components_resources_${invoker.scale}_percent. pak", 183 "${root_gen_dir}/components/components_resources_${invoker.scale}_percent. pak",
58 "${root_gen_dir}/ios/chrome/ios_theme_resources_${invoker.scale}_percent.p ak", 184 "${root_gen_dir}/ios/chrome/ios_theme_resources_${invoker.scale}_percent.p ak",
59 "${root_gen_dir}/ui/resources/ui_resources_${invoker.scale}_percent.pak", 185 "${root_gen_dir}/ui/resources/ui_resources_${invoker.scale}_percent.pak",
60 ] 186 ]
61 deps = [ 187 deps = [
62 "//components/resources", 188 "//components/resources",
63 "//ios/chrome/app/theme", 189 "//ios/chrome/app/theme",
64 "//ui/resources", 190 "//ui/resources",
65 ] 191 ]
66 192
67 output = "$target_gen_dir/chrome_${invoker.scale}_percent.pak" 193 output = "$target_gen_dir/chrome_${invoker.scale}_percent.pak"
68 copy_data_to_bundle = true 194 bundle_output = "{{bundle_resources_dir}}/{{source_file_part}}"
69 } 195 }
70 } 196 }
71 197
72 # Template to repack all scalable resources at all scales. 198 # Template to repack all scalable resources at all scales.
73 # 199 #
74 # Arguments 200 # Arguments
75 # 201 #
76 # scales 202 # scales
77 # list of strings corresponding to scales as percentage, e.g. "200" 203 # list of strings corresponding to scales as percentage, e.g. "200"
78 # corresponds to @2x scale. 204 # corresponds to @2x scale.
(...skipping 16 matching lines...) Expand all
95 221
96 group(_target_name) { 222 group(_target_name) {
97 forward_variables_from(invoker, 223 forward_variables_from(invoker,
98 [ 224 [
99 "testonly", 225 "testonly",
100 "visibility", 226 "visibility",
101 ]) 227 ])
102 public_deps = _scale_targets 228 public_deps = _scale_targets
103 } 229 }
104 } 230 }
OLDNEW
« no previous file with comments | « ios/chrome/app/resources/BUILD.gn ('k') | ios/chrome/extension_repack.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698