tor-browser

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

java_action.gni (3176B)


      1 # Copyright 2015 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 jarrunner = "//chromium/build/util/java_action.py"
      6 
      7 # Declare a target that runs a java command a single time.
      8 #
      9 # This target type allows you to run a java command a single time to produce
     10 # one or more output files. If you want to run a java command for each of a
     11 # set of input files, see "java_action_foreach".
     12 #
     13 # See "gn help action" for more information on how to use this target. This
     14 # template is based on the "action" and supports the same variables.
     15 template("java_action") {
     16   assert(defined(invoker.script),
     17          "Need script in $target_name listing the .jar file to run.")
     18   assert(defined(invoker.outputs),
     19          "Need outputs in $target_name listing the generated outputs.")
     20 
     21   jarscript = invoker.script
     22   action(target_name) {
     23     script = jarrunner
     24 
     25     inputs = [ jarscript ]
     26     if (defined(invoker.inputs)) {
     27       inputs += invoker.inputs
     28     }
     29 
     30     args = [
     31       "-jar",
     32       rebase_path(jarscript, root_build_dir),
     33     ]
     34     if (defined(invoker.args)) {
     35       args += invoker.args
     36     }
     37 
     38     forward_variables_from(invoker,
     39                            [
     40                              "console",
     41                              "data",
     42                              "data_deps",
     43                              "depfile",
     44                              "deps",
     45                              "outputs",
     46                              "sources",
     47                              "testonly",
     48                              "visibility",
     49                            ])
     50   }
     51 }
     52 
     53 # Declare a target that runs a java command over a set of files.
     54 #
     55 # This target type allows you to run a java command once-per-file over a set of
     56 # sources. If you want to run a java command once that takes many files as
     57 # input, see "java_action".
     58 #
     59 # See "gn help action_foreach" for more information on how to use this target.
     60 # This template is based on the "action_foreach" supports the same variables.
     61 template("java_action_foreach") {
     62   assert(defined(invoker.script),
     63          "Need script in $target_name listing the .jar file to run.")
     64   assert(defined(invoker.outputs),
     65          "Need outputs in $target_name listing the generated outputs.")
     66   assert(defined(invoker.sources),
     67          "Need sources in $target_name listing the target inputs.")
     68 
     69   jarscript = invoker.script
     70   action_foreach(target_name) {
     71     script = jarrunner
     72 
     73     inputs = [ jarscript ]
     74     if (defined(invoker.inputs)) {
     75       inputs += invoker.inputs
     76     }
     77 
     78     args = [
     79       "-jar",
     80       rebase_path(jarscript, root_build_dir),
     81     ]
     82     if (defined(invoker.args)) {
     83       args += invoker.args
     84     }
     85 
     86     forward_variables_from(invoker,
     87                            [
     88                              "console",
     89                              "data",
     90                              "data_deps",
     91                              "depfile",
     92                              "deps",
     93                              "outputs",
     94                              "sources",
     95                              "testonly",
     96                              "visibility",
     97                            ])
     98   }
     99 }