Skip to content

Commit

Permalink
fix: allow setting PROTOC environment variable (#1414)
Browse files Browse the repository at this point in the history
* fix: allow setting PROTOC environment variable

* fix: allow setting PROTOC environment variable
  • Loading branch information
MatisseB authored Jun 19, 2024
1 parent 3c4b568 commit 71a192e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions kclvm/api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ use prost_wkt_build::{FileDescriptorSet, Message};
/// According to the file kclvm/spec/gpyrpc/gpyrpc.proto, automatically generate
/// the corresponding rust source file to the directory src/model
fn main() {
std::env::set_var(
"PROTOC",
protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
);
if env::var("PROTOC").is_err() {
env::set_var(
"PROTOC",
protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
);
}

let out = PathBuf::from(env::var("OUT_DIR").unwrap());
let descriptor_file = out.join("kclvm_service_descriptor.bin");
Expand Down
10 changes: 6 additions & 4 deletions kclvm/third-party/prost-wkt/wkt-types/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ use regex::Regex;

fn main() {
//hack: set protoc_bin_vendored::protoc_bin_path() to PROTOC
std::env::set_var(
"PROTOC",
protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
);
if env::var("PROTOC").is_err() {
env::set_var(
"PROTOC",
protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
);
}
let dir = PathBuf::from(env::var("OUT_DIR").unwrap());
process_prost_pbtime(&dir);

Expand Down

0 comments on commit 71a192e

Please sign in to comment.