build fixes

This commit is contained in:
Christien Rioux 2023-09-16 12:23:56 -04:00
parent 3a4c211e85
commit ad47e400ed
4 changed files with 30 additions and 13 deletions

View File

@ -54,7 +54,7 @@ flexi_logger = { version = "^0", features = ["use_chrono_for_offset"] }
thiserror = "^1" thiserror = "^1"
crossbeam-channel = "^0" crossbeam-channel = "^0"
hex = "^0" hex = "^0"
veilid-tools = { version = "0.2.0", path = "../veilid-tools" } veilid-tools = { version = "0.2.1", path = "../veilid-tools" }
json = "^0" json = "^0"
stop-token = { version = "^0", default-features = false } stop-token = { version = "^0", default-features = false }

View File

@ -59,7 +59,7 @@ network-result-extra = ["veilid-tools/network-result-extra"]
[dependencies] [dependencies]
# Tools # Tools
veilid-tools = { version = "0.2.0", path = "../veilid-tools", features = [ veilid-tools = { version = "0.2.1", path = "../veilid-tools", features = [
"tracing", "tracing",
], default-features = false } ], default-features = false }
paste = "1.0.14" paste = "1.0.14"
@ -182,7 +182,7 @@ socket2 = { version = "0.5.3", features = ["all"] }
# Dependencies for WASM builds only # Dependencies for WASM builds only
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
veilid-tools = { version = "0.2.0", path = "../veilid-tools", default-features = false, features = [ veilid-tools = { version = "0.2.1", path = "../veilid-tools", default-features = false, features = [
"rt-wasm-bindgen", "rt-wasm-bindgen",
] } ] }

View File

@ -1,15 +1,27 @@
use std::path::PathBuf; use std::path::PathBuf;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
fn get_workspace_dir() -> PathBuf { fn search_file<T: AsRef<str>, P: AsRef<str>>(start: T, name: P) -> Option<PathBuf> {
PathBuf::from(env!("CARGO_MANIFEST_DIR")) let start_path = PathBuf::from(start.as_ref()).canonicalize().ok();
.join("..") let mut path = start_path.as_ref().map(|x| x.as_path());
.canonicalize() while let Some(some_path) = path {
.expect("want workspace dir") let file_path = some_path.join(name.as_ref());
if file_path.exists() {
return Some(file_path.to_owned());
}
path = some_path.parent();
}
None
} }
fn get_desired_capnp_version_string() -> String { fn get_desired_capnp_version_string() -> String {
std::fs::read_to_string(get_workspace_dir().join(".capnp_version")) let capnp_path = search_file(env!("CARGO_MANIFEST_DIR"), ".capnp_version")
.expect("should find .capnp_version file") .expect("should find .capnp_version file");
std::fs::read_to_string(&capnp_path)
.expect(&format!(
"can't read .capnp_version file here: {:?}",
capnp_path
))
.trim() .trim()
.to_owned() .to_owned()
} }
@ -32,8 +44,13 @@ fn get_capnp_version_string() -> String {
} }
fn get_desired_protoc_version_string() -> String { fn get_desired_protoc_version_string() -> String {
std::fs::read_to_string(get_workspace_dir().join(".protoc_version")) let protoc_path = search_file(env!("CARGO_MANIFEST_DIR"), ".protoc_version")
.expect("should find .protoc_version file") .expect("should find .protoc_version file");
std::fs::read_to_string(&protoc_path)
.expect(&format!(
"can't read .protoc_version file here: {:?}",
protoc_path
))
.trim() .trim()
.to_owned() .to_owned()
} }

View File

@ -15,7 +15,7 @@ default = ["veilid-core/default-wasm"]
crypto-test = ["veilid-core/crypto-test"] crypto-test = ["veilid-core/crypto-test"]
[dependencies] [dependencies]
veilid-core = { version = "0.2.0", path = "../veilid-core", default-features = false } veilid-core = { version = "0.2.1", path = "../veilid-core", default-features = false }
tracing = { version = "^0", features = ["log", "attributes"] } tracing = { version = "^0", features = ["log", "attributes"] }
tracing-wasm = "^0" tracing-wasm = "^0"