| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 mojom_generator_root = "//mojo/public/tools/bindings" | 5 mojom_generator_root = "//mojo/public/tools/bindings" |
| 6 mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py" | 6 mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py" |
| 7 mojom_generator_sources = [ | 7 mojom_generator_sources = [ |
| 8 "$mojom_generator_root/generators/mojom_cpp_generator.py", | 8 "$mojom_generator_root/generators/mojom_cpp_generator.py", |
| 9 "$mojom_generator_root/generators/mojom_js_generator.py", | 9 "$mojom_generator_root/generators/mojom_js_generator.py", |
| 10 "$mojom_generator_root/generators/mojom_java_generator.py", | 10 "$mojom_generator_root/generators/mojom_java_generator.py", |
| 11 "$mojom_generator_root/pylib/mojom/__init__.py", | 11 "$mojom_generator_root/pylib/mojom/__init__.py", |
| 12 "$mojom_generator_root/pylib/mojom/error.py", | 12 "$mojom_generator_root/pylib/mojom/error.py", |
| 13 "$mojom_generator_root/pylib/mojom/generate/__init__.py", | 13 "$mojom_generator_root/pylib/mojom/generate/__init__.py", |
| 14 "$mojom_generator_root/pylib/mojom/generate/constant_resolver.py", | 14 "$mojom_generator_root/pylib/mojom/generate/constant_resolver.py", |
| 15 "$mojom_generator_root/pylib/mojom/generate/data.py", | 15 "$mojom_generator_root/pylib/mojom/generate/data.py", |
| 16 "$mojom_generator_root/pylib/mojom/generate/generator.py", | 16 "$mojom_generator_root/pylib/mojom/generate/generator.py", |
| 17 "$mojom_generator_root/pylib/mojom/generate/module.py", | 17 "$mojom_generator_root/pylib/mojom/generate/module.py", |
| 18 "$mojom_generator_root/pylib/mojom/generate/pack.py", | 18 "$mojom_generator_root/pylib/mojom/generate/pack.py", |
| 19 "$mojom_generator_root/pylib/mojom/generate/template_expander.py", | 19 "$mojom_generator_root/pylib/mojom/generate/template_expander.py", |
| 20 "$mojom_generator_root/pylib/mojom/parse/__init__.py", | 20 "$mojom_generator_root/pylib/mojom/parse/__init__.py", |
| 21 "$mojom_generator_root/pylib/mojom/parse/ast.py", | 21 "$mojom_generator_root/pylib/mojom/parse/ast.py", |
| 22 "$mojom_generator_root/pylib/mojom/parse/lexer.py", | 22 "$mojom_generator_root/pylib/mojom/parse/lexer.py", |
| 23 "$mojom_generator_root/pylib/mojom/parse/parser.py", | 23 "$mojom_generator_root/pylib/mojom/parse/parser.py", |
| 24 "$mojom_generator_root/pylib/mojom/parse/translate.py", | 24 "$mojom_generator_root/pylib/mojom/parse/translate.py", |
| 25 "$mojom_generator_script", | 25 "$mojom_generator_script", |
| 26 ] | 26 ] |
| 27 | 27 |
| 28 _bindings_configuration_files = [ |
| 29 "//mojo/public/tools/bindings/chromium_bindings_configuration.gni", |
| 30 "//mojo/public/tools/bindings/blink_bindings_configuration.gni", |
| 31 ] |
| 32 _bindings_configurations = [] |
| 33 foreach(config_file, _bindings_configuration_files) { |
| 34 _bindings_configurations += [ read_file(config_file, "scope") ] |
| 35 } |
| 36 |
| 28 # Generate C++/JavaScript/Java source files from mojom files. The output files | 37 # Generate C++/JavaScript/Java source files from mojom files. The output files |
| 29 # will go under the generated file directory tree with the same path as each | 38 # will go under the generated file directory tree with the same path as each |
| 30 # input file. | 39 # input file. |
| 31 # | 40 # |
| 32 # Parameters: | 41 # Parameters: |
| 33 # | 42 # |
| 34 # sources (optional if one of the deps sets listed below is present) | 43 # sources (optional if one of the deps sets listed below is present) |
| 35 # List of source .mojom files to compile. | 44 # List of source .mojom files to compile. |
| 36 # | 45 # |
| 37 # deps (optional) | 46 # deps (optional) |
| 38 # Note: this can contain only other mojom targets. | 47 # Note: this can contain only other mojom targets. |
| 39 # | 48 # |
| 40 # DEPRECATED: This is synonymous with public_deps because all mojom | 49 # DEPRECATED: This is synonymous with public_deps because all mojom |
| 41 # dependencies must be public by design. Please use public_deps. | 50 # dependencies must be public by design. Please use public_deps. |
| 42 # | 51 # |
| 43 # public_deps (optional) | 52 # public_deps (optional) |
| 44 # Note: this can contain only other mojom targets. | 53 # Note: this can contain only other mojom targets. |
| 45 # | 54 # |
| 46 # import_dirs (optional) | 55 # import_dirs (optional) |
| 47 # List of import directories that will get added when processing sources. | 56 # List of import directories that will get added when processing sources. |
| 48 # | 57 # |
| 49 # typemaps (optional) | |
| 50 # A list of typemap files to apply during bindings generation. | |
| 51 # | |
| 52 # typemap_deps (optional) | |
| 53 # A list of public dependencies needed to support active typemaps. | |
| 54 # | |
| 55 # variant (optional) | |
| 56 # A variant name to apply to generated bindings. Variant influences | |
| 57 # generated source filenames as wells the symbols they define. | |
| 58 # | |
| 59 # testonly (optional) | 58 # testonly (optional) |
| 60 # | 59 # |
| 61 # visibility (optional) | 60 # visibility (optional) |
| 62 # | |
| 63 # for_blink (optional, C++ only) | |
| 64 # Use WTF types as generated type for mojo string/array/map. | |
| 65 template("mojom") { | 61 template("mojom") { |
| 66 assert( | 62 assert( |
| 67 defined(invoker.sources) || defined(invoker.deps) || | 63 defined(invoker.sources) || defined(invoker.deps) || |
| 68 defined(invoker.public_deps), | 64 defined(invoker.public_deps), |
| 69 "\"sources\" or \"deps\" must be defined for the $target_name template.") | 65 "\"sources\" or \"deps\" must be defined for the $target_name template.") |
| 70 | 66 |
| 71 cpp_sources_suffix = "cpp_sources" | |
| 72 cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}" | |
| 73 cpp_only = false | |
| 74 if (defined(invoker.sources)) { | |
| 75 if (defined(invoker.variant)) { | |
| 76 variant = invoker.variant | |
| 77 cpp_only = true | |
| 78 generator_cpp_outputs = [ | |
| 79 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.cc", | |
| 80 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.h", | |
| 81 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}-internal.h", | |
| 82 ] | |
| 83 } else { | |
| 84 generator_cpp_outputs = [ | |
| 85 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", | |
| 86 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", | |
| 87 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", | |
| 88 ] | |
| 89 } | |
| 90 } | |
| 91 | |
| 92 if (cpp_only) { | |
| 93 generator_js_outputs = [] | |
| 94 generator_java_outputs = [] | |
| 95 } else { | |
| 96 generator_js_outputs = | |
| 97 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] | |
| 98 generator_java_outputs = | |
| 99 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] | |
| 100 } | |
| 101 | |
| 102 if (defined(invoker.sources)) { | |
| 103 generator_target_name = target_name + "__generator" | |
| 104 action_foreach(generator_target_name) { | |
| 105 script = mojom_generator_script | |
| 106 inputs = mojom_generator_sources | |
| 107 sources = invoker.sources | |
| 108 deps = [ | |
| 109 "//mojo/public/tools/bindings:precompile_templates", | |
| 110 ] | |
| 111 outputs = | |
| 112 generator_cpp_outputs + generator_java_outputs + generator_js_outputs | |
| 113 args = [ | |
| 114 "--use_bundled_pylibs", | |
| 115 "generate", | |
| 116 "{{source}}", | |
| 117 "-d", | |
| 118 rebase_path("//", root_build_dir), | |
| 119 "-I", | |
| 120 rebase_path("//", root_build_dir), | |
| 121 "-o", | |
| 122 rebase_path(root_gen_dir), | |
| 123 "--bytecode_path", | |
| 124 rebase_path("$root_gen_dir/mojo/public/tools/bindings"), | |
| 125 ] | |
| 126 | |
| 127 if (defined(invoker.import_dirs)) { | |
| 128 foreach(import_dir, invoker.import_dirs) { | |
| 129 args += [ | |
| 130 "-I", | |
| 131 rebase_path(import_dir, root_build_dir), | |
| 132 ] | |
| 133 } | |
| 134 } | |
| 135 | |
| 136 if (cpp_only) { | |
| 137 args += [ | |
| 138 "-g", | |
| 139 "c++", | |
| 140 ] | |
| 141 } else { | |
| 142 args += [ | |
| 143 "-g", | |
| 144 "c++,javascript,java", | |
| 145 ] | |
| 146 } | |
| 147 | |
| 148 if (defined(invoker.variant)) { | |
| 149 args += [ | |
| 150 "--variant", | |
| 151 invoker.variant, | |
| 152 ] | |
| 153 } | |
| 154 | |
| 155 if (defined(invoker.typemaps)) { | |
| 156 foreach(typemap, invoker.typemaps) { | |
| 157 args += [ | |
| 158 "--typemap", | |
| 159 rebase_path(typemap, root_build_dir), | |
| 160 ] | |
| 161 } | |
| 162 inputs += invoker.typemaps | |
| 163 } | |
| 164 | |
| 165 if (defined(invoker.for_blink) && invoker.for_blink) { | |
| 166 args += [ "--for_blink" ] | |
| 167 } | |
| 168 } | |
| 169 } | |
| 170 | |
| 171 source_set(target_name) { | |
| 172 if (defined(invoker.visibility)) { | |
| 173 visibility = invoker.visibility | |
| 174 } | |
| 175 if (defined(invoker.testonly)) { | |
| 176 testonly = invoker.testonly | |
| 177 } | |
| 178 if (defined(invoker.sources) && !defined(invoker.variant)) { | |
| 179 data = process_file_template(invoker.sources, generator_js_outputs) | |
| 180 } | |
| 181 | |
| 182 public_deps = [ | |
| 183 "//mojo/public/cpp/bindings", | |
| 184 ] | |
| 185 if (defined(invoker.sources)) { | |
| 186 public_deps += [ ":${cpp_sources_target_name}" ] | |
| 187 } | |
| 188 if (defined(invoker.deps)) { | |
| 189 public_deps += invoker.deps | |
| 190 } | |
| 191 if (defined(invoker.public_deps)) { | |
| 192 public_deps += invoker.public_deps | |
| 193 } | |
| 194 if (defined(invoker.typemap_deps)) { | |
| 195 public_deps += invoker.typemap_deps | |
| 196 } | |
| 197 | |
| 198 deps = [] | |
| 199 if (defined(invoker.sources)) { | |
| 200 public_deps += [ ":$generator_target_name" ] | |
| 201 } | |
| 202 } | |
| 203 | |
| 204 all_deps = [] | 67 all_deps = [] |
| 205 if (defined(invoker.deps)) { | 68 if (defined(invoker.deps)) { |
| 206 all_deps += invoker.deps | 69 all_deps += invoker.deps |
| 207 } | 70 } |
| 208 if (defined(invoker.public_deps)) { | 71 if (defined(invoker.public_deps)) { |
| 209 all_deps += invoker.public_deps | 72 all_deps += invoker.public_deps |
| 210 } | 73 } |
| 211 | 74 |
| 212 if (defined(invoker.variant)) { | 75 group("${target_name}__is_mojom") { |
| 213 variant_suffix = "of_variant_${invoker.variant}" | |
| 214 } else { | |
| 215 variant_suffix = "of_no_variant" | |
| 216 } | |
| 217 group("${target_name}__is_mojom_${variant_suffix}") { | |
| 218 } | 76 } |
| 219 | 77 |
| 220 # Explicitly ensure that all dependencies (invoker.deps and | 78 # Explicitly ensure that all dependencies (invoker.deps and |
| 221 # invoker.public_deps) are mojom targets of the same variant themselves. | 79 # invoker.public_deps) are mojom targets. |
| 222 group("${target_name}__check_deps_are_all_mojom_${variant_suffix}") { | 80 group("${target_name}__check_deps_are_all_mojom") { |
| 223 deps = [] | 81 deps = [] |
| 224 foreach(d, all_deps) { | 82 foreach(d, all_deps) { |
| 225 name = get_label_info(d, "label_no_toolchain") | 83 name = get_label_info(d, "label_no_toolchain") |
| 226 toolchain = get_label_info(d, "toolchain") | 84 toolchain = get_label_info(d, "toolchain") |
| 227 deps += [ "${name}__is_mojom_${variant_suffix}(${toolchain})" ] | 85 deps += [ "${name}__is_mojom(${toolchain})" ] |
| 228 } | 86 } |
| 229 } | 87 } |
| 230 | 88 |
| 231 if (defined(invoker.sources)) { | 89 foreach(bindings_configuration, _bindings_configurations) { |
| 90 cpp_only = false |
| 91 variant_suffix = "" |
| 92 if (defined(bindings_configuration.variant)) { |
| 93 variant = bindings_configuration.variant |
| 94 variant_suffix = "_${variant}" |
| 95 cpp_only = true |
| 96 } |
| 97 type_mappings_target_name = "${target_name}${variant_suffix}__type_mappings" |
| 98 type_mappings_path = |
| 99 "$target_gen_dir/${target_name}${variant_suffix}__type_mappings" |
| 100 active_typemaps = [] |
| 101 cpp_sources_suffix = "cpp_sources" |
| 102 cpp_sources_target_name = |
| 103 "${target_name}${variant_suffix}_${cpp_sources_suffix}" |
| 104 enabled_sources = [] |
| 105 if (defined(invoker.sources)) { |
| 106 generator_cpp_outputs = [] |
| 107 generator_js_outputs = [] |
| 108 generator_java_outputs = [] |
| 109 variant_dash_suffix = "" |
| 110 if (defined(variant)) { |
| 111 variant_dash_suffix = "-${variant}" |
| 112 } |
| 113 generator_cpp_outputs += [ |
| 114 "{{source_gen_dir}}/{{source_name_part}}.mojom${variant_dash_suffix}.cc"
, |
| 115 "{{source_gen_dir}}/{{source_name_part}}.mojom${variant_dash_suffix}.h", |
| 116 "{{source_gen_dir}}/{{source_name_part}}.mojom${variant_dash_suffix}-int
ernal.h", |
| 117 ] |
| 118 enabled_sources = [] |
| 119 if (defined(bindings_configuration.blacklist)) { |
| 120 foreach(source, invoker.sources) { |
| 121 blacklisted = false |
| 122 foreach(blacklisted_source, bindings_configuration.blacklist) { |
| 123 if (get_path_info(source, "abspath") == blacklisted_source) { |
| 124 blacklisted = true |
| 125 } |
| 126 } |
| 127 if (!blacklisted) { |
| 128 enabled_sources += [ source ] |
| 129 } |
| 130 } |
| 131 } else { |
| 132 enabled_sources = invoker.sources |
| 133 } |
| 134 foreach(source, enabled_sources) { |
| 135 # TODO(sammc): Use a map instead of a linear scan when GN supports maps. |
| 136 foreach(typemap, bindings_configuration.typemaps) { |
| 137 if (get_path_info(source, "abspath") == typemap.mojom) { |
| 138 active_typemaps += [ typemap ] |
| 139 } |
| 140 } |
| 141 } |
| 142 |
| 143 if (!cpp_only) { |
| 144 generator_js_outputs = |
| 145 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] |
| 146 generator_java_outputs = |
| 147 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] |
| 148 } |
| 149 generator_target_name = "${target_name}${variant_suffix}__generator" |
| 150 action_foreach(generator_target_name) { |
| 151 script = mojom_generator_script |
| 152 inputs = mojom_generator_sources |
| 153 sources = invoker.sources |
| 154 deps = [ |
| 155 ":$type_mappings_target_name", |
| 156 "//mojo/public/tools/bindings:precompile_templates", |
| 157 ] |
| 158 outputs = generator_cpp_outputs + generator_java_outputs + |
| 159 generator_js_outputs |
| 160 args = [ |
| 161 "--use_bundled_pylibs", |
| 162 "generate", |
| 163 "{{source}}", |
| 164 "-d", |
| 165 rebase_path("//", root_build_dir), |
| 166 "-I", |
| 167 rebase_path("//", root_build_dir), |
| 168 "-o", |
| 169 rebase_path(root_gen_dir), |
| 170 "--bytecode_path", |
| 171 rebase_path("$root_gen_dir/mojo/public/tools/bindings"), |
| 172 ] |
| 173 |
| 174 if (defined(invoker.import_dirs)) { |
| 175 foreach(import_dir, invoker.import_dirs) { |
| 176 args += [ |
| 177 "-I", |
| 178 rebase_path(import_dir, root_build_dir), |
| 179 ] |
| 180 } |
| 181 } |
| 182 |
| 183 if (cpp_only) { |
| 184 args += [ |
| 185 "-g", |
| 186 "c++", |
| 187 ] |
| 188 } else { |
| 189 args += [ |
| 190 "-g", |
| 191 "c++,javascript,java", |
| 192 ] |
| 193 } |
| 194 |
| 195 if (defined(bindings_configuration.variant)) { |
| 196 args += [ |
| 197 "--variant", |
| 198 bindings_configuration.variant, |
| 199 ] |
| 200 } |
| 201 |
| 202 args += [ |
| 203 "--typemap", |
| 204 rebase_path(type_mappings_path, root_build_dir), |
| 205 ] |
| 206 |
| 207 if (defined(bindings_configuration.for_blink) && |
| 208 bindings_configuration.for_blink) { |
| 209 args += [ "--for_blink" ] |
| 210 } |
| 211 } |
| 212 } |
| 213 |
| 214 action(type_mappings_target_name) { |
| 215 outputs = [ |
| 216 type_mappings_path, |
| 217 ] |
| 218 script = "$mojom_generator_root/generate_type_mappings.py" |
| 219 deps = [] |
| 220 args = [ |
| 221 "--output", |
| 222 rebase_path(type_mappings_path, root_build_dir), |
| 223 ] |
| 224 |
| 225 foreach(d, all_deps) { |
| 226 name = get_label_info(d, "label_no_toolchain") |
| 227 toolchain = get_label_info(d, "toolchain") |
| 228 dependency_output = "${name}${variant_suffix}__type_mappings" |
| 229 dependency_target = "${dependency_output}(${toolchain})" |
| 230 deps += [ dependency_target ] |
| 231 dependency_output_dir = |
| 232 get_label_info(dependency_output, "target_gen_dir") |
| 233 dependency_name = get_label_info(dependency_output, "name") |
| 234 dependency_path = |
| 235 rebase_path("$dependency_output_dir/${dependency_name}", |
| 236 root_build_dir) |
| 237 args += [ |
| 238 "--dependency", |
| 239 dependency_path, |
| 240 ] |
| 241 } |
| 242 |
| 243 if (enabled_sources != []) { |
| 244 # TODO(sammc): Pass the typemap description in a file to avoid command |
| 245 # line length limitations. |
| 246 typemap_description = [] |
| 247 foreach(typemap, active_typemaps) { |
| 248 typemap_description += [ "--start-typemap" ] |
| 249 if (defined(typemap.public_headers)) { |
| 250 foreach(value, typemap.public_headers) { |
| 251 typemap_description += [ "public_headers=$value" ] |
| 252 } |
| 253 } |
| 254 if (defined(typemap.traits_headers)) { |
| 255 foreach(value, typemap.traits_headers) { |
| 256 typemap_description += [ "traits_headers=$value" ] |
| 257 } |
| 258 } |
| 259 foreach(value, typemap.type_mappings) { |
| 260 typemap_description += [ "type_mappings=$value" ] |
| 261 } |
| 262 } |
| 263 args += typemap_description |
| 264 } |
| 265 } |
| 266 |
| 267 source_set("${target_name}${variant_suffix}") { |
| 268 if (defined(invoker.visibility)) { |
| 269 visibility = invoker.visibility |
| 270 } |
| 271 if (defined(invoker.testonly)) { |
| 272 testonly = invoker.testonly |
| 273 } |
| 274 if (defined(invoker.sources) && !defined(bindings_configuration.variant))
{ |
| 275 data = process_file_template(enabled_sources, generator_js_outputs) |
| 276 } |
| 277 |
| 278 public_deps = [ |
| 279 ":${cpp_sources_target_name}", |
| 280 "//mojo/public/cpp/bindings", |
| 281 ] |
| 282 if (defined(invoker.deps)) { |
| 283 public_deps += invoker.deps |
| 284 } |
| 285 if (defined(invoker.public_deps)) { |
| 286 public_deps += invoker.public_deps |
| 287 } |
| 288 |
| 289 deps = [] |
| 290 if (defined(invoker.sources)) { |
| 291 public_deps += [ ":$generator_target_name" ] |
| 292 } |
| 293 } |
| 294 |
| 232 # The generated C++ source files. The main reason to introduce this target | 295 # The generated C++ source files. The main reason to introduce this target |
| 233 # is so that mojo/public/cpp/bindings can depend on mojom interfaces without | 296 # is so that mojo/public/cpp/bindings can depend on mojom interfaces without |
| 234 # circular dependencies. It means that the target is missing the dependency | 297 # circular dependencies. It means that the target is missing the dependency |
| 235 # on mojo/public/cpp/bindings. No external targets should depend directly on | 298 # on mojo/public/cpp/bindings. No external targets should depend directly on |
| 236 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources | 299 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources |
| 237 # targets. | 300 # targets. |
| 238 source_set(cpp_sources_target_name) { | 301 source_set(cpp_sources_target_name) { |
| 239 if (defined(invoker.testonly)) { | 302 if (defined(invoker.testonly)) { |
| 240 testonly = invoker.testonly | 303 testonly = invoker.testonly |
| 241 } | 304 } |
| 242 sources = process_file_template(invoker.sources, generator_cpp_outputs) | 305 if (enabled_sources != []) { |
| 306 sources = process_file_template(enabled_sources, generator_cpp_outputs) |
| 307 } |
| 243 deps = [ | 308 deps = [ |
| 244 ":$generator_target_name", | 309 "//mojo/public/cpp/bindings:struct_traits", |
| 245 "//mojo/public/interfaces/bindings:bindings__generator", | 310 "//mojo/public/interfaces/bindings:bindings__generator", |
| 246 ] | 311 ] |
| 312 if (enabled_sources != []) { |
| 313 deps += [ ":$generator_target_name" ] |
| 314 } |
| 247 public_deps = [ | 315 public_deps = [ |
| 248 "//base", | 316 "//base", |
| 249 ] | 317 ] |
| 250 if (defined(invoker.typemap_deps)) { | |
| 251 public_deps += invoker.typemap_deps | |
| 252 } | |
| 253 foreach(d, all_deps) { | 318 foreach(d, all_deps) { |
| 254 # Resolve the name, so that a target //mojo/something becomes | 319 # Resolve the name, so that a target //mojo/something becomes |
| 255 # //mojo/something:something and we can append cpp_sources_suffix to | 320 # //mojo/something:something and we can append cpp_sources_suffix to |
| 256 # get the cpp dependency name. | 321 # get the cpp dependency name. |
| 257 full_name = get_label_info(d, "label_no_toolchain") | 322 full_name = get_label_info("$d", "label_no_toolchain") |
| 258 deps += [ "${full_name}_${cpp_sources_suffix}" ] | 323 deps += [ "${full_name}${variant_suffix}_${cpp_sources_suffix}" ] |
| 259 } | 324 } |
| 260 if (defined(invoker.for_blink) && invoker.for_blink) { | 325 foreach(typemap, active_typemaps) { |
| 326 if (defined(typemap.public_headers)) { |
| 327 sources += typemap.public_headers |
| 328 } |
| 329 if (defined(typemap.traits_headers)) { |
| 330 sources += typemap.traits_headers |
| 331 } |
| 332 if (defined(typemap.sources)) { |
| 333 sources += typemap.sources |
| 334 } |
| 335 if (defined(typemap.deps)) { |
| 336 deps += typemap.deps |
| 337 } |
| 338 } |
| 339 if (defined(bindings_configuration.for_blink) && |
| 340 bindings_configuration.for_blink) { |
| 261 public_deps += [ "//mojo/public/cpp/bindings:wtf_support" ] | 341 public_deps += [ "//mojo/public/cpp/bindings:wtf_support" ] |
| 262 } | 342 } |
| 263 } | 343 } |
| 264 } | |
| 265 | 344 |
| 266 if (is_android && !cpp_only) { | 345 if (!cpp_only && is_android) { |
| 267 import("//build/config/android/rules.gni") | 346 import("//build/config/android/rules.gni") |
| 268 | 347 |
| 269 java_srcjar_target_name = target_name + "_java_sources" | 348 java_srcjar_target_name = target_name + "_java_sources" |
| 270 action(java_srcjar_target_name) { | 349 action(java_srcjar_target_name) { |
| 271 script = "//mojo/public/tools/gn/zip.py" | 350 script = "//mojo/public/tools/gn/zip.py" |
| 272 inputs = process_file_template(invoker.sources, generator_java_outputs) | 351 inputs = [] |
| 273 output = "$target_gen_dir/$target_name.srcjar" | 352 if (enabled_sources != []) { |
| 274 outputs = [ | 353 inputs = |
| 275 output, | 354 process_file_template(enabled_sources, generator_java_outputs) |
| 276 ] | 355 } |
| 277 rebase_inputs = rebase_path(inputs, root_build_dir) | 356 output = "$target_gen_dir/$target_name.srcjar" |
| 278 rebase_output = rebase_path(output, root_build_dir) | 357 outputs = [ |
| 279 args = [ | 358 output, |
| 280 "--zip-inputs=$rebase_inputs", | 359 ] |
| 281 "--output=$rebase_output", | 360 rebase_inputs = rebase_path(inputs, root_build_dir) |
| 282 ] | 361 rebase_output = rebase_path(output, root_build_dir) |
| 283 deps = [ | 362 args = [ |
| 284 ":$generator_target_name", | 363 "--zip-inputs=$rebase_inputs", |
| 285 ] | 364 "--output=$rebase_output", |
| 286 } | 365 ] |
| 287 | 366 deps = [] |
| 288 java_target_name = target_name + "_java" | 367 if (enabled_sources != []) { |
| 289 android_library(java_target_name) { | 368 deps = [ |
| 290 deps = [ | 369 ":$generator_target_name", |
| 291 "//base:base_java", | 370 ] |
| 292 "//mojo/public/java:bindings", | 371 } |
| 293 "//mojo/public/java:system", | |
| 294 ] | |
| 295 | |
| 296 foreach(d, all_deps) { | |
| 297 # Resolve the name, so that a target //mojo/something becomes | |
| 298 # //mojo/something:something and we can append "_java" to get the java | |
| 299 # dependency name. | |
| 300 full_name = get_label_info(d, "label_no_toolchain") | |
| 301 deps += [ "${full_name}_java" ] | |
| 302 } | 372 } |
| 303 | 373 |
| 304 srcjar_deps = [ ":$java_srcjar_target_name" ] | 374 java_target_name = target_name + "_java" |
| 375 android_library(java_target_name) { |
| 376 deps = [ |
| 377 "//base:base_java", |
| 378 "//mojo/public/java:bindings", |
| 379 "//mojo/public/java:system", |
| 380 ] |
| 381 |
| 382 foreach(d, all_deps) { |
| 383 # Resolve the name, so that a target //mojo/something becomes |
| 384 # //mojo/something:something and we can append "_java" to get the java |
| 385 # dependency name. |
| 386 full_name = get_label_info(d, "label_no_toolchain") |
| 387 deps += [ "${full_name}_java" ] |
| 388 } |
| 389 |
| 390 srcjar_deps = [ ":$java_srcjar_target_name" ] |
| 391 } |
| 305 } | 392 } |
| 306 } | 393 } |
| 307 } | 394 } |
| OLD | NEW |