Unverified Commit a04e159f authored by Michael Müller's avatar Michael Müller
Browse files

Merge branch 'master' into cmichi-add-build-script-output

parents dff930df 82157f46
Pipeline #184332 passed with stages
in 6 minutes and 1 second
...@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added
- `--skip-linting` flag that allows to skip the linting step during build process - [#468](https://github.com/paritytech/cargo-contract/pull/468)
## [1.0.1] - 2022-03-18 ## [1.0.1] - 2022-03-18
- Improved error reporting during installation - [#468](https://github.com/paritytech/cargo-contract/pull/468) - Improved error reporting during installation - [#468](https://github.com/paritytech/cargo-contract/pull/468)
......
...@@ -50,6 +50,7 @@ pub(crate) struct ExecuteArgs { ...@@ -50,6 +50,7 @@ pub(crate) struct ExecuteArgs {
unstable_flags: UnstableFlags, unstable_flags: UnstableFlags,
optimization_passes: OptimizationPasses, optimization_passes: OptimizationPasses,
keep_debug_symbols: bool, keep_debug_symbols: bool,
skip_linting: bool,
output_type: OutputType, output_type: OutputType,
} }
...@@ -73,6 +74,9 @@ pub struct BuildCommand { ...@@ -73,6 +74,9 @@ pub struct BuildCommand {
/// Build offline /// Build offline
#[clap(long = "--offline")] #[clap(long = "--offline")]
build_offline: bool, build_offline: bool,
/// Skips linting checks during the build process
#[clap(long = "--skip-linting")]
skip_linting: bool,
/// Which build artifacts to generate. /// Which build artifacts to generate.
/// ///
/// - `all`: Generate the Wasm, the metadata and a bundled `<name>.contract` file. /// - `all`: Generate the Wasm, the metadata and a bundled `<name>.contract` file.
...@@ -176,6 +180,7 @@ impl BuildCommand { ...@@ -176,6 +180,7 @@ impl BuildCommand {
unstable_flags, unstable_flags,
optimization_passes, optimization_passes,
keep_debug_symbols: self.keep_debug_symbols, keep_debug_symbols: self.keep_debug_symbols,
skip_linting: self.skip_linting,
output_type, output_type,
}; };
...@@ -211,6 +216,7 @@ impl CheckCommand { ...@@ -211,6 +216,7 @@ impl CheckCommand {
unstable_flags, unstable_flags,
optimization_passes: OptimizationPasses::Zero, optimization_passes: OptimizationPasses::Zero,
keep_debug_symbols: false, keep_debug_symbols: false,
skip_linting: false,
output_type: OutputType::default(), output_type: OutputType::default(),
}; };
...@@ -760,6 +766,7 @@ pub(crate) fn execute(args: ExecuteArgs) -> Result<BuildResult> { ...@@ -760,6 +766,7 @@ pub(crate) fn execute(args: ExecuteArgs) -> Result<BuildResult> {
unstable_flags, unstable_flags,
optimization_passes, optimization_passes,
keep_debug_symbols, keep_debug_symbols,
skip_linting,
output_type, output_type,
} = args; } = args;
...@@ -771,13 +778,22 @@ pub(crate) fn execute(args: ExecuteArgs) -> Result<BuildResult> { ...@@ -771,13 +778,22 @@ pub(crate) fn execute(args: ExecuteArgs) -> Result<BuildResult> {
} }
let build = || -> Result<OptimizationResult> { let build = || -> Result<OptimizationResult> {
maybe_println!( if skip_linting {
verbosity, maybe_println!(
" {} {}", verbosity,
format!("[1/{}]", build_artifact.steps()).bold(), " {} {}",
"Checking ink! linting rules".bright_green().bold() format!("[1/{}]", build_artifact.steps()).bold(),
); "Skip ink! linting rules".bright_yellow().bold()
exec_cargo_dylint(&crate_metadata, verbosity)?; );
} else {
maybe_println!(
verbosity,
" {} {}",
format!("[1/{}]", build_artifact.steps()).bold(),
"Checking ink! linting rules".bright_green().bold()
);
exec_cargo_dylint(&crate_metadata, verbosity)?;
}
maybe_println!( maybe_println!(
verbosity, verbosity,
...@@ -816,13 +832,22 @@ pub(crate) fn execute(args: ExecuteArgs) -> Result<BuildResult> { ...@@ -816,13 +832,22 @@ pub(crate) fn execute(args: ExecuteArgs) -> Result<BuildResult> {
let (opt_result, metadata_result) = match build_artifact { let (opt_result, metadata_result) = match build_artifact {
BuildArtifacts::CheckOnly => { BuildArtifacts::CheckOnly => {
maybe_println!( if skip_linting {
verbosity, maybe_println!(
" {} {}", verbosity,
format!("[1/{}]", build_artifact.steps()).bold(), " {} {}",
"Checking ink! linting rules".bright_green().bold() format!("[1/{}]", build_artifact.steps()).bold(),
); "Skip ink! linting rules".bright_yellow().bold()
exec_cargo_dylint(&crate_metadata, verbosity)?; );
} else {
maybe_println!(
verbosity,
" {} {}",
format!("[1/{}]", build_artifact.steps()).bold(),
"Checking ink! linting rules".bright_green().bold()
);
exec_cargo_dylint(&crate_metadata, verbosity)?;
}
maybe_println!( maybe_println!(
verbosity, verbosity,
...@@ -1029,6 +1054,7 @@ mod tests_ci_only { ...@@ -1029,6 +1054,7 @@ mod tests_ci_only {
// we choose zero optimization passes as the "cli" parameter // we choose zero optimization passes as the "cli" parameter
optimization_passes: Some(OptimizationPasses::Zero), optimization_passes: Some(OptimizationPasses::Zero),
keep_debug_symbols: false, keep_debug_symbols: false,
skip_linting: false,
output_json: false, output_json: false,
}; };
...@@ -1070,6 +1096,7 @@ mod tests_ci_only { ...@@ -1070,6 +1096,7 @@ mod tests_ci_only {
// we choose no optimization passes as the "cli" parameter // we choose no optimization passes as the "cli" parameter
optimization_passes: None, optimization_passes: None,
keep_debug_symbols: false, keep_debug_symbols: false,
skip_linting: false,
output_json: false, output_json: false,
}; };
...@@ -1239,6 +1266,7 @@ mod tests_ci_only { ...@@ -1239,6 +1266,7 @@ mod tests_ci_only {
unstable_options: UnstableOptions::default(), unstable_options: UnstableOptions::default(),
optimization_passes: None, optimization_passes: None,
keep_debug_symbols: false, keep_debug_symbols: false,
skip_linting: false,
output_json: false, output_json: false,
}; };
let res = cmd.exec().expect("build failed"); let res = cmd.exec().expect("build failed");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment