| 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 # Instantiate grit. This will produce a script target to run grit, and a | 5 # Instantiate grit. This will produce a script target to run grit, and a |
| 6 # static library that compiles the .cc files. | 6 # static library that compiles the .cc files. |
| 7 # | 7 # |
| 8 # Parameters | 8 # Parameters |
| 9 # | 9 # |
| 10 # source (required) | 10 # source (required) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 ] | 100 ] |
| 101 } else { | 101 } else { |
| 102 grit_defines += [ | 102 grit_defines += [ |
| 103 "-D", | 103 "-D", |
| 104 "_chromium", | 104 "_chromium", |
| 105 "-E", | 105 "-E", |
| 106 "CHROMIUM_BUILD=chromium", | 106 "CHROMIUM_BUILD=chromium", |
| 107 ] | 107 ] |
| 108 } | 108 } |
| 109 | 109 |
| 110 if (is_chromeos) { | |
| 111 grit_defines += [ | |
| 112 "-D", | |
| 113 "chromeos", | |
| 114 "-D", | |
| 115 "scale_factors=2x", | |
| 116 ] | |
| 117 } | |
| 118 | |
| 119 if (is_desktop_linux) { | 110 if (is_desktop_linux) { |
| 120 grit_defines += [ | 111 grit_defines += [ |
| 121 "-D", | 112 "-D", |
| 122 "desktop_linux", | 113 "desktop_linux", |
| 123 ] | 114 ] |
| 124 } | 115 } |
| 125 | 116 |
| 126 if (toolkit_views) { | |
| 127 grit_defines += [ | |
| 128 "-D", | |
| 129 "toolkit_views", | |
| 130 ] | |
| 131 } | |
| 132 | |
| 133 if (use_aura) { | |
| 134 grit_defines += [ | |
| 135 "-D", | |
| 136 "use_aura", | |
| 137 ] | |
| 138 } | |
| 139 | |
| 140 if (use_ash) { | |
| 141 grit_defines += [ | |
| 142 "-D", | |
| 143 "use_ash", | |
| 144 ] | |
| 145 } | |
| 146 | |
| 147 if (use_nss_certs) { | 117 if (use_nss_certs) { |
| 148 grit_defines += [ | 118 grit_defines += [ |
| 149 "-D", | 119 "-D", |
| 150 "use_nss_certs", | 120 "use_nss_certs", |
| 151 ] | 121 ] |
| 152 } | 122 } |
| 153 | 123 |
| 154 if (use_ozone) { | 124 if (use_ozone) { |
| 155 grit_defines += [ | 125 grit_defines += [ |
| 156 "-D", | 126 "-D", |
| 157 "use_ozone", | 127 "use_ozone", |
| 158 ] | 128 ] |
| 159 } | 129 } |
| 160 | 130 |
| 161 if (enable_image_loader_extension) { | |
| 162 grit_defines += [ | |
| 163 "-D", | |
| 164 "image_loader_extension", | |
| 165 ] | |
| 166 } | |
| 167 | |
| 168 if (enable_remoting) { | |
| 169 grit_defines += [ | |
| 170 "-D", | |
| 171 "remoting", | |
| 172 ] | |
| 173 } | |
| 174 | |
| 175 if (is_android) { | 131 if (is_android) { |
| 176 grit_defines += [ | 132 grit_defines += [ |
| 177 "-t", | 133 "-t", |
| 178 "android", | 134 "android", |
| 179 "-E", | 135 "-E", |
| 180 "ANDROID_JAVA_TAGGED_ONLY=true", | 136 "ANDROID_JAVA_TAGGED_ONLY=true", |
| 181 ] | 137 ] |
| 182 } | 138 } |
| 183 | 139 |
| 184 if (is_mac || is_ios) { | 140 if (is_mac || is_ios) { |
| 185 grit_defines += [ | 141 grit_defines += [ |
| 186 "-D", | 142 "-D", |
| 187 "scale_factors=2x", | 143 "scale_factors=2x", |
| 188 ] | 144 ] |
| 189 } | 145 } |
| 190 | 146 |
| 191 if (is_ios) { | 147 if (is_ios) { |
| 192 grit_defines += [ | 148 grit_defines += [ |
| 193 "-t", | 149 "-t", |
| 194 "ios", | 150 "ios", |
| 195 | 151 |
| 196 # iOS uses a whitelist to filter resources. | 152 # iOS uses a whitelist to filter resources. |
| 197 "-w", | 153 "-w", |
| 198 rebase_path("//build/ios/grit_whitelist.txt", root_build_dir), | 154 rebase_path("//build/ios/grit_whitelist.txt", root_build_dir), |
| 199 ] | 155 ] |
| 200 } | 156 } |
| 201 | 157 |
| 202 if (enable_extensions) { | |
| 203 grit_defines += [ | |
| 204 "-D", | |
| 205 "enable_extensions", | |
| 206 ] | |
| 207 } | |
| 208 if (enable_media_router) { | |
| 209 grit_defines += [ | |
| 210 "-D", | |
| 211 "enable_media_router", | |
| 212 ] | |
| 213 } | |
| 214 if (enable_plugins) { | |
| 215 grit_defines += [ | |
| 216 "-D", | |
| 217 "enable_plugins", | |
| 218 ] | |
| 219 } | |
| 220 if (enable_basic_printing || enable_print_preview) { | |
| 221 grit_defines += [ | |
| 222 "-D", | |
| 223 "enable_printing", | |
| 224 ] | |
| 225 if (enable_print_preview) { | |
| 226 grit_defines += [ | |
| 227 "-D", | |
| 228 "enable_print_preview", | |
| 229 ] | |
| 230 } | |
| 231 } | |
| 232 if (enable_themes) { | |
| 233 grit_defines += [ | |
| 234 "-D", | |
| 235 "enable_themes", | |
| 236 ] | |
| 237 } | |
| 238 if (enable_app_list) { | |
| 239 grit_defines += [ | |
| 240 "-D", | |
| 241 "enable_app_list", | |
| 242 ] | |
| 243 } | |
| 244 if (enable_settings_app) { | |
| 245 grit_defines += [ | |
| 246 "-D", | |
| 247 "enable_settings_app", | |
| 248 ] | |
| 249 } | |
| 250 if (enable_google_now) { | |
| 251 grit_defines += [ | |
| 252 "-D", | |
| 253 "enable_google_now", | |
| 254 ] | |
| 255 } | |
| 256 | |
| 257 # Note: use_concatenated_impulse_responses is omitted. It is never used and | |
| 258 # should probably be removed from GYP build. | |
| 259 if (enable_webrtc) { | |
| 260 grit_defines += [ | |
| 261 "-D", | |
| 262 "enable_webrtc", | |
| 263 ] | |
| 264 } | |
| 265 if (enable_hangout_services_extension) { | |
| 266 grit_defines += [ | |
| 267 "-D", | |
| 268 "enable_hangout_services_extension", | |
| 269 ] | |
| 270 } | |
| 271 if (enable_task_manager) { | |
| 272 grit_defines += [ | |
| 273 "-D", | |
| 274 "enable_task_manager", | |
| 275 ] | |
| 276 } | |
| 277 if (enable_notifications) { | |
| 278 grit_defines += [ | |
| 279 "-D", | |
| 280 "enable_notifications", | |
| 281 ] | |
| 282 } | |
| 283 if (enable_wifi_bootstrapping) { | |
| 284 grit_defines += [ | |
| 285 "-D", | |
| 286 "enable_wifi_bootstrapping", | |
| 287 ] | |
| 288 } | |
| 289 if (enable_service_discovery) { | |
| 290 grit_defines += [ | |
| 291 "-D", | |
| 292 "enable_service_discovery", | |
| 293 ] | |
| 294 } | |
| 295 if (mac_views_browser) { | |
| 296 grit_defines += [ | |
| 297 "-D", | |
| 298 "mac_views_browser", | |
| 299 ] | |
| 300 } | |
| 301 | |
| 302 grit_resource_id_file = "//tools/gritsettings/resource_ids" | 158 grit_resource_id_file = "//tools/gritsettings/resource_ids" |
| 303 grit_info_script = "//tools/grit/grit_info.py" | 159 grit_info_script = "//tools/grit/grit_info.py" |
| 304 | 160 |
| 305 template("grit") { | 161 template("grit") { |
| 306 assert(defined(invoker.source), | 162 assert(defined(invoker.source), |
| 307 "\"source\" must be defined for the grit template $target_name") | 163 "\"source\" must be defined for the grit template $target_name") |
| 308 | 164 |
| 309 grit_inputs = [ invoker.source ] | 165 grit_inputs = [ invoker.source ] |
| 310 | 166 |
| 311 if (defined(invoker.resource_ids)) { | 167 if (defined(invoker.resource_ids)) { |
| 312 resource_ids = invoker.resource_ids | 168 resource_ids = invoker.resource_ids |
| 313 } else { | 169 } else { |
| 314 resource_ids = grit_resource_id_file | 170 resource_ids = grit_resource_id_file |
| 315 } | 171 } |
| 316 grit_inputs += [ resource_ids ] # Script depends on ID file. | 172 if (resource_ids != "") { |
| 173 # The script depends on the ID file. Only add this dependency if the ID |
| 174 # file is specified. |
| 175 grit_inputs += [ resource_ids ] |
| 176 } |
| 317 | 177 |
| 318 if (defined(invoker.output_dir)) { | 178 if (defined(invoker.output_dir)) { |
| 319 output_dir = invoker.output_dir | 179 output_dir = invoker.output_dir |
| 320 } else { | 180 } else { |
| 321 output_dir = target_gen_dir | 181 output_dir = target_gen_dir |
| 322 } | 182 } |
| 323 | 183 |
| 324 if (defined(invoker.output_name)) { | 184 if (defined(invoker.output_name)) { |
| 325 grit_output_name = invoker.output_name | 185 grit_output_name = invoker.output_name |
| 326 } else { | 186 } else { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 } | 298 } |
| 439 } | 299 } |
| 440 | 300 |
| 441 # This is the thing that people actually link with, it must be named the | 301 # This is the thing that people actually link with, it must be named the |
| 442 # same as the argument the template was invoked with. | 302 # same as the argument the template was invoked with. |
| 443 source_set(target_name) { | 303 source_set(target_name) { |
| 444 # Since we generate a file, we need to be run before the targets that | 304 # Since we generate a file, we need to be run before the targets that |
| 445 # depend on us. | 305 # depend on us. |
| 446 sources = grit_outputs | 306 sources = grit_outputs |
| 447 | 307 |
| 448 # Deps set on the template invocation will go on the grit script running | 308 # Deps set on the template invocation will go on the action that runs |
| 449 # target rather than this library. | 309 # grit above rather than this library. This target needs to depend on the |
| 450 deps = [ | 310 # action publicly so other scripts can take the outputs from the grit |
| 311 # script as inputs. |
| 312 public_deps = [ |
| 451 ":$grit_custom_target", | 313 ":$grit_custom_target", |
| 452 ] | 314 ] |
| 453 public_configs = [ ":$grit_config" ] | 315 public_configs = [ ":$grit_config" ] |
| 454 | 316 |
| 455 if (defined(invoker.public_configs)) { | 317 if (defined(invoker.public_configs)) { |
| 456 public_configs += invoker.public_configs | 318 public_configs += invoker.public_configs |
| 457 } | 319 } |
| 458 | 320 |
| 459 if (defined(invoker.configs)) { | 321 if (defined(invoker.configs)) { |
| 460 configs += invoker.configs | 322 configs += invoker.configs |
| 461 } | 323 } |
| 462 | 324 |
| 463 if (defined(invoker.visibility)) { | 325 if (defined(invoker.visibility)) { |
| 464 visibility = invoker.visibility | 326 visibility = invoker.visibility |
| 465 } | 327 } |
| 466 output_name = grit_output_name | 328 output_name = grit_output_name |
| 467 } | 329 } |
| 468 } | 330 } |
| OLD | NEW |