Skip to content

Commit

Permalink
fix(build): Installation instructions for linter (#1546)
Browse files Browse the repository at this point in the history
* fix(build): installation instructions for linter

Closes #1540

* fix: Update README

* fix(build): formatting on missing toolchain

Closes #1538

* chore: Update changelog
  • Loading branch information
jubnzv authored Mar 14, 2024
1 parent e4b3d3d commit c186aed
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Fix installation instructions for `ink_linting` - [#1546](https://github.com/paritytech/cargo-contract/pull/1546)

## [4.0.1]

### Fixed
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ Modern releases of gcc and clang, as well as Visual Studio 2019+ should work.

- Step 2: `cargo install --force --locked cargo-contract`.

- Step 3: Install `dylint` for linting.
- Step 3: Install dependencies for linting.

- (MacOS) `brew install openssl`
- `cargo install cargo-dylint dylint-link`.
- ```
export TOOLCHAIN_VERSION=nightly-2023-12-28
rustup install $TOOLCHAIN_VERSION
rustup component add rust-src --toolchain $TOOLCHAIN_VERSION
rustup run $TOOLCHAIN_VERSION cargo install cargo-dylint dylint-link
```

- Step 4: (**Optional**) Install [Docker Engine](https://docs.docker.com/engine/install)
to be able to produce verifiable builds.
Expand Down
14 changes: 10 additions & 4 deletions crates/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,17 +628,23 @@ fn check_dylint_requirements(_working_dir: Option<&Path>) -> Result<()> {
String::from_utf8_lossy(&output.stdout).contains(linting::TOOLCHAIN_VERSION),
format!(
"Toolchain `{0}` was not found!\n\
This specific version is required to provide additional source code analysis.\n\n
You can install it by executing `rustup install {0}`.",
This specific version is required to provide additional source code analysis.\n\n\
You can install it by executing:\n\
rustup install {0}\n\
rustup component add rust-src --toolchain {0}\n\
rustup run {0} cargo install cargo-dylint dylint-link",
linting::TOOLCHAIN_VERSION,
)
.to_string()
.bright_yellow());
} else {
anyhow::bail!(format!(
"Toolchain `{0}` was not found!\n\
This specific version is required to provide additional source code analysis.\n\n
Install `rustup` according to https://rustup.rs/ and then run: `rustup install {0}`.",
This specific version is required to provide additional source code analysis.\n\n\
Install `rustup` according to https://rustup.rs/ and then run:\
rustup install {0}\n\
rustup component add rust-src --toolchain {0}\n\
rustup run {0} cargo install cargo-dylint dylint-link",
linting::TOOLCHAIN_VERSION,
)
.to_string()
Expand Down

0 comments on commit c186aed

Please sign in to comment.