Skip to content

Commit b7fd24b

Browse files
committed
chore(build): Provide friendly error when build fails due to git submodule being missing for protobuf services
Signed-off-by: Joshua Potts <[email protected]>
1 parent e8629db commit b7fd24b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

protobufs/build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@ use std::path::Path;
2828

2929
const DERIVE_EQ_HASH: &str = "#[derive(Eq, Hash)]";
3030
const DERIVE_EQ_HASH_COPY: &str = "#[derive(Copy, Eq, Hash)]";
31+
const SERVICES_FOLDER: &str = "./protobufs/services";
3132

3233
fn main() -> anyhow::Result<()> {
3334
// services is the "base" module for the hedera protobufs
3435
// in the beginning, there was only services and it was named "protos"
3536

36-
let services: Vec<_> = read_dir("./protobufs/services")?
37+
let services_path = Path::new(SERVICES_FOLDER);
38+
39+
if !services_path.is_dir() {
40+
anyhow::bail!("Folder {SERVICES_FOLDER} does not exist; do you need to `git submodule update --init`?");
41+
}
42+
43+
let services: Vec<_> = read_dir(services_path)?
3744
.filter_map(|entry| {
3845
let entry = entry.ok()?;
3946
entry.file_type().ok()?.is_file().then(|| entry.path())

0 commit comments

Comments
 (0)