Skip to content

Commit 353dbae

Browse files
fix: Broken release build for Hipcheck.
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]>
1 parent 34e04af commit 353dbae

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

hipcheck/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ edition = "2021"
1111
license = "Apache-2.0"
1212
homepage = "https://mitre.github.io/hipcheck"
1313
repository = "https://github.com/mitre/hipcheck"
14-
include = ["src/**/*", "../LICENSE", "../README.md", "build.rs"]
14+
include = ["src/**", "../LICENSE", "../README.md", "build.rs", "proto/**"]
1515

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

143143
anyhow = "1.0.86"
144+
pathbuf = "1.0.0"
144145
tonic-build = "0.12.1"
145146
which = { version = "6.0.3", default-features = false }
146147

hipcheck/build.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// SPDX-License-Identifier: Apache-2.0
22

3-
fn main() -> anyhow::Result<()> {
4-
tonic_build::compile_protos("../proto/hipcheck/v1/hipcheck.proto")?;
3+
use anyhow::Result;
4+
use pathbuf::pathbuf;
5+
use tonic_build::compile_protos;
6+
7+
fn main() -> Result<()> {
8+
let root = env!("CARGO_MANIFEST_DIR");
9+
let path = pathbuf![root, "proto", "hipcheck", "v1", "hipcheck.proto"];
10+
compile_protos(path)?;
511
Ok(())
612
}

plugins/dummy_rand_data/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22

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

plugins/dummy_sha256/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22

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

0 commit comments

Comments
 (0)