From 9cdeb1225bee75d033164dfacf0986de724da0c8 Mon Sep 17 00:00:00 2001 From: Lucas Schumacher Date: Sat, 3 Feb 2024 22:36:02 -0500 Subject: [PATCH] Use git submodule for protobuf repo --- .gitignore | 1 - .gitmodules | 3 +++ Cargo.toml | 1 - build.rs | 17 ----------------- protobufs | 1 + 5 files changed, 4 insertions(+), 19 deletions(-) create mode 100644 .gitmodules create mode 160000 protobufs diff --git a/.gitignore b/.gitignore index 537fa83..ea8c4bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ /target -/protobufs diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e6f376a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "protobufs"] + path = protobufs + url = https://github.com/meshtastic/protobufs.git diff --git a/Cargo.toml b/Cargo.toml index 8deb780..b0a1411 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,5 +10,4 @@ bytes = "1.5.0" prost = "0.12.3" [build-dependencies] -git2 = "0.18.1" prost-build = "0.12.3" diff --git a/build.rs b/build.rs index 6ce73d3..3436cef 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,5 @@ -extern crate git2; extern crate prost_build; -use git2::Repository; use prost_build::compile_protos; use std::path::Path; @@ -13,23 +11,8 @@ fn update_repo(path: &Path) -> Result<(), git2::Error> { } fn main() { - let repo = "https://github.com/meshtastic/protobufs.git"; let path = Path::new("protobufs"); - if path.exists() { - if let Err(e) = update_repo(path) { - eprintln!("Error could not update meshtastic protobuf repo"); - eprintln!("{e}"); - std::process::exit(1); - } - } else { - if let Err(e) = Repository::clone(repo, path) { - eprintln!("Error could not clone meshtastic protobuf repo"); - eprintln!("{e}"); - std::process::exit(1); - } - } - let protos = &["protobufs/meshtastic/mesh.proto"]; let includes = &["protobufs"]; diff --git a/protobufs b/protobufs new file mode 160000 index 0000000..b508d2e --- /dev/null +++ b/protobufs @@ -0,0 +1 @@ +Subproject commit b508d2e7ced34c752533eb02786e37402cc5a184