Skip to content

Commit

Permalink
fix: Broken release build for Hipcheck.
Browse files Browse the repository at this point in the history
Turns out Cargo doesn't like when materials required to build a crate are
outside of the crate manifest directory. In this case, I'm talking about
the protobuf definition used for the Hipcheck plugin gRPC service.

There's a Cargo issue open about it, but the gist of it is that they
don't really want people doing what we were trying to do, having materials
in an outer directory.

There may be better solutions, but moving the files is the fastest one
for now.

Here's the issue: rust-lang/cargo#3946

Signed-off-by: Andrew Lilley Brinker <[email protected]>
  • Loading branch information
alilleybrinker committed Sep 3, 2024
1 parent 34e04af commit 353dbae
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion hipcheck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2021"
license = "Apache-2.0"
homepage = "https://mitre.github.io/hipcheck"
repository = "https://github.com/mitre/hipcheck"
include = ["src/**/*", "../LICENSE", "../README.md", "build.rs"]
include = ["src/**", "../LICENSE", "../README.md", "build.rs", "proto/**"]

# Rename the binary from the default "hipcheck" (based on the package name)
# to "hc".
Expand Down Expand Up @@ -141,6 +141,7 @@ zstd = "0.13.2"
[build-dependencies]

anyhow = "1.0.86"
pathbuf = "1.0.0"
tonic-build = "0.12.1"
which = { version = "6.0.3", default-features = false }

Expand Down
10 changes: 8 additions & 2 deletions hipcheck/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// SPDX-License-Identifier: Apache-2.0

fn main() -> anyhow::Result<()> {
tonic_build::compile_protos("../proto/hipcheck/v1/hipcheck.proto")?;
use anyhow::Result;
use pathbuf::pathbuf;
use tonic_build::compile_protos;

fn main() -> Result<()> {
let root = env!("CARGO_MANIFEST_DIR");
let path = pathbuf![root, "proto", "hipcheck", "v1", "hipcheck.proto"];
compile_protos(path)?;
Ok(())
}
File renamed without changes.
2 changes: 1 addition & 1 deletion plugins/dummy_rand_data/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0

fn main() -> anyhow::Result<()> {
tonic_build::compile_protos("../../proto/hipcheck/v1/hipcheck.proto")?;
tonic_build::compile_protos("../../hipcheck/proto/hipcheck/v1/hipcheck.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion plugins/dummy_sha256/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0

fn main() -> anyhow::Result<()> {
tonic_build::compile_protos("../../proto/hipcheck/v1/hipcheck.proto")?;
tonic_build::compile_protos("../../hipcheck/proto/hipcheck/v1/hipcheck.proto")?;
Ok(())
}

0 comments on commit 353dbae

Please sign in to comment.