Skip to content

Commit

Permalink
Update scarb.rs - naive updates to adhere to changes in Scarb code base
Browse files Browse the repository at this point in the history
  • Loading branch information
stranger80 authored Sep 2, 2024
1 parent 5684d74 commit 3b8f855
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/scarb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{env::current_dir, fs, path::PathBuf};
use itertools::Itertools;
use scarb::{
core::{Config, TargetKind},
ops::{self, collect_metadata, CompileOpts, MetadataOptions},
ops::{self, collect_metadata, CompileOpts, MetadataOptions, FeaturesOpts, FeaturesSelector},
};

const AVAILABLE_GAS: usize = 999999999;
Expand Down Expand Up @@ -64,6 +64,10 @@ pub fn scarb_run(file_path: &PathBuf) -> anyhow::Result<String> {
&MetadataOptions {
version: 1,
no_deps: false,
features: FeaturesOpts {
features: FeaturesSelector::AllFeatures,
no_default_features: false,
},
},
&ws,
)?;
Expand Down Expand Up @@ -150,6 +154,10 @@ pub fn scarb_test(file_path: &PathBuf) -> anyhow::Result<String> {
&MetadataOptions {
version: 1,
no_deps: false,
features: FeaturesOpts {
features: FeaturesSelector::AllFeatures,
no_default_features: false,
},
},
&ws,
)
Expand Down Expand Up @@ -188,6 +196,8 @@ pub fn scarb_test(file_path: &PathBuf) -> anyhow::Result<String> {
include_ignored: false,
ignored: false,
run_profiler: RunProfilerConfig::None,
gas_enabled: false,
print_resource_usage: false,
};
let runner = CompiledTestRunner::new(test_compilation, config);
runner.run(None)?;
Expand All @@ -210,12 +220,22 @@ pub fn compile(config: &Config, test_targets: bool) -> anyhow::Result<()> {
let ws = ops::read_workspace(config.manifest_path(), config)?;
let opts: CompileOpts = match test_targets {
false => CompileOpts {
include_targets: vec![],
exclude_targets: vec![TargetKind::TEST],
include_target_names: vec![],
include_target_kinds: vec![],
exclude_target_kinds: vec![TargetKind::TEST],
features: FeaturesOpts {
features: FeaturesSelector::AllFeatures,
no_default_features: false,
}
},
true => CompileOpts {
include_targets: vec![TargetKind::TEST],
exclude_targets: vec![],
include_target_names: vec![],
include_target_kinds: vec![TargetKind::TEST],
exclude_target_kinds: vec![],
features: FeaturesOpts {
features: FeaturesSelector::AllFeatures,
no_default_features: false,
}
},
};

Expand Down

0 comments on commit 3b8f855

Please sign in to comment.