]>
git.proxmox.com Git - rustc.git/blob - src/bootstrap/build/clean.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! Implementation of `make clean` in rustbuild.
13 //! Responsible for cleaning out a build directory of all old and stale
14 //! artifacts to prepare for a fresh build. Currently doesn't remove the
15 //! `build/cache` directory (download cache) or the `build/$target/llvm`
16 //! directory as we want that cached between builds.
23 pub fn clean(build
: &Build
) {
24 rm_rf(build
, "tmp".as_ref());
25 rm_rf(build
, &build
.out
.join("tmp"));
27 for host
in build
.config
.host
.iter() {
29 let out
= build
.out
.join(host
);
31 rm_rf(build
, &out
.join("compiler-rt"));
32 rm_rf(build
, &out
.join("doc"));
35 rm_rf(build
, &out
.join(format
!("stage{}", stage
)));
36 rm_rf(build
, &out
.join(format
!("stage{}-std", stage
)));
37 rm_rf(build
, &out
.join(format
!("stage{}-rustc", stage
)));
38 rm_rf(build
, &out
.join(format
!("stage{}-tools", stage
)));
39 rm_rf(build
, &out
.join(format
!("stage{}-test", stage
)));
44 fn rm_rf(build
: &Build
, path
: &Path
) {
46 build
.verbose(&format
!("removing `{}`", path
.display()));
47 t
!(fs
::remove_dir_all(path
));