[protobuf] Make proto_library gn configs path independent
For V8 to switch to Chrome's protobuf also in V8's stand-alone checkout, we need to store protobof under a different path than in Chrome (because of crbug.com/338008085). To make the gn configs work also under another location, this change removes hard-coded references to the location of protobuf within protobuf and instead computes them dynamically when the gn script is included. Bug: 337736622 Change-Id: Id466b71977f22f060375839ee25b140c3670f576 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5508496 Reviewed-by: Tommy Nyquist <nyquist@chromium.org> Commit-Queue: Michael Achenbach <machenbach@chromium.org> Reviewed-by: Peter Boström <pbos@chromium.org> Reviewed-by: Leonard Grey <lgrey@chromium.org> Cr-Commit-Position: refs/heads/main@{#1295963}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4cc51eb385
commit
048301eab0
21
third_party/protobuf/proto_library.gni
vendored
21
third_party/protobuf/proto_library.gni
vendored
@@ -157,7 +157,14 @@ if (host_os == "win") {
|
|||||||
_host_executable_suffix = ""
|
_host_executable_suffix = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
_protoc_label = "//third_party/protobuf:protoc($host_toolchain)"
|
# TODO(https://crbug.com/337736622): V8 shares this dependency and stores
|
||||||
|
# it in a different location. Hence, all references to this folder should
|
||||||
|
# use this variable instead of hard-coding //third_party/protobuf.
|
||||||
|
# This can be switched back to //third_party/protobuf in M129, or earlier in
|
||||||
|
# case crbug.com/338008085 is resolved.
|
||||||
|
_this_dir = get_path_info(".", "abspath")
|
||||||
|
|
||||||
|
_protoc_label = "$_this_dir:protoc($host_toolchain)"
|
||||||
_protoc_path = get_label_info(_protoc_label, "root_out_dir") + "/protoc" +
|
_protoc_path = get_label_info(_protoc_label, "root_out_dir") + "/protoc" +
|
||||||
_host_executable_suffix
|
_host_executable_suffix
|
||||||
_protoc_gen_js_label =
|
_protoc_gen_js_label =
|
||||||
@@ -529,7 +536,7 @@ template("proto_library") {
|
|||||||
|
|
||||||
sources = protogens_js
|
sources = protogens_js
|
||||||
|
|
||||||
deps = [ "//third_party/protobuf:js_proto" ]
|
deps = [ "$_this_dir:js_proto" ]
|
||||||
|
|
||||||
extra_deps = [ ":$action_name" ]
|
extra_deps = [ ":$action_name" ]
|
||||||
}
|
}
|
||||||
@@ -563,8 +570,8 @@ template("proto_library") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public_configs = [
|
public_configs = [
|
||||||
"//third_party/protobuf:using_proto",
|
"$_this_dir:using_proto",
|
||||||
"//third_party/protobuf:allow_deprecated_proto_fields",
|
"$_this_dir:allow_deprecated_proto_fields",
|
||||||
]
|
]
|
||||||
public_deps = []
|
public_deps = []
|
||||||
|
|
||||||
@@ -592,9 +599,9 @@ template("proto_library") {
|
|||||||
if (generate_cc) {
|
if (generate_cc) {
|
||||||
if (defined(invoker.use_protobuf_full) &&
|
if (defined(invoker.use_protobuf_full) &&
|
||||||
invoker.use_protobuf_full == true) {
|
invoker.use_protobuf_full == true) {
|
||||||
public_deps += [ "//third_party/protobuf:protobuf_full" ]
|
public_deps += [ "$_this_dir:protobuf_full" ]
|
||||||
} else {
|
} else {
|
||||||
public_deps += [ "//third_party/protobuf:protobuf_lite" ]
|
public_deps += [ "$_this_dir:protobuf_lite" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
@@ -627,7 +634,7 @@ template("proto_library") {
|
|||||||
data = protogens_py
|
data = protogens_py
|
||||||
deps = [
|
deps = [
|
||||||
":$action_name",
|
":$action_name",
|
||||||
"//third_party/protobuf:py_proto_runtime",
|
"$_this_dir:py_proto_runtime",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user