hotfix: use kit --features flag to pass simulation-mode and fix kit s

This commit is contained in:
nludwig 2024-03-16 01:36:49 -07:00
parent 61ff56f117
commit fcc07955d7
27 changed files with 97 additions and 48 deletions

70
Cargo.lock generated
View File

@ -78,7 +78,7 @@ name = "alias"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -423,7 +423,7 @@ dependencies = [
"alloy-sol-types",
"anyhow",
"bincode",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"rand 0.8.5",
"serde",
"serde_json",
@ -900,7 +900,7 @@ name = "cat"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -962,7 +962,7 @@ dependencies = [
"anyhow",
"base64 0.13.1",
"bincode",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"pleco",
"serde",
"serde_json",
@ -1606,7 +1606,7 @@ name = "download"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -1637,7 +1637,7 @@ name = "echo"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -1837,7 +1837,7 @@ version = "0.2.0"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"rand 0.8.5",
"serde",
"serde_json",
@ -1982,7 +1982,7 @@ dependencies = [
name = "get_block"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -2157,7 +2157,7 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"
name = "hi"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -2187,7 +2187,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -2413,7 +2413,7 @@ name = "install"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -2653,7 +2653,7 @@ dependencies = [
[[package]]
name = "kinode_process_lib"
version = "0.6.0"
source = "git+https://github.com/kinode-dao/process_lib?tag=v0.6.0#ccf9db2493ec1e112f9146994f852b7bb119dbb6"
source = "git+https://github.com/kinode-dao/process_lib.git?tag=v0.6.0#ccf9db2493ec1e112f9146994f852b7bb119dbb6"
dependencies = [
"alloy-json-rpc",
"alloy-primitives",
@ -2671,27 +2671,9 @@ dependencies = [
"wit-bindgen",
]
[[package]]
name = "kinode_process_lib"
version = "0.6.0"
source = "git+https://github.com/kinode-dao/process_lib.git?rev=9d185e1#9d185e1e264c93af53d004ba32520fd5d046e7e5"
dependencies = [
"anyhow",
"bincode",
"http 1.0.0",
"mime_guess",
"rand 0.8.5",
"serde",
"serde_json",
"thiserror",
"url",
"wit-bindgen",
]
[[package]]
name = "kit"
version = "0.1.0"
source = "git+https://github.com/kinode-dao/kit?rev=0e39c93#0e39c93d994e2955efd5655fb3ae0831c38865d0"
version = "0.2.0"
dependencies = [
"anyhow",
"base64 0.21.7",
@ -2700,7 +2682,7 @@ dependencies = [
"futures-util",
"git2",
"hex",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib.git?rev=9d185e1)",
"kinode_process_lib",
"nix",
"regex",
"reqwest",
@ -2728,7 +2710,7 @@ dependencies = [
"anyhow",
"bincode",
"hex",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"rmp-serde",
"serde",
"serde_json",
@ -2908,7 +2890,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"clap",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"regex",
"serde",
"serde_json",
@ -3040,7 +3022,7 @@ dependencies = [
name = "namehash_to_name"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"rmp-serde",
"serde",
"wit-bindgen",
@ -3068,7 +3050,7 @@ dependencies = [
name = "net_diagnostics"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"rmp-serde",
"serde",
"wit-bindgen",
@ -3351,7 +3333,7 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
name = "peer"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"rmp-serde",
"serde",
"wit-bindgen",
@ -3361,7 +3343,7 @@ dependencies = [
name = "peers"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"rmp-serde",
"serde",
"wit-bindgen",
@ -4539,7 +4521,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
name = "state"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -4693,7 +4675,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"rand 0.8.5",
"regex",
"serde",
@ -4707,7 +4689,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"thiserror",
@ -4721,7 +4703,7 @@ dependencies = [
"anyhow",
"bincode",
"indexmap",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"thiserror",
@ -4961,7 +4943,7 @@ name = "top"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",
@ -5247,7 +5229,7 @@ name = "uninstall"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)",
"kinode_process_lib",
"serde",
"serde_json",
"wit-bindgen",

View File

@ -14,7 +14,7 @@ path = "src/main.rs"
[build-dependencies]
anyhow = "1.0.71"
kit = { git = "https://github.com/kinode-dao/kit", rev = "0e39c93" }
kit = { git = "https://github.com/kinode-dao/kit", rev = "1bd7bec" }
rayon = "1.8.1"
sha2 = "0.10"
tokio = "1.28"
@ -88,4 +88,4 @@ uuid = { version = "1.1.2", features = ["serde", "v4"] }
warp = "0.3.5"
wasmtime = "17.0.1"
wasmtime-wasi = "17.0.1"
zip = "0.6"
zip = "0.6"

View File

@ -6,13 +6,29 @@ use std::{
};
use zip::write::FileOptions;
fn get_features() -> String {
let mut features = "".to_string();
for (key, _) in std::env::vars() {
if key.starts_with("CARGO_FEATURE_") {
let feature = key.trim_start_matches("CARGO_FEATURE_")
.to_lowercase()
.replace("_", "-");
features.push_str(&feature);
//println!("cargo:rustc-cfg=feature=\"{}\"", feature);
//println!("- {}", feature);
}
}
features
}
fn build_and_zip_package(
entry_path: PathBuf,
parent_pkg_path: &str,
features: &str,
) -> anyhow::Result<(String, String, Vec<u8>)> {
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(async {
kit::build::execute(&entry_path, false, false, true).await?;
kit::build::execute(&entry_path, false, false, true, features).await?;
let mut writer = Cursor::new(Vec::new());
let options = FileOptions::default()
@ -59,11 +75,13 @@ fn main() -> anyhow::Result<()> {
.map(|entry| entry.unwrap().path())
.collect();
let features = get_features();
let results: Vec<anyhow::Result<(String, String, Vec<u8>)>> = entries
.par_iter()
.map(|entry_path| {
let parent_pkg_path = entry_path.join("pkg");
build_and_zip_package(entry_path.clone(), parent_pkg_path.to_str().unwrap())
build_and_zip_package(entry_path.clone(), parent_pkg_path.to_str().unwrap(), &features)
})
.collect();

View File

@ -3,6 +3,8 @@ name = "app_store"
version = "0.3.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
alloy-primitives = "0.6.2"

View File

@ -82,8 +82,11 @@ fn fetch_logs(eth_provider: &eth::Provider, filter: &eth::Filter) -> Vec<eth::Lo
}
}
}
#[cfg(feature = "simulation-mode")]
vec![]
}
#[allow(unused_variables)]
fn subscribe_to_logs(eth_provider: &eth::Provider, filter: eth::Filter) {
#[cfg(not(feature = "simulation-mode"))]
loop {

View File

@ -3,6 +3,8 @@ name = "download"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "ft_worker"
version = "0.2.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "install"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "uninstall"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "chess"
version = "0.2.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "homepage"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "get_block"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" }

View File

@ -3,6 +3,8 @@ name = "kns_indexer"
version = "0.2.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "state"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" }

View File

@ -3,6 +3,8 @@ name = "alias"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "cat"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "echo"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "hi"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" }

View File

@ -3,6 +3,8 @@ name = "m"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "namehash_to_name"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" }

View File

@ -3,6 +3,8 @@ name = "net_diagnostics"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" }

View File

@ -3,6 +3,8 @@ name = "peer"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" }

View File

@ -3,6 +3,8 @@ name = "peers"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" }

View File

@ -3,6 +3,8 @@ name = "terminal"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "top"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "test_runner"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"

View File

@ -3,6 +3,8 @@ name = "tester"
version = "0.1.0"
edition = "2021"
[features]
simulation-mode = []
[dependencies]
anyhow = "1.0"