Skip to content

Commit

Permalink
Merge pull request #279 from kinode-dao/hf/hotfix-kit-s
Browse files Browse the repository at this point in the history
hotfix: use kit --features flag to pass simulation-mode and fix kit s
  • Loading branch information
dr-frmr committed Mar 17, 2024
2 parents af8e298 + 03b0b56 commit fab82bf
Show file tree
Hide file tree
Showing 30 changed files with 109 additions and 53 deletions.
75 changes: 29 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "kinode_lib"
authors = ["KinodeDAO"]
version = "0.6.0"
version = "0.6.1"
edition = "2021"
description = "A general-purpose sovereign cloud computing platform"
homepage = "https://kinode.org"
Expand Down
6 changes: 3 additions & 3 deletions kinode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "kinode"
authors = ["KinodeDAO"]
version = "0.6.0"
version = "0.6.1"
edition = "2021"
description = "A general-purpose sovereign cloud computing platform"
homepage = "https://kinode.org"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
27 changes: 25 additions & 2 deletions kinode/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,30 @@ 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()
Expand Down Expand Up @@ -59,11 +76,17 @@ 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();

Expand Down
2 changes: 2 additions & 0 deletions kinode/packages/app_store/app_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name = "app_store"
version = "0.3.0"
edition = "2021"

[features]
simulation-mode = []

[dependencies]
alloy-primitives = "0.6.2"
Expand Down
3 changes: 3 additions & 0 deletions kinode/packages/app_store/app_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,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) {
loop {
match eth_provider.subscribe(1, filter.clone()) {
Expand Down
2 changes: 2 additions & 0 deletions kinode/packages/app_store/download/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name = "download"
version = "0.1.0"
edition = "2021"

[features]
simulation-mode = []

[dependencies]
anyhow = "1.0"
Expand Down
2 changes: 2 additions & 0 deletions kinode/packages/app_store/ft_worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name = "ft_worker"
version = "0.2.0"
edition = "2021"

[features]
simulation-mode = []

[dependencies]
anyhow = "1.0"
Expand Down
Loading

0 comments on commit fab82bf

Please sign in to comment.