tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

tweak_info_plist.gni (2530B)


      1 # Copyright 2016 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 
      5 import("//chromium/build/util/lastchange.gni")
      6 
      7 # Template to run the tweak_info_plist.py script on a plist.
      8 #
      9 # Arguments:
     10 #
     11 #     info_plist:
     12 #         (optional), string, the plist to tweak.
     13 #
     14 #     info_plists:
     15 #         (optional), list of string, the plist files to merge and tweak.
     16 #
     17 #     args:
     18 #         (optional), list of string, the arguments to pass to the
     19 #         tweak_info_plist.py script.
     20 #
     21 # Callers should use get_target_outputs() to get the output name. One of
     22 # info_plist or info_plists must be specified.
     23 template("tweak_info_plist") {
     24   _output_name = "$target_gen_dir/${target_name}_tweaked.plist"
     25 
     26   if (defined(invoker.info_plists)) {
     27     assert(!defined(invoker.info_plist),
     28            "Cannot have both info_plist and info_plists for $target_name")
     29 
     30     _source_name = "$target_gen_dir/${target_name}_merged.plist"
     31     _deps = [ ":" + target_name + "_merge_plist" ]
     32 
     33     action(target_name + "_merge_plist") {
     34       forward_variables_from(invoker,
     35                              [
     36                                "testonly",
     37                                "deps",
     38                              ])
     39       script = "//chromium/build/apple/plist_util.py"
     40       sources = invoker.info_plists
     41       outputs = [ _source_name ]
     42       args = [
     43                "merge",
     44                "-f=xml1",
     45                "-o=" + rebase_path(_source_name, root_build_dir),
     46              ] + rebase_path(invoker.info_plists, root_build_dir)
     47     }
     48   } else {
     49     assert(defined(invoker.info_plist),
     50            "The info_plist must be specified in $target_name")
     51 
     52     _source_name = invoker.info_plist
     53     _deps = []
     54     if (defined(invoker.deps)) {
     55       _deps += invoker.deps
     56     }
     57   }
     58 
     59   action(target_name) {
     60     forward_variables_from(invoker,
     61                            [
     62                              "args",
     63                              "testonly",
     64                            ])
     65     script = "//chromium/build/apple/tweak_info_plist.py"
     66     inputs = [
     67       script,
     68       "//chromium/build/util/version.py",
     69       lastchange_file,
     70       "//chrome/VERSION",
     71     ]
     72     sources = [ _source_name ]
     73     outputs = [ _output_name ]
     74     if (!defined(args)) {
     75       args = []
     76     }
     77     args += [
     78       "--plist",
     79       rebase_path(_source_name, root_build_dir),
     80       "--output",
     81       rebase_path(_output_name, root_build_dir),
     82       "--platform=$current_os",
     83     ]
     84     deps = _deps
     85   }
     86 }