Skip to content

Commit

Permalink
fix(stremio-core-protobuf): build script creates protobuf folder if i…
Browse files Browse the repository at this point in the history
…t's missing

Signed-off-by: Lachezar Lechev <[email protected]>
  • Loading branch information
elpiel committed Aug 15, 2024
1 parent bc5fda3 commit 34bab4c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions stremio-core-protobuf/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::{fs::DirBuilder, path::PathBuf};

use glob::glob;
use prost_build::Config;
Expand All @@ -24,9 +24,19 @@ fn main() {
}
let file_descriptors =
protox::compile(proto_paths, [proto_dir]).expect("Expected file descriptors");

let protobuf_gen_dir = PathBuf::from(CARGO_MANIFEST_DIR)
.join("src")
.join("protobuf");
// create protobuf folder if it doesn't exist
DirBuilder::new()
.recursive(true)
.create(protobuf_gen_dir.clone())
.expect("Should create src/protobuf dir if it does not exist.");

Config::new()
.compile_well_known_types()
.out_dir("src/protobuf")
.out_dir(&protobuf_gen_dir.display().to_string())
.include_file("mod.rs")
.compile_fds(file_descriptors)
.expect("Expected successful protobuf codegen");
Expand Down

0 comments on commit 34bab4c

Please sign in to comment.