Skip to content

Commit

Permalink
Merge branch 'main' into assembled
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch authored Oct 4, 2024
2 parents 4259b89 + d37632a commit 1775ad2
Show file tree
Hide file tree
Showing 17 changed files with 330 additions and 182 deletions.
87 changes: 53 additions & 34 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ termcolor_output = "1.0.1"
ed25519-dalek = ">= 2.1.1"

# networking
http = "1.0.0"
jsonrpsee-http-client = "0.20.1"
jsonrpsee-core = "0.20.1"
tokio = "1.28.1"
Expand Down
23 changes: 11 additions & 12 deletions cmd/soroban-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ wasmparser = { workspace = true }
sha2 = { workspace = true }
csv = "1.1.6"
ed25519-dalek = { workspace = true }
reqwest = { version = "0.12.7", default-features = false, features = [
"rustls-tls",
"http2",
"json",
"blocking",
"stream",
] }
jsonrpsee-http-client = "0.20.1"
jsonrpsee-core = "0.20.1"
hyper = "0.14.27"
hyper-tls = "0.5"
http = "0.2.9"
regex = "1.6.0"
wasm-opt = { version = "0.114.0", optional = true }
chrono = { version = "0.4.27", features = ["serde"]}
chrono = { version = "0.4.27", features = ["serde"] }
rpassword = "7.2.0"
dirs = "4.0.0"
toml = "0.5.9"
Expand All @@ -107,13 +111,12 @@ gix = { version = "0.58.0", default-features = false, features = [
"blocking-http-transport-reqwest-rust-tls",
"worktree-mutation",
] }
ureq = { version = "2.9.1", features = ["json"] }
async-compression = { version = "0.4.12", features = [ "tokio", "gzip" ] }
async-compression = { version = "0.4.12", features = ["tokio", "gzip"] }

tempfile = "3.8.1"
toml_edit = "0.21.0"
rust-embed = { version = "8.2.0", features = ["debug-embed"] }
bollard = { workspace=true }
bollard = { workspace = true }
futures-util = "0.3.30"
futures = "0.3.30"
home = "0.5.9"
Expand All @@ -127,19 +130,15 @@ fqdn = "0.3.12"
open = "5.3.0"
url = "2.5.2"

# For hyper-tls
[target.'cfg(unix)'.dependencies]
openssl = { version = "=0.10.55", features = ["vendored"] }

[build-dependencies]
crate-git-revision = "0.0.4"
serde.workspace = true
thiserror.workspace = true
ureq = { version = "2.9.1", features = ["json"] }


[dev-dependencies]
assert_cmd = "2.0.4"
assert_fs = "1.0.7"
predicates = "2.1.5"
walkdir = "2.5.0"
mockito = "1.5.0"
5 changes: 2 additions & 3 deletions cmd/soroban-cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use clap::CommandFactory;
use dotenvy::dotenv;
use std::thread;
use tracing_subscriber::{fmt, EnvFilter};

use crate::upgrade_check::upgrade_check;
Expand Down Expand Up @@ -75,8 +74,8 @@ pub async fn main() {
// Spawn a thread to check if a new version exists.
// It depends on logger, so we need to place it after
// the code block that initializes the logger.
thread::spawn(move || {
upgrade_check(root.global_args.quiet);
tokio::spawn(async move {
upgrade_check(root.global_args.quiet).await;
});

let printer = print::Print::new(root.global_args.quiet);
Expand Down
4 changes: 2 additions & 2 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use std::{
sync::atomic::AtomicBool,
};
use toml_edit::{Document, TomlError};
use ureq::get;

use crate::utils::http;
use crate::{commands::global, print};

const SOROBAN_EXAMPLES_URL: &str = "https://github.com/stellar/soroban-examples.git";
Expand Down Expand Up @@ -261,7 +261,7 @@ impl Runner {
}

fn check_internet_connection() -> bool {
if let Ok(_req) = get(GITHUB_URL).call() {
if let Ok(_req) = http::blocking_client().get(GITHUB_URL).send() {
return true;
}

Expand Down
15 changes: 14 additions & 1 deletion cmd/soroban-cli/src/commands/global.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
use clap::arg;
use clap::{
arg,
builder::styling::{AnsiColor, Effects, Styles},
};
use std::path::PathBuf;

use super::config;

const USAGE_STYLES: Styles = Styles::styled()
.header(AnsiColor::Green.on_default().effects(Effects::BOLD))
.usage(AnsiColor::Green.on_default().effects(Effects::BOLD))
.literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
.placeholder(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
.error(AnsiColor::Red.on_default().effects(Effects::BOLD))
.valid(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
.invalid(AnsiColor::Yellow.on_default().effects(Effects::BOLD));

#[derive(Debug, clap::Args, Clone, Default)]
#[group(skip)]
#[allow(clippy::struct_excessive_bools)]
#[command(styles = USAGE_STYLES)]
pub struct Args {
#[clap(flatten)]
pub locator: config::locator::Args,
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/network/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub enum Error {
impl Cmd {
pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> {
match &self {
Cmd::Logs(cmd) => cmd.run().await?,
Cmd::Logs(cmd) => cmd.run(global_args).await?,
Cmd::Start(cmd) => cmd.run(global_args).await?,
Cmd::Stop(cmd) => cmd.run(global_args).await?,
}
Expand Down
10 changes: 7 additions & 3 deletions cmd/soroban-cli/src/commands/network/container/logs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use futures_util::TryStreamExt;

use crate::commands::network::container::shared::Error as ConnectionError;
use crate::{
commands::{global, network::container::shared::Error as ConnectionError},
print,
};

use super::shared::{Args, Name};

Expand All @@ -23,9 +26,10 @@ pub struct Cmd {
}

impl Cmd {
pub async fn run(&self) -> Result<(), Error> {
pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> {
let print = print::Print::new(global_args.quiet);
let container_name = Name(self.name.clone()).get_internal_container_name();
let docker = self.container_args.connect_to_docker().await?;
let docker = self.container_args.connect_to_docker(&print).await?;
let logs_stream = &mut docker.logs(
&container_name,
Some(bollard::container::LogsOptions {
Expand Down
Loading

0 comments on commit 1775ad2

Please sign in to comment.