Skip to content

Commit

Permalink
wasm-builder: bump toml from 0.8.2 to 0.8.8; replace ansi_term (#2914)
Browse files Browse the repository at this point in the history
Hi folks!

Thank for the well organized codebase and an outstanding engineering!

I am trying to compile a substrate node template from source
(https://github.com/paritytech/polkadot-sdk) and encountered a
dependency conflict
![Screenshot 2024-01-11 at 12 22
16](https://github.com/paritytech/polkadot-sdk/assets/16288656/b630773f-9d58-4abc-a15c-45f0e6b96b48)
and a deprecation warning from advisory db for `ansi_term` (I see you
replace it with some alternatives in other crates).

While for `ansi_term` there is an adopted fork
(https://github.com/rustadopt/ansiterm-rs) and it was my first commit in
the PR, I've decided to use https://github.com/console-rs/console as you
already use it to reduce dependencies (as I believe other substrate
crates will remove ansi_term eventually)

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
  • Loading branch information
maksimryndin and bkchr authored Jan 13, 2024
1 parent 38a0ac0 commit 127b9be
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 31 deletions.
99 changes: 77 additions & 22 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions substrate/utils/wasm-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ workspace = true
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
ansi_term = "0.12.1"
build-helper = "0.1.1"
cargo_metadata = "0.15.4"
console = "0.15.8"
strum = { version = "0.24.1", features = ["derive"] }
tempfile = "3.1.0"
toml = "0.8.2"
toml = "0.8.8"
walkdir = "2.3.2"
sp-maybe-compressed-blob = { path = "../../primitives/maybe-compressed-blob" }
filetime = "0.2.16"
Expand Down
11 changes: 5 additions & 6 deletions substrate/utils/wasm-builder/src/prerequisites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@

use crate::{write_file_if_changed, CargoCommand, CargoCommandVersioned};

use console::style;
use std::{fs, path::Path};

use ansi_term::Color;
use tempfile::tempdir;

/// Print an error message.
fn print_error_message(message: &str) -> String {
if super::color_output_enabled() {
Color::Red.bold().paint(message).to_string()
style(message).red().bold().to_string()
} else {
message.into()
}
Expand Down Expand Up @@ -117,10 +116,10 @@ fn check_wasm_toolchain_installed(
Ok(ref err) => Err(format!(
"{}\n\n{}\n{}\n{}{}\n",
err_msg,
Color::Yellow.bold().paint("Further error information:"),
Color::Yellow.bold().paint("-".repeat(60)),
style("Further error information:").yellow().bold(),
style("-".repeat(60)).yellow().bold(),
err,
Color::Yellow.bold().paint("-".repeat(60)),
style("-".repeat(60)).yellow().bold(),
)),

Err(_) => Err(err_msg),
Expand Down
3 changes: 2 additions & 1 deletion substrate/utils/wasm-builder/src/wasm_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::{write_file_if_changed, CargoCommandVersioned, OFFLINE};

use build_helper::rerun_if_changed;
use cargo_metadata::{DependencyKind, Metadata, MetadataCommand};
use console::style;
use parity_wasm::elements::{deserialize_buffer, Module};
use std::{
borrow::ToOwned,
Expand All @@ -38,7 +39,7 @@ use walkdir::WalkDir;
/// Returns the colorized message.
fn colorize_info_message(message: &str) -> String {
if super::color_output_enabled() {
ansi_term::Color::Yellow.bold().paint(message).to_string()
style(message).yellow().bold().to_string()
} else {
message.into()
}
Expand Down

0 comments on commit 127b9be

Please sign in to comment.