OLD | NEW |
(Empty) | |
| 1 # Copyright 2015 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 # Declare a target for processing a template. |
| 6 # |
| 7 # Variables |
| 8 # input: The template file to be processed. |
| 9 # output: Where to save the result. |
| 10 # variables: A list of variables to make available to the template |
| 11 # processing environment, e.g. ["name=foo", "color=red"]. |
| 12 # |
| 13 # Example |
| 14 # file_template("chrome_shell_manifest") { |
| 15 # input = "shell/java/AndroidManifest.xml" |
| 16 # output = "$target_gen_dir/AndroidManifest.xml" |
| 17 # variables = "app_name=chrome_shell app_version=1" |
| 18 # } |
| 19 template("file_template") { |
| 20 set_sources_assignment_filter([]) |
| 21 |
| 22 if (defined(invoker.testonly)) { |
| 23 testonly = invoker.testonly |
| 24 } |
| 25 |
| 26 assert(defined(invoker.input), |
| 27 "The input file must be specified") |
| 28 assert(defined(invoker.output), |
| 29 "The output file must be specified") |
| 30 assert(defined(invoker.variables), |
| 31 "The variable used for substitution in templates must be specified") |
| 32 |
| 33 variables = invoker.variables |
| 34 |
| 35 action(target_name) { |
| 36 if(defined(invoker.visibility)) { |
| 37 visibility = invoker.visibility |
| 38 } |
| 39 |
| 40 script = "//build/android/gyp/jinja_template.py" |
| 41 depfile = "$target_gen_dir/$target_name.d" |
| 42 |
| 43 sources = [ invoker.input ] |
| 44 outputs = [ invoker.output, depfile ] |
| 45 |
| 46 args = [ |
| 47 "--inputs", |
| 48 rebase_path(invoker.input, root_build_dir), |
| 49 "--output", |
| 50 rebase_path(invoker.output, root_build_dir), |
| 51 "--depfile", |
| 52 rebase_path(depfile, root_build_dir), |
| 53 "--variables=${variables}" |
| 54 ] |
| 55 } |
| 56 } |
OLD | NEW |