Skip to content

Commit

Permalink
chore: Move third-party proto files into their own module (#20556)
Browse files Browse the repository at this point in the history
* chore: Move third-party proto files into their own module

To avoid cyclical dependencies between lib/vector-core/proto and proto/

Signed-off-by: Jesse Szwedko <[email protected]>

* Fix vector-core build.rs

Signed-off-by: Jesse Szwedko <[email protected]>

* Fix prometheus-parser build.rs too

Signed-off-by: Jesse Szwedko <[email protected]>

* loki too

Signed-off-by: Jesse Szwedko <[email protected]>

---------

Signed-off-by: Jesse Szwedko <[email protected]>
  • Loading branch information
jszwedko authored May 24, 2024
1 parent 5abaa32 commit 378f3b0
Show file tree
Hide file tree
Showing 26 changed files with 34 additions and 19 deletions.
3 changes: 2 additions & 1 deletion buf.work.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version: v1
directories:
- proto
- proto/third-party
- proto/vector
- lib/vector-core/proto
34 changes: 19 additions & 15 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ fn main() {

#[cfg(feature = "protobuf-build")]
{
println!("cargo:rerun-if-changed=proto/dd_trace.proto");
println!("cargo:rerun-if-changed=proto/dnstap.proto");
println!("cargo:rerun-if-changed=proto/ddsketch_full.proto");
println!("cargo:rerun-if-changed=proto/dd_metric.proto");
println!("cargo:rerun-if-changed=proto/google/pubsub/v1/pubsub.proto");
println!("cargo:rerun-if-changed=proto/google/rpc/status.proto");
println!("cargo:rerun-if-changed=proto/vector.proto");
println!("cargo:rerun-if-changed=proto/third-party/dnstap.proto");
println!("cargo:rerun-if-changed=proto/third-party/google/pubsub/v1/pubsub.proto");
println!("cargo:rerun-if-changed=proto/third-party/google/rpc/status.proto");
println!("cargo:rerun-if-changed=proto/vector/dd_metric.proto");
println!("cargo:rerun-if-changed=proto/vector/dd_trace.proto");
println!("cargo:rerun-if-changed=proto/vector/ddsketch_full.proto");
println!("cargo:rerun-if-changed=proto/vector/vector.proto");

// Create and store the "file descriptor set" from the compiled Protocol Buffers packages.
//
Expand All @@ -144,15 +144,19 @@ fn main() {
prost_build,
&[
"lib/vector-core/proto/event.proto",
"proto/dnstap.proto",
"proto/ddsketch_full.proto",
"proto/dd_metric.proto",
"proto/dd_trace.proto",
"proto/google/pubsub/v1/pubsub.proto",
"proto/google/rpc/status.proto",
"proto/vector.proto",
"proto/third-party/dnstap.proto",
"proto/vector/ddsketch_full.proto",
"proto/vector/dd_metric.proto",
"proto/vector/dd_trace.proto",
"proto/third-party/google/pubsub/v1/pubsub.proto",
"proto/third-party/google/rpc/status.proto",
"proto/vector/vector.proto",
],
&[
"proto/third-party",
"proto/vector",
"lib/vector-core/proto/",
],
&["proto/", "lib/vector-core/proto/"],
)
.unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/loki-logproto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() -> Result<()> {
"proto/stats.proto",
"proto/logproto.proto",
],
&["proto", "../../proto"],
&["proto", "../../proto/third-party"],
)?;
Ok(())
}
2 changes: 1 addition & 1 deletion lib/prometheus-parser/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() {
prost_build
.compile_protos(
&["proto/prometheus-remote.proto"],
&["proto", "../../proto"],
&["proto", "../../proto/third-party"],
)
.unwrap();
}
5 changes: 4 additions & 1 deletion lib/vector-core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ fn main() {
.protoc_arg("--experimental_allow_proto3_optional")
.btree_map(["."])
.bytes(["raw_bytes"])
.compile_protos(&["proto/event.proto"], &["proto", "../../proto"])
.compile_protos(
&["proto/event.proto"],
&["proto", "../../proto/third-party", "../../proto/vector"],
)
.unwrap();
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions proto/vector/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 378f3b0

Please sign in to comment.