Struct fac::build::Build
[−]
[src]
pub struct Build { /* fields omitted */ }
A struct that holds all the information needed to build. You can think of this as behaving like a set of global variables, but we can drop the whole thing.
Build is implmented using a type witness ID
, which makes it
impossible to create RuleRefs and FileRefs that are out of bounds.
I really should put some of these things in a "private" module so
that I can provide stronger guarantees of correctness in the main
build module.
Methods
impl Build
[src]
fn build(self) -> i32
Run the actual build!
fn new_file<P: AsRef<Path>>(&mut self, path: P) -> FileRef
Look up a File
corresponding to a path, or if it doesn't
exist, allocate space for a new File
.
fn new_rule(
&mut self,
command: &OsStr,
working_directory: &Path,
facfile: FileRef,
linenum: usize,
cache_suffixes: HashSet<OsString>,
cache_prefixes: HashSet<OsString>,
is_default: bool
) -> Result<RuleRef, RuleRef>
&mut self,
command: &OsStr,
working_directory: &Path,
facfile: FileRef,
linenum: usize,
cache_suffixes: HashSet<OsString>,
cache_prefixes: HashSet<OsString>,
is_default: bool
) -> Result<RuleRef, RuleRef>
Allocate space for a new Rule
.
fn read_facfile(&mut self, fileref: FileRef) -> Result<()>
Read a fac file
fn print_fac_file(&mut self, fileref: FileRef) -> Result<()>
Write a fac file
fn save_factum_files(&mut self) -> Result<()>
Write factum files
fn save_factum_file(&mut self, fileref: FileRef) -> Result<()>
Write a fac.tum file
fn write_makefile<F: Write>(&self, f: &mut F) -> Result<()>
Output a makefile to do the build
fn write_script<F: Write>(&self, f: &mut F) -> Result<()>
Output a script to do the build
fn write_ninja<F: Write>(&self, f: &mut F) -> Result<()>
Output a .ninja file to do the build
fn write_tupfile<F: Write>(&self, f: &mut F) -> Result<()>
Output a tupfile to do the build
fn add_input(&mut self, r: RuleRef, input: FileRef)
Add a new File as an input to this rule.
fn add_output(&mut self, r: RuleRef, output: FileRef)
Add a new File as an output of this rule.
fn set_status(&mut self, r: RuleRef, s: Status)
Adjust the status of this rule, making sure to keep our sets up to date.
fn is_file_done(&self, f: FileRef) -> bool
Is this file built yet?
fn show_rules_status(&self)
For debugging show all rules and their current status.
fn spawn(&mut self, r: RuleRef) -> Result<()>
Actually run a command.
fn finish_rule(&mut self, r: RuleRef, stat: Status) -> Result<()>
Handle a rule finishing.
fn pretty_path(&self, p: FileRef) -> PathBuf
Formats the path nicely as a relative path if possible
fn pretty_path_peek(&self, p: FileRef) -> &Path
Formats the path nicely as a relative path if possible
fn pretty_rule(&self, r: RuleRef) -> String
Formats the rule nicely if possible
fn pretty_reason(&self, r: RuleRef) -> String
pretty_reason is a way of describing a rule in terms of why it needs to be built. If the rule is always built by default, it gives the same output that pretty_rule does. However, if it is a non-default rule, it selects an output which is actually needed to describe why it needs to be built.
fn pretty_rule_output(&self, r: RuleRef) -> PathBuf
pretty_rule_output gives a filepath that would be built by the rule.
fn rule_mut(&mut self, r: RuleRef) -> &mut Rule
Look up the rule
fn rule(&self, r: RuleRef) -> &Rule
Look up the rule
fn is_git_path(&self, path: &Path) -> bool
This is a path in the git repository that we should ignore
fn is_boring(&self, path: &Path) -> bool
This path is inherently boring
Trait Implementations
impl Debug for Build
[src]
impl Index<FileRef> for Build
[src]
type Output = File
The returned type after indexing
fn index(&self, r: FileRef) -> &File
The method for the indexing (container[index]
) operation