Home | History | Annotate | Download | only in build
      1 # Copyright 2014 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 # Paraneters:
      6 #   filename
      7 #       Output base name (will be put into gen/blink with various extensions).
      8 #
      9 #   resources
     10 #       List of resource files.
     11 #
     12 #   namespace (optional)
     13 #       String. If specified, files will be wrapped in this namespace.
     14 template("make_file_arrays") {
     15   assert(defined(invoker.resources), "Need resources in $target_name")
     16   assert(defined(invoker.filename), "Need filename in $target_name")
     17 
     18   code_gen_target_name = target_name + "_code_gen"
     19 
     20   action(code_gen_target_name) {
     21     source_prereqs = invoker.resources
     22     script = "//third_party/WebKit/Source/build/scripts/make-file-arrays.py"
     23     sources = [ script ]
     24     sources += invoker.resources
     25     outputs = [
     26       "$root_gen_dir/blink/" + invoker.filename + ".h",
     27       "$root_gen_dir/blink/" + invoker.filename + ".cpp",
     28     ]
     29     args = [
     30       "--out-h=gen/blink/" + invoker.filename + ".h",
     31       "--out-cpp=gen/blink/" + invoker.filename + ".cpp",
     32     ]
     33     if (defined(invoker.namespace)) {
     34       args += [ "--namespace=" + invoker.namespace ]
     35     }
     36     args += rebase_path(invoker.resources, root_build_dir, ".")
     37   }
     38 
     39   source_set(target_name) {
     40     sources = get_target_outputs(":$code_gen_target_name")
     41     deps = [ ":$code_gen_target_name" ]
     42     configs += [ "//third_party/WebKit/Source:config" ]
     43   }
     44 }
     45 
     46 
     47