Skip to content

Commit

Permalink
Fix master (use-ink#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Müller authored Mar 18, 2021
1 parent afc190b commit bddfdf6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/cmd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ fn do_optimization(
let codegen_config = binaryen::CodegenConfig {
// Number of optimization passes (spends potentially a lot of time optimizing)
optimization_level: optimization_level.to_passes(),
// the default
// The default
shrink_level: optimization_level.to_shrink(),
// the default
// The default
debug_info: false,
};
let mut module = binaryen::Module::read(&dest_wasm_file_content)
Expand Down Expand Up @@ -478,7 +478,8 @@ pub(crate) fn execute_with_crate_metadata(
#[cfg(test)]
mod tests_ci_only {
use crate::{
cmd, util::tests::with_tmp_dir, BuildArtifacts, ManifestPath, UnstableFlags, Verbosity,
cmd, util::tests::with_tmp_dir, BuildArtifacts, ManifestPath, OptimizationPasses,
UnstableFlags, Verbosity,
};

#[test]
Expand All @@ -487,14 +488,13 @@ mod tests_ci_only {
cmd::new::execute("new_project", Some(path)).expect("new project creation failed");
let manifest_path =
ManifestPath::new(&path.join("new_project").join("Cargo.toml")).unwrap();
let optimization_passes = 3;
let res = super::execute(
&manifest_path,
Verbosity::Default,
true,
BuildArtifacts::All,
UnstableFlags::default(),
optimization_passes,
OptimizationPasses::default(),
)
.expect("build failed");

Expand Down Expand Up @@ -523,7 +523,6 @@ mod tests_ci_only {
cmd::new::execute("new_project", Some(path)).expect("new project creation failed");
let project_dir = path.join("new_project");
let manifest_path = ManifestPath::new(&project_dir.join("Cargo.toml")).unwrap();
let optimization_passes = 3;

// when
super::execute(
Expand All @@ -532,7 +531,7 @@ mod tests_ci_only {
true,
BuildArtifacts::CheckOnly,
UnstableFlags::default(),
optimization_passes,
OptimizationPasses::default(),
)
.expect("build failed");

Expand Down
3 changes: 2 additions & 1 deletion src/cmd/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ mod tests {
use crate::cmd::metadata::blake2_hash;
use crate::{
cmd, crate_metadata::CrateMetadata, util::tests::with_tmp_dir, BuildArtifacts,
ManifestPath, UnstableFlags, Verbosity,
ManifestPath, OptimizationPasses, UnstableFlags, Verbosity,
};
use contract_metadata::*;
use serde_json::{Map, Value};
Expand Down Expand Up @@ -386,6 +386,7 @@ mod tests {
Verbosity::Default,
BuildArtifacts::All,
UnstableFlags::default(),
OptimizationPasses::default(),
)?
.dest_bundle
.expect("bundle file not found");
Expand Down
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl ExtrinsicOpts {

#[derive(Clone, Debug, StructOpt)]
pub struct OptimizationFlags {
/// number of optimization passes, passed as an argument to wasm-opt
/// Number of optimization passes, passed as an argument to wasm-opt.
///
/// - `0`: execute no optimization passes
///
Expand Down Expand Up @@ -128,6 +128,12 @@ pub enum OptimizationPasses {
Z,
}

impl Default for OptimizationPasses {
fn default() -> OptimizationPasses {
OptimizationPasses::Three
}
}

impl TryFrom<&OptimizationFlags> for OptimizationPasses {
type Error = Error;

Expand Down

0 comments on commit bddfdf6

Please sign in to comment.