• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3# found in the LICENSE file.
4
5# Creates a zip archive of the inputs.
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.
18template("zip") {
19  action(target_name) {
20    script = "//build/zip.py"
21    depfile = "$target_gen_dir/$target_name.d"
22    inputs = invoker.inputs
23    outputs = [ invoker.output ]
24
25    assert(defined(invoker.inputs))
26    rebase_inputs = rebase_path(invoker.inputs, root_build_dir)
27
28    assert(defined(invoker.output))
29    rebase_output = rebase_path(invoker.output, root_build_dir)
30
31    args = [
32      "--depfile",
33      rebase_path(depfile, root_build_dir),
34      "--inputs=$rebase_inputs",
35      "--output=$rebase_output",
36    ]
37    if (defined(invoker.base_dir)) {
38      args += [
39        "--base-dir",
40        rebase_path(invoker.base_dir, root_build_dir),
41      ]
42    }
43
44    forward_variables_from(invoker,
45                           [
46                             "testonly",
47                             "deps",
48                             "public_deps",
49                             "data_deps",
50                             "visibility",
51                           ])
52  }
53}
54