Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement excluding a build-step via --exclude #48105

Merged
merged 5 commits into from
Feb 15, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix default Steps without paths.
Some Steps are by-default run but don't have any paths associated with
them. We need to have at least one PathSet per each Step, though, so we
add an empty one on calls to `never()`.
  • Loading branch information
Mark-Simulacrum committed Feb 14, 2018
commit a64575c3bd81f6f169eff22a4884984c9c5b36c0
15 changes: 10 additions & 5 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub struct RunConfig<'a> {
pub builder: &'a Builder<'a>,
pub host: Interned<String>,
pub target: Interned<String>,
pub path: &'a Path,
pub path: PathBuf,
}

struct StepDescription {
Expand All @@ -114,6 +114,10 @@ struct PathSet {
}

impl PathSet {
fn empty() -> PathSet {
PathSet { set: BTreeSet::new() }
}

fn one<P: Into<PathBuf>>(path: P) -> PathSet {
let mut set = BTreeSet::new();
set.insert(path.into());
Expand All @@ -124,8 +128,8 @@ impl PathSet {
self.set.iter().any(|p| p.ends_with(needle))
}

fn path(&self) -> &Path {
self.set.iter().next().unwrap()
fn path(&self, builder: &Builder) -> PathBuf {
self.set.iter().next().unwrap_or(&builder.build.src).to_path_buf()
}
}

Expand Down Expand Up @@ -174,7 +178,7 @@ impl StepDescription {
for target in targets {
let run = RunConfig {
builder,
path: pathset.path(),
path: pathset.path(builder),
host: *host,
target: *target,
};
Expand Down Expand Up @@ -278,7 +282,8 @@ impl<'a> ShouldRun<'a> {
}

// allows being more explicit about why should_run in Step returns the value passed to it
pub fn never(self) -> ShouldRun<'a> {
pub fn never(mut self) -> ShouldRun<'a> {
self.paths.insert(PathSet::empty());
self
}

Expand Down