Merge branch 'protoc-env' into workspace-add

This commit is contained in:
Zack Fu Zi Xiang 2024-01-25 10:40:24 +08:00
commit 03847be020
2 changed files with 9 additions and 5 deletions

3
.gitignore vendored
View File

@ -12,4 +12,5 @@ node_modules
**/libs/AppFlowy-Collab/
data/
.env
.logs
.logs
shell.nix

View File

@ -1,11 +1,14 @@
use std::process::Command;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let protoc_path = protoc_bin_vendored::protoc_bin_path().expect("protoc bin path");
let protoc_path_str = protoc_path.to_str().expect("protoc path to str");
// If the `PROTOC` environment variable is set, don't use vendored `protoc`
std::env::var("PROTOC").map(|_| ()).unwrap_or_else(|_| {
let protoc_path = protoc_bin_vendored::protoc_bin_path().expect("protoc bin path");
let protoc_path_str = protoc_path.to_str().expect("protoc path to str");
// Set the `PROTOC` environment variable to the path of the `protoc` binary.
std::env::set_var("PROTOC", protoc_path_str);
// Set the `PROTOC` environment variable to the path of the `protoc` binary.
std::env::set_var("PROTOC", protoc_path_str);
});
prost_build::Config::new()
.out_dir("src/")