mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Fix clean build failure due to protoc change
da7d4dd2fc
changed the name of the env
var in .cargo/config.toml, causing the check in setup_protoc() to think
a custom path had been provided, which skipped the download and extract
step.
This commit is contained in:
parent
ae8f44d4b3
commit
4142de57e2
2 changed files with 10 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
[env]
|
[env]
|
||||||
STRINGS_JSON = { value = "out/rslib/i18n/strings.json", relative = true }
|
STRINGS_JSON = { value = "out/rslib/i18n/strings.json", relative = true }
|
||||||
# build script will append .exe if necessary
|
# build script will append .exe if necessary
|
||||||
PROTOC_BINARY = { value = "out/extracted/protoc/bin/protoc", relative = true }
|
PROTOC = { value = "out/extracted/protoc/bin/protoc", relative = true }
|
||||||
PYO3_NO_PYTHON = "1"
|
PYO3_NO_PYTHON = "1"
|
||||||
MACOSX_DEPLOYMENT_TARGET = "10.13.4"
|
MACOSX_DEPLOYMENT_TARGET = "10.13.4"
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ fn service_generator() -> Box<dyn prost_build::ServiceGenerator> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_backend_proto_rs() {
|
pub fn write_backend_proto_rs() {
|
||||||
maybe_add_protobuf_to_path();
|
set_protoc_path();
|
||||||
let proto_dir = PathBuf::from("../proto");
|
let proto_dir = PathBuf::from("../proto");
|
||||||
|
|
||||||
let subfolders = &["anki"];
|
let subfolders = &["anki"];
|
||||||
|
@ -122,13 +122,14 @@ pub fn write_backend_proto_rs() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If PROTOC is not defined, and protoc is not on path, use the protoc
|
/// Set PROTOC to the custom path provided by PROTOC_BINARY, or add .exe to
|
||||||
/// fetched by Bazel so that Rust Analyzer does not fail.
|
/// the standard path if on Windows.
|
||||||
fn maybe_add_protobuf_to_path() {
|
fn set_protoc_path() {
|
||||||
if let Ok(protoc) = env::var("PROTOC_BINARY") {
|
if let Ok(custom_protoc) = env::var("PROTOC_BINARY") {
|
||||||
env::set_var("PROTOC", &protoc);
|
env::set_var("PROTOC", custom_protoc);
|
||||||
if cfg!(windows) && !protoc.ends_with(".exe") {
|
} else if let Ok(bundled_protoc) = env::var("PROTOC") {
|
||||||
env::set_var("PROTOC", format!("{protoc}.exe"));
|
if cfg!(windows) && !bundled_protoc.ends_with(".exe") {
|
||||||
|
env::set_var("PROTOC", format!("{bundled_protoc}.exe"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue