| 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 # Creates a zip archive of the inputs. | 5 # Creates a zip archive of the inputs. |
| 6 # If base_dir is provided, the archive paths will be relative to it. | 6 # |
| 7 # inputs (required) |
| 8 # List of input files relative to the current directory. |
| 9 # |
| 10 # output (required) |
| 11 # File name to write. |
| 12 # |
| 13 # base_dir (optional) |
| 14 # If provided, the archive paths will be relative to this directory. |
| 15 # |
| 16 # deps, public_deps, data_deps, testonly, visibility (optional) |
| 17 # Normal meaning. |
| 7 template("zip") { | 18 template("zip") { |
| 8 set_sources_assignment_filter([]) | |
| 9 if (defined(invoker.testonly)) { | |
| 10 testonly = invoker.testonly | |
| 11 } | |
| 12 | |
| 13 assert(defined(invoker.inputs)) | |
| 14 assert(defined(invoker.output)) | |
| 15 | |
| 16 rebase_inputs = rebase_path(invoker.inputs, root_build_dir) | |
| 17 rebase_output = rebase_path(invoker.output, root_build_dir) | |
| 18 action(target_name) { | 19 action(target_name) { |
| 19 script = "//build/android/gn/zip.py" | 20 script = "//build/android/gn/zip.py" |
| 20 depfile = "$target_gen_dir/$target_name.d" | 21 depfile = "$target_gen_dir/$target_name.d" |
| 21 inputs = invoker.inputs | 22 inputs = invoker.inputs |
| 22 outputs = [ | 23 outputs = [ |
| 23 depfile, | 24 depfile, |
| 24 invoker.output, | 25 invoker.output, |
| 25 ] | 26 ] |
| 27 |
| 28 assert(defined(invoker.inputs)) |
| 29 rebase_inputs = rebase_path(invoker.inputs, root_build_dir) |
| 30 |
| 31 assert(defined(invoker.output)) |
| 32 rebase_output = rebase_path(invoker.output, root_build_dir) |
| 33 |
| 26 args = [ | 34 args = [ |
| 27 "--depfile", | 35 "--depfile", |
| 28 rebase_path(depfile, root_build_dir), | 36 rebase_path(depfile, root_build_dir), |
| 29 "--inputs=$rebase_inputs", | 37 "--inputs=$rebase_inputs", |
| 30 "--output=$rebase_output", | 38 "--output=$rebase_output", |
| 31 ] | 39 ] |
| 32 if (defined(invoker.base_dir)) { | 40 if (defined(invoker.base_dir)) { |
| 33 args += [ | 41 args += [ |
| 34 "--base-dir", | 42 "--base-dir", |
| 35 rebase_path(invoker.base_dir, root_build_dir), | 43 rebase_path(invoker.base_dir, root_build_dir), |
| 36 ] | 44 ] |
| 37 } | 45 } |
| 38 | 46 |
| 39 if (defined(invoker.deps)) { | 47 forward_variables_from(invoker, |
| 40 deps = invoker.deps | 48 [ |
| 41 } | 49 "testonly", |
| 42 if (defined(invoker.public_deps)) { | 50 "deps", |
| 43 public_deps = invoker.public_deps | 51 "public_deps", |
| 44 } | 52 "data_deps", |
| 45 if (defined(invoker.data_deps)) { | 53 "visibility", |
| 46 data_deps = invoker.data_deps | 54 ]) |
| 47 } | |
| 48 | |
| 49 if (defined(invoker.visibility)) { | |
| 50 visibility = invoker.visibility | |
| 51 } | |
| 52 } | 55 } |
| 53 } | 56 } |
| OLD | NEW |