Skip to content

Commit

Permalink
Update crate dependencies. (#208)
Browse files Browse the repository at this point in the history
This commit updates crate dependencies to latest.

It also fixes test failures introduced by the latest Rust toolchain.

Tests are now put in a temporary directory instead of under `target`, which
helps isolate the tests from one another.
  • Loading branch information
peterhuene authored Jan 12, 2024
1 parent 205c6ee commit b796968
Show file tree
Hide file tree
Showing 18 changed files with 621 additions and 635 deletions.
465 changes: 247 additions & 218 deletions Cargo.lock

Large diffs are not rendered by default.

46 changes: 26 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,53 +52,59 @@ bytes = { workspace = true }
which = { workspace = true }

[dev-dependencies]
assert_cmd = "2.0.12"
predicates = "3.0.4"
wasmparser = "0.118.1"
wat = "1.0.82"
warg-server = "0.2.0"
assert_cmd = { workspace = true }
predicates = { workspace = true }
wasmparser = { workspace = true }
wat = { workspace = true }
warg-server = { workspace = true }
tempfile = { workspace = true }

[workspace]
members = ["crates/bindings", "crates/macro", "crates/core", "crates/wit"]
exclude = ["target/tests"]

[workspace.dependencies]
cargo-component-core = { path = "crates/core", version = "0.6.0" }
cargo-component-macro = { path = "crates/macro", version = "0.6.0" }
warg-protocol = "0.2.0"
warg-crypto = "0.2.0"
warg-client = "0.2.0"
anyhow = "1.0.76"
clap = { version = "4.4.11", features = ["derive"] }
anyhow = "1.0.79"
clap = { version = "4.4.16", features = ["derive"] }
toml_edit = { version = "0.21.0", features = ["serde"] }
pretty_env_logger = "0.5.0"
log = "0.4.20"
tokio = { version = "1.35.1", default-features = false, features = ["macros", "rt-multi-thread"] }
tokio-util = "0.7.10"
heck = "0.4.1"
semver = "1.0.20"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
semver = "1.0.21"
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
indexmap = "2.1.0"
url = { version = "2.5.0", features = ["serde"] }
wit-parser = "0.13.0"
wit-component = "0.19.0"
wasm-metadata = "0.10.14"
wit-parser = "0.13.1"
wit-component = "0.19.1"
wasm-metadata = "0.10.15"
parse_arg = "0.1.4"
cargo_metadata = "0.18.1"
cargo-config2 = "0.1.17"
keyring = "2.1.0"
libc = "0.2.151"
keyring = "2.3.1"
libc = "0.2.152"
owo-colors = "4.0.0"
unicode-width = "0.1.11"
p256 = "0.13.2"
rand_core = "0.6.4"
rpassword = "7.3.1"
futures = "0.3.29"
futures = "0.3.30"
bytes = "1.5.0"
proc-macro2 = "1.0.71"
quote = "1.0.33"
syn = "2.0.42"
proc-macro2 = "1.0.76"
quote = "1.0.35"
syn = "2.0.48"
which = "5.0.0"
wit-bindgen-rust = "0.16.0"
wit-bindgen-core = "0.16.0"
tempfile = "3.9.0"
assert_cmd = "2.0.13"
predicates = "3.0.4"
wasmparser = "0.119.0"
wat = "1.0.83"
warg-server = "0.2.0"
9 changes: 5 additions & 4 deletions crates/wit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ tokio = { workspace = true }
pretty_env_logger = { workspace = true }

[dev-dependencies]
assert_cmd = "2.0.12"
predicates = "3.0.4"
warg-server = "0.2.0"
assert_cmd = { workspace = true }
predicates = { workspace = true }
warg-server = { workspace = true }
tokio-util = { workspace = true }
wasmparser = "0.118.1"
wasmparser = { workspace = true }
tempfile = { workspace = true }
41 changes: 21 additions & 20 deletions crates/wit/tests/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use crate::support::*;
use anyhow::Result;
use assert_cmd::prelude::*;
use predicates::{prelude::*, str::contains};
use std::fs;
use std::{fs, rc::Rc};
use tempfile::TempDir;

mod support;

Expand Down Expand Up @@ -39,11 +40,11 @@ fn requires_package() {

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn validate_the_package_exists() -> Result<()> {
let root = create_root()?;
let (_server, config) = spawn_server(&root).await?;
config.write_to_file(&root.join("warg-config.json"))?;
let dir = Rc::new(TempDir::new()?);
let (_server, config) = spawn_server(dir.path()).await?;
config.write_to_file(&dir.path().join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
let project = Project::with_dir(dir.clone(), "foo", "")?;

project
.wit("add foo:bar")
Expand All @@ -56,11 +57,11 @@ async fn validate_the_package_exists() -> Result<()> {

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn validate_the_version_exists() -> Result<()> {
let root = create_root()?;
let (_server, config) = spawn_server(&root).await?;
config.write_to_file(&root.join("warg-config.json"))?;
let dir = Rc::new(TempDir::new()?);
let (_server, config) = spawn_server(dir.path()).await?;
config.write_to_file(&dir.path().join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
let project = Project::with_dir(dir.clone(), "foo", "")?;
project.file("foo.wit", "package foo:bar;\n")?;
project
.wit("publish --init")
Expand All @@ -69,7 +70,7 @@ async fn validate_the_version_exists() -> Result<()> {
.stderr(contains("Published package `foo:bar` v0.1.0"))
.success();

let project = Project::with_root(&root, "bar", "")?;
let project = Project::with_dir(dir.clone(), "bar", "")?;
project
.wit("add foo:bar")
.assert()
Expand All @@ -92,11 +93,11 @@ async fn validate_the_version_exists() -> Result<()> {

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn checks_for_duplicate_dependencies() -> Result<()> {
let root = create_root()?;
let (_server, config) = spawn_server(&root).await?;
config.write_to_file(&root.join("warg-config.json"))?;
let dir = Rc::new(TempDir::new()?);
let (_server, config) = spawn_server(dir.path()).await?;
config.write_to_file(&dir.path().join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
let project = Project::with_dir(dir.clone(), "foo", "")?;
project.file("foo.wit", "package foo:bar;\n")?;
project
.wit("publish --init")
Expand All @@ -105,7 +106,7 @@ async fn checks_for_duplicate_dependencies() -> Result<()> {
.stderr(contains("foo"))
.success();

let project = Project::with_root(&root, "bar", "")?;
let project = Project::with_dir(dir.clone(), "bar", "")?;
project
.wit("add foo:bar")
.assert()
Expand All @@ -128,11 +129,11 @@ async fn checks_for_duplicate_dependencies() -> Result<()> {

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn does_not_modify_manifest_for_dry_run() -> Result<()> {
let root = create_root()?;
let (_server, config) = spawn_server(&root).await?;
config.write_to_file(&root.join("warg-config.json"))?;
let dir = Rc::new(TempDir::new()?);
let (_server, config) = spawn_server(dir.path()).await?;
config.write_to_file(&dir.path().join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
let project = Project::with_dir(dir.clone(), "foo", "")?;
project.file("foo.wit", "package foo:bar;\n")?;
project
.wit("publish --init")
Expand All @@ -141,7 +142,7 @@ async fn does_not_modify_manifest_for_dry_run() -> Result<()> {
.stderr(contains("foo"))
.success();

let project = Project::with_root(&root, "bar", "")?;
let project = Project::with_dir(dir.clone(), "bar", "")?;
project
.wit("add foo:bar --dry-run")
.assert()
Expand Down
13 changes: 7 additions & 6 deletions crates/wit/tests/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use anyhow::Result;
use assert_cmd::prelude::*;
use predicates::str::contains;
use std::{fs, path::Path};
use tempfile::TempDir;

mod support;

Expand All @@ -18,37 +19,37 @@ fn help() {

#[test]
fn it_creates_the_expected_files() -> Result<()> {
let root = create_root()?;
let dir = TempDir::new()?;

wit("init foo")
.current_dir(&root)
.current_dir(dir.path())
.assert()
.stderr(contains(format!(
"Created configuration file `{path}`",
path = Path::new("foo").join("wit.toml").display()
)))
.success();

let proj_dir = root.join("foo");
let proj_dir = dir.path().join("foo");
assert!(proj_dir.join("wit.toml").is_file());

Ok(())
}

#[test]
fn it_supports_registry_option() -> Result<()> {
let root = create_root()?;
let dir = TempDir::new()?;

wit("init bar --registry https://example.com")
.current_dir(&root)
.current_dir(dir.path())
.assert()
.stderr(contains(format!(
"Created configuration file `{path}`",
path = Path::new("bar").join("wit.toml").display()
)))
.success();

let proj_dir = root.join("bar");
let proj_dir = dir.path().join("bar");
assert!(fs::read_to_string(proj_dir.join("wit.toml"))?
.contains("default = \"https://example.com/\""));

Expand Down
27 changes: 14 additions & 13 deletions crates/wit/tests/publish.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::fs;
use std::{fs, rc::Rc};

use crate::support::*;
use anyhow::{Context, Result};
use assert_cmd::prelude::*;
use predicates::str::contains;
use semver::Version;
use tempfile::TempDir;
use toml_edit::{value, Array};
use warg_client::{Client, FileSystemClient};
use warg_protocol::registry::PackageId;
Expand Down Expand Up @@ -35,11 +36,11 @@ fn it_fails_with_missing_toml_file() -> Result<()> {

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn it_publishes_a_wit_package() -> Result<()> {
let root = create_root()?;
let (_server, config) = spawn_server(&root).await?;
config.write_to_file(&root.join("warg-config.json"))?;
let dir = Rc::new(TempDir::new()?);
let (_server, config) = spawn_server(dir.path()).await?;
config.write_to_file(&dir.path().join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
let project = Project::with_dir(dir.clone(), "foo", "")?;
project.file("baz.wit", "package baz:qux;\n")?;
project
.wit("publish --init")
Expand All @@ -53,11 +54,11 @@ async fn it_publishes_a_wit_package() -> Result<()> {

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn it_does_a_dry_run_publish() -> Result<()> {
let root = create_root()?;
let (_server, config) = spawn_server(&root).await?;
config.write_to_file(&root.join("warg-config.json"))?;
let dir = Rc::new(TempDir::new()?);
let (_server, config) = spawn_server(dir.path()).await?;
config.write_to_file(&dir.path().join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
let project = Project::with_dir(dir.clone(), "foo", "")?;
project.file("baz.wit", "package baz:qux;\n")?;
project
.wit("publish --init --dry-run")
Expand All @@ -82,9 +83,9 @@ async fn it_does_a_dry_run_publish() -> Result<()> {

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn it_publishes_with_registry_metadata() -> Result<()> {
let root = create_root()?;
let (_server, config) = spawn_server(&root).await?;
config.write_to_file(&root.join("warg-config.json"))?;
let dir = Rc::new(TempDir::new()?);
let (_server, config) = spawn_server(dir.path()).await?;
config.write_to_file(&dir.path().join("warg-config.json"))?;

let authors = ["Jane Doe <[email protected]>"];
let categories = ["wasm"];
Expand All @@ -94,7 +95,7 @@ async fn it_publishes_with_registry_metadata() -> Result<()> {
let homepage = "https://example.com/home";
let repository = "https://example.com/repo";

let project = Project::with_root(&root, "foo", "")?;
let project = Project::with_dir(dir.clone(), "foo", "")?;
project.file("baz.wit", "package baz:qux;\n")?;

project.update_manifest(|mut doc| {
Expand Down
Loading

0 comments on commit b796968

Please sign in to comment.