Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c3f1d97
Merge pull request #265 from kinode-dao/hf/robustness
nick1udwig Nov 14, 2024
203da1e
build: drop non-rust support temporarily
nick1udwig Nov 14, 2024
c9a1fba
new: get file-transfer test working
nick1udwig Nov 14, 2024
7def241
Merge pull request #269 from kinode-dao/hf/build-temporarily-drop-non…
nick1udwig Nov 14, 2024
b0c6807
new: update chat with UI
nick1udwig Nov 14, 2024
d772b04
new: add no-ui chat test to ui chat
nick1udwig Nov 14, 2024
1dc67d7
Merge pull request #270 from kinode-dao/hf/new-update-chat-ui
nick1udwig Nov 14, 2024
b731722
Merge pull request #266 from kinode-dao/develop
nick1udwig Nov 14, 2024
3252df7
new: hotfix template find-and-replace
nick1udwig Nov 15, 2024
79d9665
bump version to 0.8.5 & update README
nick1udwig Nov 15, 2024
63f1047
new: update api wit file names
nick1udwig Nov 15, 2024
885a96a
Merge pull request #274 from kinode-dao/hf/new-update-api-wit-file-names
nick1udwig Nov 15, 2024
f8a8a1f
build: add minimum-viable rewrite-before-build
nick1udwig Nov 16, 2024
3941cb9
build: add minimum-viable rewrite of Spawn(|| {})
nick1udwig Nov 20, 2024
b548cb6
build: rewrite `Spawn!()` rather than `Spawn()` for happier linter
nick1udwig Nov 20, 2024
26ab5fa
build: make rewriting optional, but default, with `--no-rewrite` flag
nick1udwig Nov 20, 2024
5434390
build: improve arg passing with struct; destructure into child for ma…
nick1udwig Nov 21, 2024
69bc1e8
build: restructure rewrite (pure refactor)
nick1udwig Nov 21, 2024
10a9440
build: `rustfmt` the codegend files
nick1udwig Nov 21, 2024
9bc0dca
build: port functions to child when used; allow `Spawn!()` of functio…
nick1udwig Nov 22, 2024
cfc7b50
build: change default to NOT rewrite
nick1udwig Nov 23, 2024
ed4b903
Merge pull request #275 from kinode-dao/hf/build-rewrite-before-build
nick1udwig Nov 23, 2024
47cdf82
Merge pull request #273 from kinode-dao/develop
nick1udwig Nov 23, 2024
2ca6480
add wit v1 as build option
dr-frmr Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.lock

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

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kit"
version = "0.8.3"
version = "0.8.5"
edition = "2021"

[build-dependencies]
Expand Down Expand Up @@ -39,13 +39,17 @@ fs-err = "2.11"
hex = "0.4"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib.git", rev = "9ac9e51" }
nix = { version = "0.27", features = ["process", "signal", "term"] }
proc-macro2 = "1.0"
regex = "1"
reqwest = { version = "0.12", features = ["json"] }
rpassword = "7"
semver = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.10.8"
syn = { version = "2.0", features = ["full", "visit", "extra-traits"] }
#syn = { version = "2.0", features = ["full", "visit"] }
thiserror = "1.0"
tokio = { version = "1.28", features = [
"macros",
"process",
Expand All @@ -55,6 +59,7 @@ tokio = { version = "1.28", features = [
"time",
] }
toml = "0.8"
toml_edit = "0.22"
tracing = "0.1"
tracing-appender = "0.2"
tracing-error = "0.2"
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Tool**kit** for developing on [Kinode OS](https://github.com/kinode-dao/kinode).

Documentation in the [Kinode Book](https://book.kinode.org/kit-dev-toolkit.html); example usage [here](https://book.kinode.org/my_first_app/chapter_1.html).
Documentation in the [Kinode Book](https://book.kinode.org/kit/kit-dev-toolkit.html); example usage [here](https://book.kinode.org/my_first_app/chapter_1.html).

## Installing

Expand Down Expand Up @@ -71,7 +71,10 @@ kit boot-fake-node --runtime-path ~/git/kinode
```

`kit` also contains tools for running tests.
For details and examples, please see [https://github.com/kinode-dao/core_tests](https://github.com/kinode-dao/core_tests).
For details and examples, please see
1. [Kinode Book's example code](https://github.com/kinode-dao/kinode-book/tree/main/code).
2. `kit`s templates, available through `kit new` or [here](https://github.com/kinode-dao/kit/tree/master/src/new/templates/rust).
3. [https://github.com/kinode-dao/core_tests](https://github.com/kinode-dao/core_tests).

## UI Development

Expand Down
4 changes: 3 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn visit_dirs(dir: &Path, output_buffer: &mut Vec<u8>) -> io::Result<()> {
let relative_path = path.strip_prefix(TEMPLATES_DIR).unwrap();
let path_str = relative_path.to_str().unwrap().replace("\\", "/");

let relative_path_from_includes = Path::new("..").join(path);
let relative_path_from_includes = Path::new("..").join(&path);
let path_str_from_includes = relative_path_from_includes
.to_str()
.unwrap()
Expand All @@ -79,6 +79,7 @@ fn visit_dirs(dir: &Path, output_buffer: &mut Vec<u8>) -> io::Result<()> {
" (\"{}\", include_str!(\"{}\")),",
path_str, path_str_from_includes,
)?;
println!("cargo::rerun-if-changed={}", path.display());
}
}
Ok(())
Expand All @@ -104,6 +105,7 @@ fn make_chain_includes() -> anyhow::Result<()> {
commit,
Path::new("..").join(&path).display(),
)?;
println!("cargo::rerun-if-changed={}", path.display());
}

writeln!(&mut output_buffer, "];")?;
Expand Down
35 changes: 32 additions & 3 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ use crate::setup::{
use crate::view_api;
use crate::KIT_CACHE;

mod rewrite;
use rewrite::copy_and_rewrite_package;

const PY_VENV_NAME: &str = "process_env";
const JAVASCRIPT_SRC_PATH: &str = "src/lib.js";
const PYTHON_SRC_PATH: &str = "src/lib.py";
Expand All @@ -39,6 +42,8 @@ const KINODE_WIT_0_7_0_URL: &str =
"https://raw.githubusercontent.com/kinode-dao/kinode-wit/aa2c8b11c9171b949d1991c32f58591c0e881f85/kinode.wit";
const KINODE_WIT_0_8_0_URL: &str =
"https://raw.githubusercontent.com/kinode-dao/kinode-wit/v0.8/kinode.wit";
const KINODE_WIT_1_0_0_URL: &str =
"https://raw.githubusercontent.com/kinode-dao/kinode-wit/1.0/kinode.wit";
const WASI_VERSION: &str = "19.0.1"; // TODO: un-hardcode
const DEFAULT_WORLD_0_7_0: &str = "process";
const DEFAULT_WORLD_0_8_0: &str = "process-v0";
Expand Down Expand Up @@ -1071,7 +1076,8 @@ async fn build_wit_dir(
}
let wit_url = match wit_version {
None => KINODE_WIT_0_7_0_URL,
Some(0) | _ => KINODE_WIT_0_8_0_URL,
Some(0) => KINODE_WIT_0_8_0_URL,
Some(1) | _ => KINODE_WIT_1_0_0_URL,
};
download_file(wit_url, &wit_dir.join("kinode.wit")).await?;
for (file_name, contents) in apis {
Expand Down Expand Up @@ -1155,6 +1161,7 @@ async fn fetch_dependencies(
default_world: Option<&str>,
include: &HashSet<PathBuf>,
exclude: &HashSet<PathBuf>,
rewrite: bool,
force: bool,
verbose: bool,
) -> Result<()> {
Expand All @@ -1171,6 +1178,7 @@ async fn fetch_dependencies(
default_world,
vec![], // TODO: what about deps-of-deps?
vec![],
rewrite,
false,
force,
verbose,
Expand Down Expand Up @@ -1207,6 +1215,7 @@ async fn fetch_dependencies(
default_world,
local_dep_deps,
vec![],
rewrite,
false,
force,
verbose,
Expand Down Expand Up @@ -1522,6 +1531,7 @@ async fn compile_package(
add_paths_to_api: &Vec<PathBuf>,
include: &HashSet<PathBuf>,
exclude: &HashSet<PathBuf>,
rewrite: bool,
force: bool,
verbose: bool,
ignore_deps: bool, // for internal use; may cause problems when adding recursive deps
Expand All @@ -1544,6 +1554,7 @@ async fn compile_package(
default_world,
include,
exclude,
rewrite,
force,
verbose,
)
Expand Down Expand Up @@ -1651,6 +1662,7 @@ pub async fn execute(
default_world: Option<&str>,
local_dependencies: Vec<PathBuf>,
add_paths_to_api: Vec<PathBuf>,
rewrite: bool,
reproducible: bool,
force: bool,
verbose: bool,
Expand Down Expand Up @@ -1734,7 +1746,16 @@ pub async fn execute(

check_process_lib_version(&package_dir.join("Cargo.toml"))?;

let ui_dirs = get_ui_dirs(package_dir, &include, &exclude)?;
// live_dir is the "dir that is being built" or is "live";
// if `!rewrite`, that is just `package_dir`;
// else, it is the modified copy that is in `target/rewrite/`
let live_dir = if !rewrite {
PathBuf::from(package_dir)
} else {
copy_and_rewrite_package(package_dir)?
};

let ui_dirs = get_ui_dirs(&live_dir, &include, &exclude)?;
if !no_ui && !ui_dirs.is_empty() {
if !skip_deps_check {
let mut recv_kill = make_fake_kill_chan();
Expand All @@ -1749,7 +1770,7 @@ pub async fn execute(

if !ui_only {
compile_package(
package_dir,
&live_dir,
skip_deps_check,
features,
url,
Expand All @@ -1759,13 +1780,21 @@ pub async fn execute(
&add_paths_to_api,
&include,
&exclude,
rewrite,
force,
verbose,
ignore_deps,
)
.await?;
}

if rewrite {
if package_dir.join("pkg").exists() {
fs::remove_dir_all(package_dir.join("pkg"))?;
}
copy_dir(live_dir.join("pkg"), package_dir.join("pkg"))?;
}

let metadata = read_metadata(package_dir)?;
let pkg_publisher = make_pkg_publisher(&metadata);
let (_zip_filename, hash_string) = zip_pkg(package_dir, &pkg_publisher)?;
Expand Down
Loading
Loading