1# Copyright 2016 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# Template to run the tweak_info_plist.py script on a plist.
6#
7# Arguments:
8#
9#     info_plist:
10#         string, the plist to tweak.
11#
12#     args:
13#         list of string, the arguments to pass to the tweak_info_plist.py
14#         script.
15#
16# Callers should use get_target_outputs() to get the output name.
17template("tweak_info_plist") {
18  assert(defined(invoker.info_plist),
19         "The info_plist must be specified in $target_name")
20  assert(defined(invoker.args),
21         "The args to tweak_info_plist.py must be specified in $target_name")
22
23  action(target_name) {
24    forward_variables_from(invoker, [ "testonly" ])
25    script = "//build/mac/tweak_info_plist.py"
26    inputs = [
27      script,
28      "//build/util/version.py",
29      "//build/util/LASTCHANGE",
30      "//chrome/VERSION",
31    ]
32    sources = [
33      invoker.info_plist,
34    ]
35    _output_name = "$target_gen_dir/${target_name}_tweaked.plist"
36    outputs = [
37      _output_name,
38    ]
39    args = invoker.args + [
40             "--plist",
41             rebase_path(invoker.info_plist, root_build_dir),
42             "--output",
43             rebase_path(_output_name, root_build_dir),
44           ]
45  }
46}
47