Skip to content

Commit

Permalink
checkpoint: porting remaining "Unresolved" usages, base tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
noise64 committed Oct 15, 2024
1 parent 61c0164 commit 4d1c0eb
Show file tree
Hide file tree
Showing 13 changed files with 608 additions and 496 deletions.
13 changes: 7 additions & 6 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
Expand Up @@ -20,5 +20,5 @@ opt-level = 's'
fs_extra = "1.3.0"
golem-wasm-ast = "1.0.1"
tempfile = "3.12.0"
test-r = { version = "0.0.6", default-features = false }
test-r = { version = "0.0.11", default-features = false }
tokio = "1.38.0"
12 changes: 8 additions & 4 deletions wasm-rpc-stubgen/src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use std::collections::{BTreeMap, BTreeSet};
use std::fs;
use std::path::Path;
use std::path::{Path, PathBuf};

use crate::commands::log::{log_action, log_warn_action};
use crate::stub::StubDefinition;
Expand Down Expand Up @@ -261,7 +261,10 @@ pub fn add_workspace_members(path: &Path, members: &[String]) -> anyhow::Result<
Ok(())
}

pub fn add_dependencies_to_cargo_toml(cargo_path: &Path, names: &[String]) -> anyhow::Result<()> {
pub fn add_dependencies_to_cargo_toml(
cargo_path: &Path,
wit_sources: Vec<PathBuf>,
) -> anyhow::Result<()> {
let raw_manifest = std::fs::read_to_string(cargo_path)?;
let mut manifest: Manifest<MetadataRoot> =
Manifest::from_slice_with_metadata(raw_manifest.as_bytes())?;
Expand All @@ -271,7 +274,7 @@ pub fn add_dependencies_to_cargo_toml(cargo_path: &Path, names: &[String]) -> an
let mut new_target = ComponentTarget::default();
let target = component.target.as_mut().unwrap_or(&mut new_target);
let existing: BTreeSet<_> = target.dependencies.keys().cloned().collect();
for name in names {
/*for wit_source in wit_sources {
if !existing.contains(name) {
let relative_path = format!("wit/deps/{}", name);
let path = cargo_path
Expand All @@ -287,7 +290,8 @@ pub fn add_dependencies_to_cargo_toml(cargo_path: &Path, names: &[String]) -> an
},
);
}
}
}*/
// TODO

if component.target.is_none() {
component.target = Some(new_target);
Expand Down
2 changes: 1 addition & 1 deletion wasm-rpc-stubgen/src/commands/declarative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::commands::dependencies::UpdateCargoToml;
use crate::commands::log::{
log_action, log_skipping_up_to_date, log_validated_action_result, log_warn_action,
};
use crate::copy::copy;
use crate::fs::copy;
use crate::model::oam;
use crate::model::validation::ValidatedResult;
use crate::model::wasm_rpc::{
Expand Down
Loading

0 comments on commit 4d1c0eb

Please sign in to comment.