xref: /aosp_15_r20/external/cronet/build/config/zip.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2014 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("python.gni")
6
7# Creates a zip archive of the inputs.
8#
9# output (required)
10#     Path to output zip.
11# inputs (required)
12#     List of input files to zip.
13# base_dir (optional)
14#     If provided, the archive paths will be relative to this directory.
15#     Applies only to |inputs|.
16# zip_comment_values (optional)
17#     A list of key=value strings to store in a JSON-encoded archive comment.
18#
19# deps, public_deps, data, data_deps, testonly, visibility
20#     Normal meaning.
21template("zip") {
22  action_with_pydeps(target_name) {
23    forward_variables_from(invoker,
24                           [
25                             "data",
26                             "data_deps",
27                             "deps",
28                             "public_deps",
29                             "testonly",
30                             "visibility",
31                           ])
32    script = "//build/android/gyp/zip.py"
33    inputs = invoker.inputs
34    outputs = [ invoker.output ]
35
36    args = [
37      "--output",
38      rebase_path(invoker.output, root_build_dir),
39    ]
40
41    if (defined(invoker.zip_comment_values)) {
42      foreach(comment, invoker.zip_comment_values) {
43        args += [
44          "--comment-json",
45          comment,
46        ]
47      }
48    }
49
50    _rebased_inputs = rebase_path(invoker.inputs, root_build_dir)
51    args += [ "--input-files=$_rebased_inputs" ]
52    if (defined(invoker.base_dir)) {
53      args += [
54        "--input-files-base-dir",
55        rebase_path(invoker.base_dir, root_build_dir),
56      ]
57    }
58  }
59}
60