Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(992)

Unified Diff: mojo/public/tools/bindings/mojom.gni

Issue 1635613002: [mojo-bindings] Support reuse of native enum classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not generate validators for native-only enums Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/mojom.gni
diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni
index 9cd72173a0aa9d7fc8728028eb34f96aa8e42b72..c33ca52a7f1e4f361e14f09685da898d42650d26 100644
--- a/mojo/public/tools/bindings/mojom.gni
+++ b/mojo/public/tools/bindings/mojom.gni
@@ -51,10 +51,17 @@ mojom_generator_sources = [
# typemaps (optional)
# A list of typemap files to apply during bindings generation.
#
+# typemap_deps (optional)
+# A list of public dependencies needed to support active typemaps.
+#
# variant (optional)
# A variant name to apply to generated bindings. Variant influences
# generated source filenames as wells the symbols they define.
#
+# cpp_only (optional)
+# If true, only C++ bindings will be generated. This defaults to false
+# unless |variant| is specified.
+#
# testonly (optional)
#
# visibility (optional)
@@ -66,29 +73,38 @@ template("mojom") {
cpp_sources_suffix = "cpp_sources"
cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}"
+ cpp_only = false
+ if (defined(invoker.cpp_only)) {
+ cpp_only = invoker.cpp_only
+ }
if (defined(invoker.sources)) {
if (defined(invoker.variant)) {
variant = invoker.variant
+ cpp_only = true
generator_cpp_outputs = [
"{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.cc",
"{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.h",
"{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}-internal.h",
]
- generator_js_outputs = []
- generator_java_outputs = []
} else {
generator_cpp_outputs = [
"{{source_gen_dir}}/{{source_name_part}}.mojom.cc",
"{{source_gen_dir}}/{{source_name_part}}.mojom.h",
"{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h",
]
- generator_js_outputs =
- [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ]
- generator_java_outputs =
- [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ]
}
}
+ if (cpp_only) {
+ generator_js_outputs = []
+ generator_java_outputs = []
+ } else {
+ generator_js_outputs =
+ [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ]
+ generator_java_outputs =
+ [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ]
+ }
+
if (defined(invoker.sources)) {
generator_target_name = target_name + "__generator"
action_foreach(generator_target_name) {
@@ -123,10 +139,8 @@ template("mojom") {
}
}
- if (defined(invoker.variant)) {
+ if (cpp_only) {
args += [
- "--variant",
- invoker.variant,
"-g",
"c++",
]
@@ -137,6 +151,13 @@ template("mojom") {
]
}
+ if (defined(invoker.variant)) {
+ args += [
+ "--variant",
+ invoker.variant,
+ ]
+ }
+
if (defined(invoker.typemaps)) {
foreach(typemap, invoker.typemaps) {
args += [
@@ -168,6 +189,9 @@ template("mojom") {
if (defined(invoker.public_deps)) {
public_deps += invoker.public_deps
}
+ if (defined(invoker.typemap_deps)) {
+ public_deps += invoker.typemap_deps
+ }
deps = []
if (defined(invoker.sources)) {
@@ -214,9 +238,14 @@ template("mojom") {
sources = process_file_template(invoker.sources, generator_cpp_outputs)
deps = [
":$generator_target_name",
- "//base",
"//mojo/public/interfaces/bindings:bindings__generator",
]
+ public_deps = [
+ "//base",
+ ]
+ if (defined(invoker.typemap_deps)) {
+ public_deps += invoker.typemap_deps
+ }
foreach(d, all_deps) {
# Resolve the name, so that a target //mojo/something becomes
# //mojo/something:something and we can append cpp_sources_suffix to

Powered by Google App Engine
This is Rietveld 408576698