Skip to content

Commit 77d5289

Browse files
committed
chore: some progress... i guess
Signed-off-by: Ahmed Tadde <[email protected]>
1 parent 6b4519e commit 77d5289

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+144
-134
lines changed

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/wash/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ wit-parser = { workspace = true }
120120
wrpc-interface-http = { workspace = true, features = ["http-body"] }
121121
wrpc-transport = { workspace = true }
122122
wrpc-transport-nats = { workspace = true }
123+
wat = { workspace = true }
123124

124125
[target.'cfg(target_os = "macos")'.dependencies]
125126
notify = { workspace = true, features = ["macos_fsevent"] }

crates/wash/src/bin/wash.rs

+44-44
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,50 @@ use std::fmt::{Display, Formatter};
33
use std::io::{stdout, BufWriter, Write};
44
use std::path::{Path, PathBuf};
55

6-
use crate::lib::cli::capture::{CaptureCommand, CaptureSubcommand};
7-
use crate::lib::cli::claims::ClaimsCliCommand;
8-
use crate::lib::cli::get::GetCommand;
9-
use crate::lib::cli::inspect::InspectCliCommand;
10-
use crate::lib::cli::label::LabelHostCommand;
11-
use crate::lib::cli::link::LinkCommand;
12-
use crate::lib::cli::registry::{RegistryPullCommand, RegistryPushCommand};
13-
use crate::lib::cli::scale::ScaleCommand;
14-
use crate::lib::cli::spy::SpyCommand;
15-
use crate::lib::cli::start::StartCommand;
16-
use crate::lib::cli::stop::StopCommand;
17-
use crate::lib::cli::update::UpdateCommand;
18-
use crate::lib::cli::{CommandOutput, OutputKind};
19-
use crate::lib::drain::Drain as DrainSelection;
20-
use crate::lib::plugin::subcommand::{DirMapping, SubcommandRunner};
216
use anyhow::bail;
227
use clap::{self, Arg, Command, FromArgMatches, Parser, Subcommand};
238
use console::style;
249
use crossterm::style::Stylize;
2510
use serde_json::json;
2611
use tracing_subscriber::EnvFilter;
27-
28-
use wash_cli::app::{self, AppCliCommand};
29-
use wash_cli::build::{self, BuildCommand};
30-
use wash_cli::call::{self, CallCli};
31-
use wash_cli::cmd::config::{self, ConfigCliCommand};
32-
use wash_cli::cmd::dev::{self, DevCommand};
33-
use wash_cli::cmd::link;
34-
use wash_cli::cmd::up::{self, UpCommand};
35-
use wash_cli::cmd::wit::{self, WitCommand};
36-
use wash_cli::common;
37-
use wash_cli::completions::{self, CompletionOpts};
38-
use wash_cli::config::{NATS_SERVER_VERSION, WADM_VERSION, WASMCLOUD_HOST_VERSION};
39-
use wash_cli::ctx::{self, CtxCommand};
40-
use wash_cli::down::{self, DownCommand};
41-
use wash_cli::drain;
42-
use wash_cli::generate::{self, NewCliCommand};
43-
use wash_cli::keys::{self, KeysCliCommand};
44-
use wash_cli::par::{self, ParCliCommand};
45-
use wash_cli::plugin::{self, PluginCommand};
46-
use wash_cli::secrets::{self, SecretsCliCommand};
47-
use wash_cli::style::WASH_CLI_STYLE;
48-
use wash_cli::ui::{self, UiCommand};
49-
use wash_cli::util::ensure_plugin_dir;
12+
use wash::lib::cli::capture::{CaptureCommand, CaptureSubcommand};
13+
use wash::lib::cli::claims::ClaimsCliCommand;
14+
use wash::lib::cli::get::GetCommand;
15+
use wash::lib::cli::inspect::InspectCliCommand;
16+
use wash::lib::cli::label::LabelHostCommand;
17+
use wash::lib::cli::link::LinkCommand;
18+
use wash::lib::cli::registry::{RegistryPullCommand, RegistryPushCommand};
19+
use wash::lib::cli::scale::ScaleCommand;
20+
use wash::lib::cli::spy::SpyCommand;
21+
use wash::lib::cli::start::StartCommand;
22+
use wash::lib::cli::stop::StopCommand;
23+
use wash::lib::cli::update::UpdateCommand;
24+
use wash::lib::cli::{CommandOutput, OutputKind};
25+
use wash::lib::drain::Drain as DrainSelection;
26+
use wash::lib::plugin::subcommand::{DirMapping, SubcommandRunner};
27+
28+
use wash::cli::app::{self, AppCliCommand};
29+
use wash::cli::build::{self, BuildCommand};
30+
use wash::cli::call::{self, CallCli};
31+
use wash::cli::cmd::config::{self, ConfigCliCommand};
32+
use wash::cli::cmd::dev::{self, DevCommand};
33+
use wash::cli::cmd::link;
34+
use wash::cli::cmd::up::{self, UpCommand};
35+
use wash::cli::cmd::wit::{self, WitCommand};
36+
use wash::cli::common;
37+
use wash::cli::completions::{self, CompletionOpts};
38+
use wash::cli::config::{NATS_SERVER_VERSION, WADM_VERSION, WASMCLOUD_HOST_VERSION};
39+
use wash::cli::ctx::{self, CtxCommand};
40+
use wash::cli::down::{self, DownCommand};
41+
use wash::cli::drain;
42+
use wash::cli::generate::{self, NewCliCommand};
43+
use wash::cli::keys::{self, KeysCliCommand};
44+
use wash::cli::par::{self, ParCliCommand};
45+
use wash::cli::plugin::{self, PluginCommand};
46+
use wash::cli::secrets::{self, SecretsCliCommand};
47+
use wash::cli::style::WASH_CLI_STYLE;
48+
use wash::cli::ui::{self, UiCommand};
49+
use wash::cli::util::ensure_plugin_dir;
5050

5151
#[derive(Clone)]
5252
struct HelpTopic {
@@ -548,13 +548,13 @@ async fn main() {
548548
if !cli.experimental {
549549
experimental_error_message("capture")
550550
} else if let Some(CaptureSubcommand::Replay(cmd)) = capture_cli.replay {
551-
crate::lib::cli::capture::handle_replay_command(cmd).await
551+
wash::lib::cli::capture::handle_replay_command(cmd).await
552552
} else {
553-
crate::lib::cli::capture::handle_command(capture_cli).await
553+
wash::lib::cli::capture::handle_command(capture_cli).await
554554
}
555555
}
556556
CliCommand::Claims(claims_cli) => {
557-
crate::lib::cli::claims::handle_command(claims_cli, output_kind).await
557+
wash::lib::cli::claims::handle_command(claims_cli, output_kind).await
558558
}
559559
CliCommand::Completions(completions_cli) => {
560560
completions::handle_command(completions_cli, Cli::command())
@@ -566,7 +566,7 @@ async fn main() {
566566
CliCommand::Drain(drain_cli) => drain::handle_command(drain_cli),
567567
CliCommand::Get(get_cli) => common::get_cmd::handle_command(get_cli, output_kind).await,
568568
CliCommand::Inspect(inspect_cli) => {
569-
crate::lib::cli::inspect::handle_command(inspect_cli, output_kind).await
569+
wash::lib::cli::inspect::handle_command(inspect_cli, output_kind).await
570570
}
571571
CliCommand::Keys(keys_cli) => keys::handle_command(keys_cli),
572572
CliCommand::Link(link_cli) => link::invoke(link_cli, output_kind).await,
@@ -583,7 +583,7 @@ async fn main() {
583583
if !cli.experimental {
584584
experimental_error_message("spy")
585585
} else {
586-
crate::lib::cli::spy::handle_command(spy_cli).await
586+
wash::lib::cli::spy::handle_command(spy_cli).await
587587
}
588588
}
589589
CliCommand::Scale(scale_cli) => {
@@ -701,7 +701,7 @@ async fn load_plugins() -> Option<(SubcommandRunner, PathBuf)> {
701701
}
702702
};
703703

704-
let plugins = match wash_cli::util::load_plugins(&plugin_dir).await {
704+
let plugins = match wash::cli::util::load_plugins(&plugin_dir).await {
705705
Ok(plugins) => plugins,
706706
Err(e) => {
707707
tracing::error!(err = ?e, "Could not load wash plugins");

crates/wash/src/cli/plugin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub async fn handle_install(
163163
.parse()
164164
.context("Invalid image reference")?;
165165

166-
// TODO: Add support for pulling via stream to wash_lib
166+
// TODO: Add support for pulling via stream to crate::lib
167167
let image_data = pull_oci_artifact(
168168
&image,
169169
OciPullOptions {

crates/wash/src/lib/cli/claims.rs

+35-12
Original file line numberDiff line numberDiff line change
@@ -1202,9 +1202,10 @@ mod test {
12021202
#[tokio::test]
12031203
async fn rust_component_metadata_with_project_config_overrides() -> anyhow::Result<()> {
12041204
let result = load_config(
1205-
Some(PathBuf::from(
1206-
"./tests/parser/files/rust_component_claims_metadata.toml",
1207-
)),
1205+
Some(
1206+
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1207+
.join("tests/parser/files/rust_component_claims_metadata.toml"),
1208+
),
12081209
None,
12091210
)
12101211
.await;
@@ -1239,14 +1240,23 @@ mod test {
12391240
name: "testcomponent".to_string(),
12401241
version: Version::parse("0.1.0").unwrap(),
12411242
revision: 666,
1242-
project_dir: PathBuf::from("./tests/parser/files/")
1243+
project_dir: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1244+
.join("tests")
1245+
.join("parser")
1246+
.join("files")
12431247
.canonicalize()
12441248
.unwrap(),
1245-
build_dir: PathBuf::from("./tests/parser/files/")
1249+
build_dir: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1250+
.join("tests")
1251+
.join("parser")
1252+
.join("files")
12461253
.canonicalize()
12471254
.unwrap()
12481255
.join("build"),
1249-
wit_dir: PathBuf::from("./tests/parser/files/")
1256+
wit_dir: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1257+
.join("tests")
1258+
.join("parser")
1259+
.join("files")
12501260
.canonicalize()
12511261
.unwrap()
12521262
.join("wit"),
@@ -1341,9 +1351,13 @@ mod test {
13411351
#[tokio::test]
13421352
async fn rust_provider_metadata_with_project_config_overrides() -> anyhow::Result<()> {
13431353
let result = load_config(
1344-
Some(PathBuf::from(
1345-
"./tests/parser/files/rust_provider_claims_metadata.toml",
1346-
)),
1354+
Some(
1355+
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1356+
.join("tests")
1357+
.join("parser")
1358+
.join("files")
1359+
.join("rust_provider_claims_metadata.toml"),
1360+
),
13471361
None,
13481362
)
13491363
.await;
@@ -1382,14 +1396,23 @@ mod test {
13821396
version: Version::parse("0.1.0").unwrap(),
13831397
revision: 666,
13841398
wasm_bin_name: None,
1385-
project_dir: PathBuf::from("./tests/parser/files/")
1399+
project_dir: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1400+
.join("tests")
1401+
.join("parser")
1402+
.join("files")
13861403
.canonicalize()
13871404
.unwrap(),
1388-
build_dir: PathBuf::from("./tests/parser/files/")
1405+
build_dir: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1406+
.join("tests")
1407+
.join("parser")
1408+
.join("files")
13891409
.canonicalize()
13901410
.unwrap()
13911411
.join("build"),
1392-
wit_dir: PathBuf::from("./tests/parser/files/")
1412+
wit_dir: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1413+
.join("tests")
1414+
.join("parser")
1415+
.join("files")
13931416
.canonicalize()
13941417
.unwrap()
13951418
.join("wit"),

crates/wash/src/lib/parser/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ pub async fn load_config(
997997
/// only needs to include the fields that are relevant to the project.
998998
///
999999
/// ```rust
1000-
/// use wash_lib::parser::WasmcloudDotToml;
1000+
/// use crate::lib::parser::WasmcloudDotToml;
10011001
///
10021002
/// let component_toml = r#"
10031003
/// language = "rust"

crates/wash/src/lib/plugin/subcommand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod bindings {
22
wasmtime::component::bindgen!({
33
world: "subcommands",
4-
async: true,
4+
async: true
55
});
66
}
77

crates/wash/tests/app.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::str::FromStr;
22

33
use anyhow::Result;
44
use tempfile::tempdir;
5-
use wash_lib::app::{load_app_manifest, AppManifest, AppManifestSource};
5+
use wash::lib::app::{load_app_manifest, AppManifest, AppManifestSource};
66

77
#[tokio::test]
88
#[cfg_attr(

crates/wash/tests/common.rs

-16
This file was deleted.

crates/wash/tests/common/mod.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ use tokio::{
1919
time::Duration,
2020
};
2121

22-
use crate::lib::cli::output::{
22+
use wash::cli::config::{WADM_VERSION, WASMCLOUD_HOST_VERSION};
23+
use wash::lib::cli::output::{
2324
AppDeleteCommandOutput, AppDeployCommandOutput, AppGetCommandOutput, AppListCommandOutput,
2425
AppUndeployCommandOutput, CallCommandOutput, GetHostsCommandOutput, PullCommandOutput,
2526
StartCommandOutput, StopCommandOutput, UpCommandOutput,
2627
};
27-
use crate::lib::common::CommandGroupUsage;
28-
use crate::lib::config::{host_pid_file, wadm_pid_file};
29-
use crate::lib::start::{
28+
use wash::lib::common::CommandGroupUsage;
29+
use wash::lib::config::{host_pid_file, wadm_pid_file};
30+
use wash::lib::start::{
3031
ensure_nats_server, start_nats_server, NatsConfig, WADM_BINARY, WASMCLOUD_HOST_BIN,
3132
};
32-
use wash_cli::config::{WADM_VERSION, WASMCLOUD_HOST_VERSION};
3333
use wasmcloud_control_interface::Host;
3434

3535
#[allow(unused)]
@@ -47,6 +47,9 @@ pub const PROVIDER_HTTPSERVER_OCI_REF: &str = "ghcr.io/wasmcloud/http-server:0.2
4747
#[allow(unused)]
4848
pub const FERRIS_SAYS_OCI_REF: &str = "ghcr.io/wasmcloud/components/ferris-says-rust:0.1.0";
4949

50+
#[allow(unused)]
51+
pub const NATS_SERVER_VERSION: &str = "v2.10.20";
52+
5053
pub const DEFAULT_WASH_INVOCATION_TIMEOUT_MS_ARG: &str = "40000";
5154

5255
#[allow(unused)]

crates/wash/tests/github_fetch_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use tempfile::tempdir;
99
use tokio::io::AsyncBufReadExt;
1010
use wasmcloud_test_util::testcontainers::{AsyncRunner as _, ImageExt, Mount, SquidProxy};
1111

12-
use wash_lib::start::{get_download_client, new_patch_releases_after, DOWNLOAD_CLIENT_USER_AGENT};
12+
use wash::lib::start::{get_download_client, new_patch_releases_after, DOWNLOAD_CLIENT_USER_AGENT};
1313

1414
// For squid config reference, see: https://www.squid-cache.org/Doc/config/
1515
// Sets up a squid-proxy listening on port 3128 that requires basic auth

crates/wash/tests/parser/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::{collections::HashSet, fs, path::PathBuf};
22

3-
use claims::{assert_err, assert_ok};
4-
use semver::Version;
5-
use wash_lib::parser::{
3+
use wash::lib::parser::{
64
load_config, CommonConfig, ComponentConfig, LanguageConfig, RegistryConfig, RustConfig,
75
TinyGoConfig, TinyGoGarbageCollector, TinyGoScheduler, TypeConfig, WasmTarget,
86
};
7+
use claims::{assert_err, assert_ok};
8+
use semver::Version;
99

1010
#[tokio::test]
1111
async fn rust_component() {

crates/wash/tests/plugins.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use std::path::PathBuf;
22

3-
use wash_lib::plugin::subcommand::DirMapping;
3+
use wash::lib::plugin::subcommand::DirMapping;
44

55
#[tokio::test]
66
async fn test_subcommand() {
7-
let mut subcommand = wash_lib::plugin::subcommand::SubcommandRunner::new().unwrap();
7+
let mut subcommand = wash::lib::plugin::subcommand::SubcommandRunner::new().unwrap();
88
// NOTE: All the joins are to avoid any problems with cross-platform paths
99
let plugin_path =
1010
// This is pre-compiled to save on test time. To rebuild this plugin when changes are needed

crates/wash/tests/start_nats.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use anyhow::Result;
22
use tempfile::tempdir;
33

4-
use wash_lib::common::CommandGroupUsage;
5-
use wash_lib::start::{ensure_nats_server, start_nats_server, NatsConfig, NATS_SERVER_BINARY};
4+
use wash::lib::common::CommandGroupUsage;
5+
use wash::lib::start::{ensure_nats_server, start_nats_server, NatsConfig, NATS_SERVER_BINARY};
66

77
mod common;
88
use common::{find_open_port, NATS_SERVER_VERSION};

crates/wash/tests/start_wadm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use wash_lib::common::CommandGroupUsage;
2-
use wash_lib::start::{ensure_wadm, start_wadm, WadmConfig, WADM_BINARY, WADM_PID};
1+
use wash::lib::common::CommandGroupUsage;
2+
use wash::lib::start::{ensure_wadm, start_wadm, WadmConfig, WADM_BINARY, WADM_PID};
33

44
use anyhow::Result;
55
use tempfile::tempdir;

0 commit comments

Comments
 (0)