summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/build/apple/tweak_info_plist.gni
blob: 33f22ca2d087e83513aa6d0052c8493245f16e76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/util/lastchange.gni")

# Template to run the tweak_info_plist.py script on a plist.
#
# Arguments:
#
#     info_plist:
#         (optional), string, the plist to tweak.
#
#     info_plists:
#         (optional), list of string, the plist files to merge and tweak.
#
#     args:
#         (optional), list of string, the arguments to pass to the
#         tweak_info_plist.py script.
#
# Callers should use get_target_outputs() to get the output name. One of
# info_plist or info_plists must be specified.
template("tweak_info_plist") {
  _output_name = "$target_gen_dir/${target_name}_tweaked.plist"

  if (defined(invoker.info_plists)) {
    assert(!defined(invoker.info_plist),
           "Cannot have both info_plist and info_plists for $target_name")

    _source_name = "$target_gen_dir/${target_name}_merged.plist"
    _deps = [ ":" + target_name + "_merge_plist" ]

    action(target_name + "_merge_plist") {
      forward_variables_from(invoker,
                             [
                               "testonly",
                               "deps",
                             ])
      script = "//build/apple/plist_util.py"
      sources = invoker.info_plists
      outputs = [ _source_name ]
      args = [
               "merge",
               "-f=xml1",
               "-o=" + rebase_path(_source_name, root_build_dir),
             ] + rebase_path(invoker.info_plists, root_build_dir)
    }
  } else {
    assert(defined(invoker.info_plist),
           "The info_plist must be specified in $target_name")

    _source_name = invoker.info_plist
    _deps = []
    if (defined(invoker.deps)) {
      _deps += invoker.deps
    }
  }

  action(target_name) {
    forward_variables_from(invoker,
                           [
                             "args",
                             "testonly",
                           ])
    script = "//build/apple/tweak_info_plist.py"
    inputs = [
      script,
      "//build/util/version.py",
      lastchange_file,
      "//chrome/VERSION",
    ]
    sources = [ _source_name ]
    outputs = [ _output_name ]
    if (!defined(args)) {
      args = []
    }
    args += [
      "--plist",
      rebase_path(_source_name, root_build_dir),
      "--output",
      rebase_path(_output_name, root_build_dir),
      "--platform=$current_os",
    ]
    deps = _deps
  }
}