Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow setting PROTOC environment variable #1414

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading