mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
fix compilation of rslib outside Bazel
fixes code completion
This commit is contained in:
parent
c9b3ed1eae
commit
d7cded4ae1
2 changed files with 10 additions and 5 deletions
|
@ -79,10 +79,15 @@ fn service_generator() -> Box<dyn prost_build::ServiceGenerator> {
|
|||
|
||||
pub fn write_backend_proto_rs() {
|
||||
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
let backend_proto = PathBuf::from(
|
||||
env::var("BACKEND_PROTO").unwrap_or_else(|_| "../proto/backend.proto".to_string()),
|
||||
);
|
||||
let proto_dir = backend_proto.parent().unwrap().to_owned();
|
||||
let backend_proto;
|
||||
let proto_dir;
|
||||
if let Ok(proto) = env::var("BACKEND_PROTO") {
|
||||
backend_proto = PathBuf::from(proto);
|
||||
proto_dir = backend_proto.parent().unwrap().to_owned();
|
||||
} else {
|
||||
backend_proto = PathBuf::from("backend.proto");
|
||||
proto_dir = PathBuf::from(".");
|
||||
}
|
||||
let fluent_proto = out_dir.join("fluent.proto");
|
||||
|
||||
let mut config = prost_build::Config::new();
|
||||
|
|
|
@ -5,7 +5,7 @@ use lazy_static::lazy_static;
|
|||
use std::env;
|
||||
|
||||
fn buildinfo(key: &str) -> &'static str {
|
||||
let buildinfo = include_str!(concat!(env!("OUT_DIR"), "/../../buildinfo.txt"));
|
||||
let buildinfo = include_str!(concat!(env!("OUT_DIR"), "/buildinfo.txt"));
|
||||
for line in buildinfo.split('\n') {
|
||||
let mut it = line.split(' ');
|
||||
if it.next().unwrap() == key {
|
||||
|
|
Loading…
Reference in a new issue