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

Side by Side Diff: tools/grit/repack.gni

Issue 2334213002: Delete chrome_framework_locales in favour of copy_data_to_bundle=true (Closed)
Patch Set: speculative fix 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 | « chrome/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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("//tools/grit/grit_rule.gni") 5 import("//tools/grit/grit_rule.gni")
6 6
7 # This file defines a template to invoke grit repack in a consistent manner. 7 # This file defines a template to invoke grit repack in a consistent manner.
8 # 8 #
9 # Parameters: 9 # Parameters:
10 # sources [required] 10 # sources [required]
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 # output_dir [optional] 112 # output_dir [optional]
113 # Directory in which to put all pak files. 113 # Directory in which to put all pak files.
114 # 114 #
115 # deps [optional] 115 # deps [optional]
116 # visibility [optional] 116 # visibility [optional]
117 # testonly [optional] 117 # testonly [optional]
118 # copy_data_to_bundle [optional] 118 # copy_data_to_bundle [optional]
119 # repack_whitelist [optional] 119 # repack_whitelist [optional]
120 # Normal meaning. 120 # Normal meaning.
121 template("repack_locales") { 121 template("repack_locales") {
122 if (defined(invoker.output_dir)) {
123 _output_dir = invoker.output_dir
124 } else if (is_ios) {
125 _output_dir = "$target_gen_dir"
126 } else {
127 _output_dir = "$target_gen_dir/$target_name"
128 }
129
122 # GN can't handle invoker.output_locales[foo] (http://crbug.com/614747). 130 # GN can't handle invoker.output_locales[foo] (http://crbug.com/614747).
123 _output_locales = invoker.output_locales 131 _output_locales = invoker.output_locales
124 if (defined(invoker.output_dir)) {
125 _output_dir = invoker.output_dir
126 } else {
127 if (is_ios) {
128 _output_dir = "$target_gen_dir"
129 } else {
130 _output_dir = "$target_gen_dir/$target_name"
131 }
132 }
133 132
134 # Collects all targets the loop generates. 133 # Collects all targets the loop generates.
135 _locale_targets = [] 134 _locale_targets = []
136 135
137 # This loop iterates over the input locales and also keeps a counter so it 136 # This loop iterates over the input locales and also keeps a counter so it
138 # can simultaneously iterate over the output locales (using GN's very 137 # can simultaneously iterate over the output locales (using GN's very
139 # limited looping capabilities). 138 # limited looping capabilities).
140 _current_index = 0 139 _current_index = 0
141 foreach(_input_locale, invoker.input_locales) { 140 foreach(_input_locale, invoker.input_locales) {
142 _output_locale = _output_locales[_current_index] 141 _output_locale = _output_locales[_current_index]
143 142
144 # Compute the name of the target for the current file. Save it for the deps. 143 # Compute the name of the target for the current file. Save it for the deps.
145 _current_name = "${target_name}_${_input_locale}" 144 _current_name = "${target_name}_${_input_locale}"
146 _locale_targets += [ ":$_current_name" ] 145 _locale_targets += [ ":$_current_name" ]
147 146
148 repack(_current_name) { 147 repack(_current_name) {
149 forward_variables_from(invoker, 148 forward_variables_from(invoker,
150 [ 149 [
151 "copy_data_to_bundle", 150 "copy_data_to_bundle",
152 "bundle_output", 151 "bundle_output",
153 "deps", 152 "deps",
154 "repack_whitelist", 153 "repack_whitelist",
155 "testonly", 154 "testonly",
156 ]) 155 ])
157 visibility = [ ":${invoker.target_name}" ] 156 visibility = [ ":${invoker.target_name}" ]
158 if (is_ios) { 157 if (is_ios) {
159 output = "$_output_dir/${_output_locale}.lproj/locale.pak" 158 output = "$_output_dir/${_output_locale}.lproj/locale.pak"
160 if (defined(copy_data_to_bundle) && copy_data_to_bundle) {
161 bundle_output =
162 "{{bundle_resources_dir}}/${_output_locale}.lproj/locale.pak"
163 }
164 } else { 159 } else {
165 output = "$_output_dir/${_output_locale}.pak" 160 output = "$_output_dir/${_output_locale}.pak"
166 } 161 }
162 if (defined(copy_data_to_bundle) && copy_data_to_bundle) {
163 bundle_output =
164 "{{bundle_resources_dir}}/${_output_locale}.lproj/locale.pak"
165 }
167 set_sources_assignment_filter([]) 166 set_sources_assignment_filter([])
168 sources = [] 167 sources = []
169 foreach(_pattern, invoker.source_patterns) { 168 foreach(_pattern, invoker.source_patterns) {
170 sources += [ "${_pattern}${_input_locale}.pak" ] 169 sources += [ "${_pattern}${_input_locale}.pak" ]
171 } 170 }
172 } 171 }
173 172
174 _current_index = _current_index + 1 173 _current_index = _current_index + 1
175 } 174 }
176 175
177 # The group that external targets depend on which collects all deps. 176 # The group that external targets depend on which collects all deps.
178 group(target_name) { 177 group(target_name) {
179 forward_variables_from(invoker, 178 forward_variables_from(invoker,
180 [ 179 [
181 "visibility", 180 "visibility",
182 "testonly", 181 "testonly",
183 ]) 182 ])
184 public_deps = _locale_targets 183 public_deps = _locale_targets
185 } 184 }
186 } 185 }
OLDNEW
« no previous file with comments | « chrome/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698