Commit 5ece5258 authored by Mohit Saini's avatar Mohit Saini Committed by V8 LUCI CQ

Add exclude_imports flag to proto_library

|exclude_imports| flag is set in some of the perfetto's proto_library
targets to indicate that we don't need to generate the proto-descriptor
for the protos included in those `x.proto` files. In this CL we use that
flag to conditionally pass `--include_imports` argument to protoc.

This is similar to the CL (https://crrev.com/c/2632759)

Bug: b:236945541
Change-Id: I0689003978096798d1e966ec8485cd6af7237804
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3721616Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Mohit Saini <mohitms@google.com>
Cr-Commit-Position: refs/heads/main@{#81356}
parent b20cd0e2
......@@ -76,6 +76,17 @@ template("proto_library") {
out_dir = "$root_gen_dir/" + proto_out_dir
rel_out_dir = rebase_path(out_dir, root_build_dir)
# exclude_imports is only used for generating the descriptor. Therefore, the
# check needs to be here to avoid complaints from GN about the unused
# variable.
if (generate_descriptor != "") {
if (defined(invoker.exclude_imports)) {
exclude_imports = invoker.exclude_imports
} else {
exclude_imports = false
}
}
# Prevent unused errors when generating descriptor only.
if (generate_descriptor != "") {
not_needed([ "rel_out_dir" ])
......@@ -163,8 +174,10 @@ template("proto_library") {
}
if (generate_descriptor != "") {
depfile = "$out_dir/$generate_descriptor.d"
if (!exclude_imports) {
args += [ "--include_imports" ]
}
args += [
"--include_imports",
"--descriptor_set_out",
rebase_path("$out_dir/$generate_descriptor", root_build_dir),
"--dependency_out",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment