[proto_library.gni] Add import_protobuf_full parameter
Currently several users of this GN template set
`import_dirs = [ "//third_party/protobuf/src" ]`.
This prevents us from moving the location of the protobuf src dir,
which is needed for the attached bug.
So the plan is to:
1. Introduce this parameter
2. Change all instances of
`import_dirs = [ "//third_party/protobuf/src" ]` to
`import_protobuf_full = true`.
3. Proceed with moving the src dir as needed.
Bug: 59636
Change-Id: Ice82b6412ef9dcb3c54c48395832f13e04f30a8c
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/protobuf/+/472297
Reviewed-by: Zach Bush <zmbush@google.com>
diff --git a/proto_library.gni b/proto_library.gni
index 9fb1aa2..f1f15bf 100644
--- a/proto_library.gni
+++ b/proto_library.gni
@@ -65,10 +65,14 @@
# deps (optional)
# Additional dependencies.
#
-# use_protobuf_full (optional)
+# use_protobuf_full (optional, default false)
# If adding protobuf library would be required, adds protobuf_full to deps
# instead of protobuf_lite.
#
+# import_protobuf_full (optional, default false)
+# Allows .proto files to import .proto files from protobuf_full, without
+# adding a dependency on all the C++ code in that library.
+#
# import_dirs (optional)
# A list of extra import directories to be passed to protoc compiler. The
# default case is just proto_in_dir.
@@ -326,7 +330,9 @@
}
}
- if (defined(invoker.use_protobuf_full)) {
+ if ((defined(invoker.use_protobuf_full) && invoker.use_protobuf_full) ||
+ (defined(invoker.import_protobuf_full) &&
+ invoker.import_protobuf_full)) {
args += [ "--import-dir=" +
rebase_path("//third_party/protobuf/src", root_build_dir) ]
}