foundry_compilers/compilers/vyper/
settings.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use std::{collections::BTreeSet, path::PathBuf};

pub use crate::artifacts::vyper::VyperSettings;
use crate::compilers::CompilerSettings;
use foundry_compilers_artifacts::output_selection::OutputSelection;

impl CompilerSettings for VyperSettings {
    fn update_output_selection(&mut self, f: impl FnOnce(&mut OutputSelection)) {
        f(&mut self.output_selection)
    }

    fn can_use_cached(&self, other: &Self) -> bool {
        let Self {
            evm_version,
            optimize,
            bytecode_metadata,
            output_selection,
            search_paths,
            experimental_codegen,
        } = self;
        evm_version == &other.evm_version
            && optimize == &other.optimize
            && bytecode_metadata == &other.bytecode_metadata
            && output_selection.is_subset_of(&other.output_selection)
            && search_paths == &other.search_paths
            && experimental_codegen == &other.experimental_codegen
    }

    fn with_include_paths(mut self, include_paths: &BTreeSet<PathBuf>) -> Self {
        self.search_paths = Some(include_paths.clone());
        self
    }
}