Use git submodule for protobuf repo

This commit is contained in:
Lucas Schumacher 2024-02-03 22:36:02 -05:00
parent ec42a139a4
commit 9cdeb1225b
5 changed files with 4 additions and 19 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
/target /target
/protobufs

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "protobufs"]
path = protobufs
url = https://github.com/meshtastic/protobufs.git

View File

@ -10,5 +10,4 @@ bytes = "1.5.0"
prost = "0.12.3" prost = "0.12.3"
[build-dependencies] [build-dependencies]
git2 = "0.18.1"
prost-build = "0.12.3" prost-build = "0.12.3"

View File

@ -1,7 +1,5 @@
extern crate git2;
extern crate prost_build; extern crate prost_build;
use git2::Repository;
use prost_build::compile_protos; use prost_build::compile_protos;
use std::path::Path; use std::path::Path;
@ -13,23 +11,8 @@ fn update_repo(path: &Path) -> Result<(), git2::Error> {
} }
fn main() { fn main() {
let repo = "https://github.com/meshtastic/protobufs.git";
let path = Path::new("protobufs"); 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 protos = &["protobufs/meshtastic/mesh.proto"];
let includes = &["protobufs"]; let includes = &["protobufs"];

1
protobufs Submodule

@ -0,0 +1 @@
Subproject commit b508d2e7ced34c752533eb02786e37402cc5a184