OLD | NEW |
(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 import("//blimp/client/core/config.gni") |
| 6 import("//build/config/locales.gni") |
| 7 import("//tools/grit/grit_rule.gni") |
| 8 import("//tools/grit/repack.gni") |
| 9 |
| 10 if (is_android) { |
| 11 import("//build/config/android/config.gni") |
| 12 import("//build/config/android/rules.gni") |
| 13 } |
| 14 |
| 15 # String resources for the embedder. Build different internal resource sets base
d on |
| 16 # |enable_blimp_client| flag. |
| 17 group("strings") { |
| 18 visibility = [ "//blimp/client/public/resources" ] |
| 19 public_deps = [ |
| 20 ":locales", |
| 21 ] |
| 22 } |
| 23 |
| 24 # Build string locale files based on |enable_blimp_client| flag. |
| 25 # The embedder will take the output files to continue its build chain without kn
owing the |
| 26 # |enable_blimp_client| build flag. |
| 27 repack_locales("locales") { |
| 28 visibility = [ ":strings" ] |
| 29 |
| 30 input_locales = locales_with_fake_bidi |
| 31 output_locales = [] |
| 32 foreach(locale, locales_with_fake_bidi) { |
| 33 output_locales += [ "blimp_strings_$locale" ] |
| 34 } |
| 35 |
| 36 if (enable_blimp_client) { |
| 37 source_patterns = |
| 38 [ "${root_gen_dir}/blimp/client/core/resources/blimp_strings_" ] |
| 39 deps = [ |
| 40 ":string_data", |
| 41 ] |
| 42 } else { |
| 43 source_patterns = |
| 44 [ "${root_gen_dir}/blimp/client/core/resources/dummy/blimp_strings_" ] |
| 45 deps = [ |
| 46 ":dummy_string_data", |
| 47 ] |
| 48 } |
| 49 |
| 50 output_dir = "$root_gen_dir/blimp/client/public/resources" |
| 51 } |
| 52 |
| 53 # Blimp internal resource. Blimp internal build targets may directly depends on
this. |
| 54 # //blimp/client/public shouldn't directly depend on this since we want to |
| 55 # build different things based on |enable_blimp_client| build flag. |
| 56 source_set("resources") { |
| 57 visibility = [ |
| 58 "//blimp/client/app/*", |
| 59 "//blimp/client/core/*", |
| 60 ] |
| 61 |
| 62 sources = [ |
| 63 "blimp_strings.cc", |
| 64 ] |
| 65 |
| 66 public_deps = [ |
| 67 ":string_data", |
| 68 ] |
| 69 |
| 70 deps = [ |
| 71 "//blimp/client/public:public_headers", |
| 72 "//blimp/common/proto", |
| 73 "//ui/base:base", |
| 74 ] |
| 75 } |
| 76 |
| 77 # Dummy Blimp internal resource. It doesn't build any string data, and string he
lper functions |
| 78 # return empty values to the embedder. |
| 79 # Blimp internal targets shouldn't depend on this. |
| 80 source_set("dummy") { |
| 81 visibility = [ "//blimp/client/core/*" ] |
| 82 |
| 83 sources = [ |
| 84 "dummy_blimp_strings.cc", |
| 85 ] |
| 86 |
| 87 public_deps = [ |
| 88 ":dummy_string_data", |
| 89 ] |
| 90 |
| 91 deps = [ |
| 92 "//blimp/client/public:public_headers", |
| 93 ] |
| 94 } |
| 95 |
| 96 if (is_android) { |
| 97 android_blimp_java_resources = [ |
| 98 "java/res/values-am/blimp_strings.xml", |
| 99 "java/res/values-ar/blimp_strings.xml", |
| 100 "java/res/values-bg/blimp_strings.xml", |
| 101 "java/res/values-ca/blimp_strings.xml", |
| 102 "java/res/values-cs/blimp_strings.xml", |
| 103 "java/res/values-da/blimp_strings.xml", |
| 104 "java/res/values-de/blimp_strings.xml", |
| 105 "java/res/values-el/blimp_strings.xml", |
| 106 "java/res/values/blimp_strings.xml", |
| 107 "java/res/values-en-rGB/blimp_strings.xml", |
| 108 "java/res/values-es/blimp_strings.xml", |
| 109 "java/res/values-es-rUS/blimp_strings.xml", |
| 110 "java/res/values-fa/blimp_strings.xml", |
| 111 "java/res/values-fi/blimp_strings.xml", |
| 112 "java/res/values-tl/blimp_strings.xml", |
| 113 "java/res/values-fr/blimp_strings.xml", |
| 114 "java/res/values-hi/blimp_strings.xml", |
| 115 "java/res/values-hr/blimp_strings.xml", |
| 116 "java/res/values-hu/blimp_strings.xml", |
| 117 "java/res/values-in/blimp_strings.xml", |
| 118 "java/res/values-it/blimp_strings.xml", |
| 119 "java/res/values-iw/blimp_strings.xml", |
| 120 "java/res/values-ja/blimp_strings.xml", |
| 121 "java/res/values-ko/blimp_strings.xml", |
| 122 "java/res/values-lt/blimp_strings.xml", |
| 123 "java/res/values-lv/blimp_strings.xml", |
| 124 "java/res/values-nl/blimp_strings.xml", |
| 125 "java/res/values-nb/blimp_strings.xml", |
| 126 "java/res/values-pl/blimp_strings.xml", |
| 127 "java/res/values-pt-rBR/blimp_strings.xml", |
| 128 "java/res/values-pt-rPT/blimp_strings.xml", |
| 129 "java/res/values-ro/blimp_strings.xml", |
| 130 "java/res/values-ru/blimp_strings.xml", |
| 131 "java/res/values-sk/blimp_strings.xml", |
| 132 "java/res/values-sl/blimp_strings.xml", |
| 133 "java/res/values-sr/blimp_strings.xml", |
| 134 "java/res/values-sv/blimp_strings.xml", |
| 135 "java/res/values-sw/blimp_strings.xml", |
| 136 "java/res/values-th/blimp_strings.xml", |
| 137 "java/res/values-tr/blimp_strings.xml", |
| 138 "java/res/values-uk/blimp_strings.xml", |
| 139 "java/res/values-vi/blimp_strings.xml", |
| 140 "java/res/values-zh-rCN/blimp_strings.xml", |
| 141 "java/res/values-zh-rTW/blimp_strings.xml", |
| 142 ] |
| 143 } |
| 144 |
| 145 # String data. |
| 146 grit("string_data") { |
| 147 source = "blimp_strings.grd" |
| 148 use_qualified_include = true |
| 149 outputs = [ |
| 150 "grit/blimp_strings.h", |
| 151 ] |
| 152 |
| 153 foreach(locale, locales_with_fake_bidi) { |
| 154 outputs += [ "blimp_strings_$locale.pak" ] |
| 155 } |
| 156 |
| 157 if (is_android) { |
| 158 outputs += android_blimp_java_resources |
| 159 } |
| 160 } |
| 161 |
| 162 # Dummy string data. |
| 163 grit("dummy_string_data") { |
| 164 source = "dummy_blimp_strings.grd" |
| 165 use_qualified_include = true |
| 166 |
| 167 outputs = [ |
| 168 "grit/dummy_blimp_strings.h", |
| 169 ] |
| 170 |
| 171 foreach(locale, locales_with_fake_bidi) { |
| 172 outputs += [ "dummy/blimp_strings_$locale.pak" ] |
| 173 } |
| 174 } |
| 175 |
| 176 if (is_android) { |
| 177 # Android resources needed to wrap the apk. This includes xml resources files
and string xml |
| 178 # files that are generated from the grd file. |
| 179 android_resources("java_resources") { |
| 180 visibility = [ "//blimp/client/core/*" ] |
| 181 |
| 182 resource_dirs = [ "android/java/res" ] |
| 183 deps = [ |
| 184 ":strings_grd", |
| 185 ] |
| 186 |
| 187 # TODO(xingliu): Consider changing the package name to |org.chromium.blimp|
if we remove the |
| 188 # grd file in //blimp/client/app. |
| 189 custom_package = "org.chromium.blimp.core" |
| 190 } |
| 191 |
| 192 # Generate Java string resources from blimp_strings grd file. Mark formatter_d
ata to |
| 193 # "android_java" for strings needed in the apk. |
| 194 # To access Java strings, use |org.chromium.blimp.core.R|. |
| 195 java_strings_grd_prebuilt("strings_grd") { |
| 196 visibility = [ "//blimp/client/core/*" ] |
| 197 |
| 198 grit_output_dir = "$root_gen_dir/blimp/client/core/resources/java/res" |
| 199 generated_files = |
| 200 rebase_path(android_blimp_java_resources, "../android/java/res", ".") |
| 201 deps = [ |
| 202 ":string_data", |
| 203 ] |
| 204 } |
| 205 } |
OLD | NEW |