Skip to content

Commit

Permalink
add default impl for set_rule and set_globals in ninja_target trait (#84
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rjodinchr authored Dec 20, 2024
1 parent fa6bf93 commit 6d290b5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/ninja_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ pub trait NinjaTarget: std::fmt::Debug {
fn get_name(&self, prefix: &Path) -> String {
path_to_id(prefix.join(&self.get_outputs()[0]))
}
fn set_globals(&mut self, _globals: HashMap<String, String>) {}
fn set_rule(&mut self, _rules: &NinjaRulesMap) {}

fn set_globals(&mut self, globals: HashMap<String, String>);
fn set_rule(&mut self, rules: &NinjaRulesMap);
fn get_rule(&self) -> Option<NinjaRule>;
fn get_inputs(&self) -> &Vec<PathBuf>;
fn get_implicit_deps(&self) -> &Vec<PathBuf>;
Expand Down
4 changes: 0 additions & 4 deletions src/ninja_target/cmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ impl NinjaTarget for CmakeNinjaTarget {
}
}

fn set_globals(&mut self, _globals: HashMap<String, String>) {}

fn set_rule(&mut self, _rules: &NinjaRulesMap) {}

fn get_rule(&self) -> Option<NinjaRule> {
Some(if self.rule.starts_with("CXX_SHARED_LIBRARY") {
NinjaRule::SharedLibrary
Expand Down
4 changes: 0 additions & 4 deletions src/ninja_target/meson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ impl NinjaTarget for MesonNinjaTarget {
}
}

fn set_globals(&mut self, _globals: HashMap<String, String>) {}

fn set_rule(&mut self, _rules: &NinjaRulesMap) {}

fn get_rule(&self) -> Option<NinjaRule> {
Some(if self.rule == "c_LINKER" || self.rule == "cpp_LINKER" {
let (_, link_flags) = self.get_link_flags();
Expand Down

0 comments on commit 6d290b5

Please sign in to comment.