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# This template will generate inspector protocol source code. The code will 6# not be compiled, use get_target_outputs(<name>) to compile them. 7# 8# Inputs 9# 10# config_file (required) 11# Path to json file specifying inspector protocol configuration. 12# 13# out_dir (required) 14# Path to put the generated files in. It must be inside output or 15# generated file directory. 16# 17# outputs (required) 18# Files generated. Relative to out_dir. 19# 20# inputs (optional) 21# Extra inputs specified by the config file. 22template("inspector_protocol_generate") { 23 assert(defined(invoker.config_file)) 24 assert(defined(invoker.out_dir)) 25 assert(defined(invoker.outputs)) 26 assert(defined(invoker.inspector_protocol_dir)) 27 inspector_protocol_dir = invoker.inspector_protocol_dir 28 29 action(target_name) { 30 script = "$inspector_protocol_dir/code_generator.py" 31 32 inputs = [ 33 invoker.config_file, 34 "$inspector_protocol_dir/lib/base_string_adapter_cc.template", 35 "$inspector_protocol_dir/lib/base_string_adapter_h.template", 36 "$inspector_protocol_dir/lib/encoding_h.template", 37 "$inspector_protocol_dir/lib/encoding_cpp.template", 38 "$inspector_protocol_dir/lib/Allocator_h.template", 39 "$inspector_protocol_dir/lib/Array_h.template", 40 "$inspector_protocol_dir/lib/DispatcherBase_cpp.template", 41 "$inspector_protocol_dir/lib/DispatcherBase_h.template", 42 "$inspector_protocol_dir/lib/ErrorSupport_cpp.template", 43 "$inspector_protocol_dir/lib/ErrorSupport_h.template", 44 "$inspector_protocol_dir/lib/Forward_h.template", 45 "$inspector_protocol_dir/lib/FrontendChannel_h.template", 46 "$inspector_protocol_dir/lib/Maybe_h.template", 47 "$inspector_protocol_dir/lib/Object_cpp.template", 48 "$inspector_protocol_dir/lib/Object_h.template", 49 "$inspector_protocol_dir/lib/Parser_cpp.template", 50 "$inspector_protocol_dir/lib/Parser_h.template", 51 "$inspector_protocol_dir/lib/Protocol_cpp.template", 52 "$inspector_protocol_dir/lib/ValueConversions_h.template", 53 "$inspector_protocol_dir/lib/Values_cpp.template", 54 "$inspector_protocol_dir/lib/Values_h.template", 55 "$inspector_protocol_dir/templates/Exported_h.template", 56 "$inspector_protocol_dir/templates/Imported_h.template", 57 "$inspector_protocol_dir/templates/TypeBuilder_cpp.template", 58 "$inspector_protocol_dir/templates/TypeBuilder_h.template", 59 ] 60 if (defined(invoker.inputs)) { 61 inputs += invoker.inputs 62 } 63 64 args = [ 65 "--jinja_dir", 66 rebase_path("//third_party/", root_build_dir), # jinja is in chromium's third_party 67 "--output_base", 68 rebase_path(invoker.out_dir, root_build_dir), 69 "--config", 70 rebase_path(invoker.config_file, root_build_dir), 71 ] 72 73 if (defined(invoker.config_values)) { 74 foreach(value, invoker.config_values) { 75 args += [ 76 "--config_value", 77 value, 78 ] 79 } 80 } 81 82 outputs = get_path_info(rebase_path(invoker.outputs, ".", invoker.out_dir), 83 "abspath") 84 85 forward_variables_from(invoker, 86 [ 87 "visibility", 88 "deps", 89 "public_deps", 90 ]) 91 } 92} 93