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

Rollup of 5 pull requests #42173

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b384b18
Refactor: Move the mutable parts out of LintStore. Fix #42007.
kennytm May 15, 2017
f8b66a0
trace_macro: Show both the macro call and its expansion. #42072.
jorendorff May 19, 2017
a355c67
Use the improved submodule handling
ishitatsuyuki May 18, 2017
ed49d7c
Format bootstrap.py using autopep8
ishitatsuyuki May 19, 2017
8f111f3
bootstrap.py: Filter instead of iteration
ishitatsuyuki May 19, 2017
d34aaa1
bootstrap.py: decode to str
ishitatsuyuki May 22, 2017
6dde3f4
Move some tests from compile-fail to ui
oli-obk May 16, 2017
ec1fa6d
Change macro typo helps to suggestions
oli-obk May 16, 2017
27359bd
Change enum variant help into a suggestion
oli-obk May 16, 2017
e328ef0
Change some "did you mean `self.*`" messages to suggestions
oli-obk May 16, 2017
8add02a
Changes in ui tests
oli-obk May 16, 2017
e618a4f
Add some guidelines for suggestion messages and follow them
oli-obk May 18, 2017
a9b54ab
Update ui tests output
oli-obk May 18, 2017
9d41d0e
Move a compile-fail test to ui
oli-obk May 18, 2017
bff4795
Tidy errors
oli-obk May 18, 2017
6f681c2
Fix line numbers in ui test
oli-obk May 22, 2017
1343bc6
Readd //~ERROR messages
oli-obk May 22, 2017
150d644
rustbuild: split Install out of Dist subcommand
Keruspe May 18, 2017
72eb010
update-all-references.sh doesn't deterministically work on ui-fulldeps
oli-obk May 23, 2017
5960da2
Rollup merge of #42033 - oli-obk:suggestions, r=petrochenkov
frewsxcv May 23, 2017
b2310e1
Rollup merge of #42052 - kennytm:fix-42007-ice-on-decode-lint-id, r=n…
frewsxcv May 23, 2017
f43960f
Rollup merge of #42081 - ishitatsuyuki:submodule-better, r=aidanhs
frewsxcv May 23, 2017
d1f6df3
Rollup merge of #42103 - jorendorff:master, r=estebank
frewsxcv May 23, 2017
61e9ff9
Rollup merge of #42109 - Keruspe:master, r=alexcrichton
frewsxcv May 23, 2017
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ Read ["Installing Rust"] from [The Book].
3. Build and install:

```sh
$ ./x.py build && sudo ./x.py dist --install
$ ./x.py build && sudo ./x.py install
```

> ***Note:*** Install locations can be adjusted by copying the config file
> from `./src/bootstrap/config.toml.example` to `./config.toml`, and
> adjusting the `prefix` option under `[install]`. Various other options are
> also supported, and are documented in the config file.

When complete, `sudo ./x.py dist --install` will place several programs into
When complete, `sudo ./x.py install` will place several programs into
`/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
API-documentation tool. This install does not include [Cargo],
Rust's package manager, which you may also want to build.
Expand Down Expand Up @@ -96,7 +96,7 @@ build.
4. Navigate to Rust's source code (or clone it), then build it:

```sh
$ ./x.py build && ./x.py dist --install
$ ./x.py build && ./x.py install
```

#### MSVC
Expand Down
173 changes: 83 additions & 90 deletions src/bootstrap/bootstrap.py

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,9 @@
# Note that this address should not contain a trailing slash as file names will
# be appended to it.
#upload-addr = "https://example.com/folder"

# Whether to build a plain source tarball to upload
# We disable that on Windows not to override the one already uploaded on S3
# as the one built on Windows will contain backslashes in paths causing problems
# on linux
#src-tarball = true
182 changes: 91 additions & 91 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ use {Build, Compiler, Mode};
use channel;
use util::{cp_r, libdir, is_dylib, cp_filtered, copy, exe};

fn pkgname(build: &Build, component: &str) -> String {
pub fn pkgname(build: &Build, component: &str) -> String {
if component == "cargo" {
format!("{}-{}", component, build.cargo_package_vers())
} else if component == "rls" {
format!("{}-{}", component, build.package_vers(&build.release_num("rls")))
format!("{}-{}", component, build.rls_package_vers())
} else {
assert!(component.starts_with("rust"));
format!("{}-{}", component, build.rust_package_vers())
Expand Down Expand Up @@ -369,38 +369,7 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
t!(fs::remove_dir_all(&image));
}

const CARGO_VENDOR_VERSION: &'static str = "0.1.4";

/// Creates the `rust-src` installer component and the plain source tarball
pub fn rust_src(build: &Build) {
if !build.config.rust_dist_src {
return
}

println!("Dist src");

// Make sure that the root folder of tarball has the correct name
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
let plain_dst_src = tmpdir(build).join(&plain_name);
let _ = fs::remove_dir_all(&plain_dst_src);
t!(fs::create_dir_all(&plain_dst_src));

// This is the set of root paths which will become part of the source package
let src_files = [
"COPYRIGHT",
"LICENSE-APACHE",
"LICENSE-MIT",
"CONTRIBUTING.md",
"README.md",
"RELEASES.md",
"configure",
"x.py",
];
let src_dirs = [
"man",
"src",
];

fn copy_src_dirs(build: &Build, src_dirs: &[&str], dst_dir: &Path) {
let filter_fn = move |path: &Path| {
let spath = match path.to_str() {
Some(path) => path,
Expand Down Expand Up @@ -429,60 +398,16 @@ pub fn rust_src(build: &Build) {
};

// Copy the directories using our filter
for item in &src_dirs {
let dst = &plain_dst_src.join(item);
t!(fs::create_dir(dst));
for item in src_dirs {
let dst = &dst_dir.join(item);
t!(fs::create_dir_all(dst));
cp_filtered(&build.src.join(item), dst, &filter_fn);
}
// Copy the files normally
for item in &src_files {
copy(&build.src.join(item), &plain_dst_src.join(item));
}

// If we're building from git sources, we need to vendor a complete distribution.
if build.src_is_git {
// Get cargo-vendor installed, if it isn't already.
let mut has_cargo_vendor = false;
let mut cmd = Command::new(&build.cargo);
for line in output(cmd.arg("install").arg("--list")).lines() {
has_cargo_vendor |= line.starts_with("cargo-vendor ");
}
if !has_cargo_vendor {
let mut cmd = Command::new(&build.cargo);
cmd.arg("install")
.arg("--force")
.arg("--debug")
.arg("--vers").arg(CARGO_VENDOR_VERSION)
.arg("cargo-vendor")
.env("RUSTC", &build.rustc);
build.run(&mut cmd);
}

// Vendor all Cargo dependencies
let mut cmd = Command::new(&build.cargo);
cmd.arg("vendor")
.current_dir(&plain_dst_src.join("src"));
build.run(&mut cmd);
}

// Create the version file
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());

// Create plain source tarball
let mut tarball = rust_src_location(build);
tarball.set_extension(""); // strip .gz
tarball.set_extension(""); // strip .tar
if let Some(dir) = tarball.parent() {
t!(fs::create_dir_all(dir));
}
let mut cmd = rust_installer(build);
cmd.arg("tarball")
.arg("--input").arg(&plain_name)
.arg("--output").arg(&tarball)
.arg("--work-dir=.")
.current_dir(tmpdir(build));
build.run(&mut cmd);
}

/// Creates the `rust-src` installer component
pub fn rust_src(build: &Build) {
println!("Dist src");

let name = pkgname(build, "rust-src");
let image = tmpdir(build).join(format!("{}-image", name));
Expand Down Expand Up @@ -516,11 +441,7 @@ pub fn rust_src(build: &Build) {
"src/rustc/libc_shim",
];

for item in &std_src_dirs {
let dst = &dst_src.join(item);
t!(fs::create_dir_all(dst));
cp_r(&plain_dst_src.join(item), dst);
}
copy_src_dirs(build, &std_src_dirs[..], &dst_src);

// Create source tarball in rust-installer format
let mut cmd = rust_installer(build);
Expand All @@ -537,7 +458,86 @@ pub fn rust_src(build: &Build) {
build.run(&mut cmd);

t!(fs::remove_dir_all(&image));
t!(fs::remove_dir_all(&plain_dst_src));
}

const CARGO_VENDOR_VERSION: &'static str = "0.1.4";

/// Creates the plain source tarball
pub fn plain_source_tarball(build: &Build) {
println!("Create plain source tarball");

// Make sure that the root folder of tarball has the correct name
let plain_name = format!("{}-src", pkgname(build, "rustc"));
let plain_dst_src = tmpdir(build).join(&plain_name);
let _ = fs::remove_dir_all(&plain_dst_src);
t!(fs::create_dir_all(&plain_dst_src));

// This is the set of root paths which will become part of the source package
let src_files = [
"COPYRIGHT",
"LICENSE-APACHE",
"LICENSE-MIT",
"CONTRIBUTING.md",
"README.md",
"RELEASES.md",
"configure",
"x.py",
];
let src_dirs = [
"man",
"src",
];

copy_src_dirs(build, &src_dirs[..], &plain_dst_src);

// Copy the files normally
for item in &src_files {
copy(&build.src.join(item), &plain_dst_src.join(item));
}

// Create the version file
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());

// If we're building from git sources, we need to vendor a complete distribution.
if build.src_is_git {
// Get cargo-vendor installed, if it isn't already.
let mut has_cargo_vendor = false;
let mut cmd = Command::new(&build.cargo);
for line in output(cmd.arg("install").arg("--list")).lines() {
has_cargo_vendor |= line.starts_with("cargo-vendor ");
}
if !has_cargo_vendor {
let mut cmd = Command::new(&build.cargo);
cmd.arg("install")
.arg("--force")
.arg("--debug")
.arg("--vers").arg(CARGO_VENDOR_VERSION)
.arg("cargo-vendor")
.env("RUSTC", &build.rustc);
build.run(&mut cmd);
}

// Vendor all Cargo dependencies
let mut cmd = Command::new(&build.cargo);
cmd.arg("vendor")
.current_dir(&plain_dst_src.join("src"));
build.run(&mut cmd);
}

// Create plain source tarball
let mut tarball = rust_src_location(build);
tarball.set_extension(""); // strip .gz
tarball.set_extension(""); // strip .tar
if let Some(dir) = tarball.parent() {
t!(fs::create_dir_all(dir));
}
let mut cmd = rust_installer(build);
cmd.arg("tarball")
.arg("--input").arg(&plain_name)
.arg("--output").arg(&tarball)
.arg("--work-dir=.")
.current_dir(tmpdir(build));
build.run(&mut cmd);
}

fn install(src: &Path, dstdir: &Path, perms: u32) {
Expand Down
17 changes: 12 additions & 5 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ pub enum Subcommand {
Clean,
Dist {
paths: Vec<PathBuf>,
install: bool,
},
Install {
paths: Vec<PathBuf>,
},
}

Expand All @@ -85,7 +87,8 @@ Subcommands:
bench Build and run some benchmarks
doc Build documentation
clean Clean out build directories
dist Build and/or install distribution artifacts
dist Build distribution artifacts
install Install distribution artifacts

To learn more about a subcommand, run `./x.py <subcommand> -h`");

Expand Down Expand Up @@ -125,7 +128,8 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
|| (s == "bench")
|| (s == "doc")
|| (s == "clean")
|| (s == "dist"));
|| (s == "dist")
|| (s == "install"));
let subcommand = match possible_subcommands.first() {
Some(s) => s,
None => {
Expand All @@ -139,7 +143,6 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
match subcommand.as_str() {
"test" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
"dist" => { opts.optflag("", "install", "run installer as well"); },
_ => { },
};

Expand Down Expand Up @@ -281,7 +284,11 @@ Arguments:
"dist" => {
Subcommand::Dist {
paths: paths,
install: matches.opt_present("install"),
}
}
"install" => {
Subcommand::Install {
paths: paths,
}
}
_ => {
Expand Down
Loading