1 # Copyright 2013 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 { 6 'includes': [ 7 'mojom_bindings_generator_variables.gypi', 8 ], 9 'variables': { 10 'variables': { 11 'variables': { 12 'for_blink%': 'false', 13 'use_new_wrapper_types%': 'false', 14 }, 15 'for_blink%': '<(for_blink)', 16 'use_new_wrapper_types%': '<(use_new_wrapper_types)', 17 'conditions': [ 18 ['for_blink=="true"', { 19 'mojom_output_languages%': 'c++', 20 'mojom_variant%': 'blink', 21 'mojom_generator_wtf_arg%': [ 22 '--for_blink', 23 ], 24 'wtf_dependencies%': [ 25 '<(DEPTH)/mojo/mojo_public.gyp:mojo_cpp_bindings_wtf_support', 26 '<(DEPTH)/third_party/WebKit/Source/wtf/wtf.gyp:wtf', 27 ], 28 }, { 29 'mojom_output_languages%': 'c++,javascript,java', 30 'mojom_variant%': 'none', 31 'mojom_generator_wtf_arg%': [], 32 'wtf_dependencies%': [], 33 }], 34 ['use_new_wrapper_types=="true"', { 35 'mojom_generator_new_wrappers_arg%': [ 36 '--use_new_wrapper_types', 37 ], 38 }, { 39 'mojom_generator_new_wrappers_arg%': [], 40 }], 41 ], 42 }, 43 'for_blink%': '<(for_blink)', 44 'use_new_wrapper_types%': '<(use_new_wrapper_types)', 45 'mojom_variant%': '<(mojom_variant)', 46 'mojom_generator_wtf_arg%': '<(mojom_generator_wtf_arg)', 47 'mojom_generator_new_wrappers_arg%': '<(mojom_generator_new_wrappers_arg)', 48 'wtf_dependencies%': '<(wtf_dependencies)', 49 'mojom_output_languages%': '<(mojom_output_languages)', 50 'mojom_typemaps%': [], 51 'mojom_base_output_dir': 52 '<!(python <(DEPTH)/build/inverse_depth.py <(DEPTH))', 53 'mojom_generated_outputs': [ 54 '<!@(python <(DEPTH)/mojo/public/tools/bindings/mojom_list_outputs.py --basedir <(mojom_base_output_dir) --variant <(mojom_variant) <@(_sources))', 55 ], 56 'generated_typemap_file': '<(SHARED_INTERMEDIATE_DIR)/<(mojom_base_output_dir)/<(_target_name)_type_mappings', 57 }, 58 'actions': [ 59 { 60 'variables': { 61 'java_out_dir': '<(PRODUCT_DIR)/java_mojo/<(_target_name)/src', 62 'stamp_filename': '<(PRODUCT_DIR)/java_mojo/<(_target_name)/<(_target_name).stamp', 63 }, 64 'action_name': '<(_target_name)_mojom_bindings_stamp', 65 # The java output directory is deleted to ensure that the java library 66 # doesn't try to compile stale files. 67 'action': [ 68 'python', '<(DEPTH)/build/rmdir_and_stamp.py', 69 '<(java_out_dir)', 70 '<(stamp_filename)', 71 ], 72 'inputs': [ '<@(_sources)' ], 73 'outputs': [ '<(stamp_filename)' ], 74 }, 75 { 76 'variables': { 77 'output': '<(generated_typemap_file)', 78 }, 79 'action_name': '<(_target_name)_type_mappings', 80 'action': [ 81 'python', '<(DEPTH)/mojo/public/tools/bindings/generate_type_mappings.py', 82 '--output', 83 '<(output)', 84 '<!@(python <(DEPTH)/mojo/public/tools/bindings/format_typemap_generator_args.py <@(mojom_typemaps))', 85 ], 86 'inputs':[ 87 '<(DEPTH)/mojo/public/tools/bindings/generate_type_mappings.py', 88 ], 89 'outputs': [ '<(output)' ], 90 }, 91 ], 92 'rules': [ 93 { 94 'rule_name': '<(_target_name)_mojom_bindings_generator', 95 'extension': 'mojom', 96 'variables': { 97 'java_out_dir': '<(PRODUCT_DIR)/java_mojo/<(_target_name)/src', 98 'mojom_import_args%': [ 99 '-I<(DEPTH)', 100 '-I<(DEPTH)/mojo/services', 101 ], 102 'stamp_filename': '<(PRODUCT_DIR)/java_mojo/<(_target_name)/<(_target_name).stamp', 103 }, 104 'inputs': [ 105 '<@(mojom_bindings_generator_sources)', 106 '<(stamp_filename)', 107 '<(generated_typemap_file)', 108 '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings/cpp_templates.zip', 109 '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings/java_templates.zip', 110 '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings/js_templates.zip', 111 ], 112 'conditions': [ 113 ['mojom_variant=="none"', { 114 'outputs': [ 115 '<(SHARED_INTERMEDIATE_DIR)/<(mojom_base_output_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom.cc', 116 '<(SHARED_INTERMEDIATE_DIR)/<(mojom_base_output_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom.h', 117 '<(SHARED_INTERMEDIATE_DIR)/<(mojom_base_output_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom.js', 118 '<(SHARED_INTERMEDIATE_DIR)/<(mojom_base_output_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom-internal.h', 119 ] 120 }, { 121 'outputs': [ 122 '<(SHARED_INTERMEDIATE_DIR)/<(mojom_base_output_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom-<(mojom_variant).cc', 123 '<(SHARED_INTERMEDIATE_DIR)/<(mojom_base_output_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom-<(mojom_variant).h', 124 '<(SHARED_INTERMEDIATE_DIR)/<(mojom_base_output_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom-<(mojom_variant)-internal.h', 125 ], 126 }] 127 ], 128 'action': [ 129 'python', '<@(mojom_bindings_generator)', 130 '--use_bundled_pylibs', 'generate', 131 './<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom', 132 '-d', '<(DEPTH)', 133 '<@(mojom_import_args)', 134 '-o', '<(SHARED_INTERMEDIATE_DIR)', 135 '--java_output_directory=<(java_out_dir)', 136 '--variant', '<(mojom_variant)', 137 '-g', '<(mojom_output_languages)', 138 '--typemap', 139 '<(generated_typemap_file)', 140 '<@(mojom_generator_wtf_arg)', 141 '<@(mojom_generator_new_wrappers_arg)', 142 '--bytecode_path', 143 '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings', 144 ], 145 'message': 'Generating Mojo bindings from <(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom', 146 'process_outputs_as_sources': 1, 147 } 148 ], 149 'dependencies': [ 150 '<(DEPTH)/base/base.gyp:base', 151 '<(DEPTH)/mojo/mojo_public.gyp:mojo_interface_bindings_generation', 152 '<(DEPTH)/mojo/public/tools/bindings/bindings.gyp:precompile_mojom_bindings_generator_templates', 153 '<@(wtf_dependencies)', 154 ], 155 'export_dependent_settings': [ 156 '<@(wtf_dependencies)', 157 ], 158 'include_dirs': [ 159 '<(DEPTH)', 160 '<(SHARED_INTERMEDIATE_DIR)', 161 ], 162 'direct_dependent_settings': { 163 'include_dirs': [ 164 '<(DEPTH)', 165 '<(SHARED_INTERMEDIATE_DIR)', 166 ], 167 'variables': { 168 'generated_src_dirs': [ 169 '<(PRODUCT_DIR)/java_mojo/<(_target_name)/src', 170 ], 171 'additional_input_paths': [ 172 '<@(mojom_bindings_generator_sources)', 173 '<@(_sources)', 174 ], 175 }, 176 }, 177 'hard_dependency': 1, 178 } 179