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

Side by Side Diff: ios/chrome/tools/strings/generate_localizable_strings.gni

Issue 2001613002: [iOS/GN] Add template for generate_localizable_strings tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@{interlude}
Patch Set: Created 4 years, 7 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
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 # Help template to define a data_bundle with localized strings for use by
6 # the iOS system from packed locale.pak files.
7 #
8 # Arguments
9 # config_file
10 # string, path to the property list file containing the configuration
11 # parameters for the invocation of generate_localizable_strings tool.
12 #
13 # datapack_dir
14 # string, path to the directory containing the packed locale.pak files
15 # in use for the generate_localizable_strings tool.
16 #
17 # locales
18 # list of strings corresponding to all the locales that should be
19 # generated and packed.
20 #
21 # output_filenames
22 # list of strings corresponding to the basename of the files generated
23 # by the generate_localizable_strings tool (i.e. if it contains ["a"]
24 # then the tool will generate ["$locale.lproj/a"] for each locale set
25 # in locales argument).
26 #
27 # deps
28 # list of target labels.
29 #
30 template("generate_localizable_strings") {
31 assert(defined(invoker.config_file),
32 "config_file needs to be defined for ${target_name}")
33 assert(defined(invoker.datapack_dir),
34 "datapack_dir needs to be defined for ${target_name}")
35 assert(defined(invoker.output_filenames),
36 "output_filenames needs to be defined for ${target_name}")
37 assert(defined(invoker.packed_locales),
38 "packed_locales needs to be defined for ${target_name}")
39
40 _tool_target = "//ios/chrome/tools/strings" +
41 ":generate_localizable_strings(${host_toolchain})"
42 _tool_path = get_label_info(_tool_target, "root_out_dir") +
43 "/generate_localizable_strings"
44
45 _target_name = target_name
46
47 _bundle_targets = []
48 foreach(locale, invoker.packed_locales) {
49 _bundle_targets += [ ":${_target_name}_${locale}" ]
50
51 bundle_data("${_target_name}_${locale}") {
52 forward_variables_from(invoker, [ "testonly" ])
53
54 visibility = [ ":${_target_name}" ]
55 public_deps = [
56 ":${_target_name}_generate",
57 ]
58 sources = []
59 foreach(filename, invoker.output_filenames) {
60 sources += [ "${target_gen_dir}/${locale}.lproj/$filename" ]
61 }
62 outputs = [
63 "{{bundle_resources_dir}}/${locale}.lproj/{{source_file_part}}",
64 ]
65 }
66 }
67
68 action("${_target_name}_generate") {
69 forward_variables_from(invoker, [ "testonly" ])
70
71 visibility = _bundle_targets
72 script = "//ios/chrome/tools/strings/generate_localizable_strings.py"
73 deps = invoker.deps + [ _tool_target ]
74
75 outputs = []
76 sources = [
77 invoker.config_file,
78 ]
79
80 foreach(locale, invoker.packed_locales) {
81 sources += [ "${invoker.datapack_dir}/${locale}.lproj/locale.pak" ]
82 foreach(filename, invoker.output_filenames) {
83 outputs += [ "${target_gen_dir}/${locale}.lproj/$filename" ]
84 }
85 }
86
87 args = rebase_path([
88 _tool_path,
89 invoker.config_file,
90 root_gen_dir,
91 invoker.datapack_dir,
92 target_gen_dir,
93 ],
94 root_out_dir) + invoker.packed_locales
95 }
96
97 group(_target_name) {
98 forward_variables_from(invoker,
99 [
100 "testonly",
101 "visibility",
102 ])
103 deps = _bundle_targets
104 }
105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698