Description: avoid not-in-Debian crate protox
 This essentially reverts upstream git commit 6d93c1d.
Author: Jonas Smedegaard <dr@jones.dk>
Forwarded: not-needed
Last-Update: 2025-03-15
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -211,7 +211,8 @@
 When making changes to `tonic-build` that affects the generated code you will
 need to ensure that each of the sub crates gets updated as well. Each of the sub
 crates like, for example `tonic-health`, generate their gRPC code via `codegen`
-crate.
+crate. This requires `Protocol Buffers Compiler` of which version is same as the
+one used in the GitHub Action (see [`codegen` job](./.github/workflows/CI.yml)).
 
 ```
 cargo run --package codegen
--- a/codegen/Cargo.toml
+++ b/codegen/Cargo.toml
@@ -8,5 +8,4 @@
 
 [dependencies]
 tempfile = "3.8.0"
-protox = "0.7"
 tonic-build = {path = "../tonic-build", default-features = false, features = ["prost", "cleanup-markdown"]}
--- a/codegen/src/main.rs
+++ b/codegen/src/main.rs
@@ -1,11 +1,4 @@
-use std::{
-    fs::File,
-    io::{BufWriter, Write as _},
-    path::{Path, PathBuf},
-};
-
-use protox::prost::{bytes::BytesMut, Message as _};
-use tonic_build::FileDescriptorSet;
+use std::path::{Path, PathBuf};
 
 fn main() {
     // tonic-health
@@ -89,15 +82,12 @@
     let out_dir = root_dir.join(out_dir);
     let file_descriptor_set_path = root_dir.join(file_descriptor_set_path);
 
-    let fds = protox::compile(&iface_files, &include_dirs).unwrap();
-
-    write_fds(&fds, &file_descriptor_set_path);
-
     tonic_build::configure()
         .build_client(build_client)
         .build_server(build_server)
         .out_dir(&tempdir)
-        .compile_fds(fds)
+        .file_descriptor_set_path(file_descriptor_set_path)
+        .compile_protos(&iface_files, &include_dirs)
         .unwrap();
 
     for path in std::fs::read_dir(tempdir.path()).unwrap() {
@@ -115,10 +105,3 @@
         std::fs::copy(&path, &to).unwrap();
     }
 }
-
-fn write_fds(fds: &FileDescriptorSet, path: &Path) {
-    let mut writer = BufWriter::new(File::create(path).unwrap());
-    let mut buf = BytesMut::with_capacity(fds.encoded_len());
-    fds.encode(&mut buf).unwrap();
-    writer.write_all(&buf).unwrap();
-}
