Commit Graph

44 Commits

Author SHA1 Message Date
topecongiro
732d9b281c Return 0 when ./x.py has no subcommand 2017-10-27 09:26:53 +09:00
Tommy Ip
09d90e5268 Do not show "available paths" help in ./x.py clean 2017-09-20 22:10:13 +01:00
Tommy Ip
2c78bb49fd Add --all flag to ./x.py clean
This flag removes all build artifacts, including the LLVM build
directory.
2017-09-20 18:14:19 +01:00
Michal 'vorner' Vaner
6fc35de5e8
Fail ./x.py on invalid command
Make the ./x.py script fail when run with an invalid command, like:

  ./x.py nonsense

This helps in case of chaining multiple runs, eg.:

  ./x.py biuld && ./x.py test
2017-08-27 19:20:03 +02:00
Zack M. Davis
1b6c9605e4 use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
Mark Simulacrum
5290c6c8f1 Allow overriding build triple via flag.
We first check the configuration, then passed parameters (--build), then
fall back to the auto-detection that bootstrap.py does.

Fixes #39673.
2017-08-13 05:15:43 +05:00
Mark Simulacrum
44ffb61623 Unify flags into config.
This introduces a slight change in behavior, where we unilaterally
respect the --host and --target parameters passed for all sanity
checking and runtime configuration.
2017-08-13 05:15:43 +05:00
Mark Simulacrum
56128fb3ac Implement available paths list. 2017-07-20 11:24:37 -06:00
Mark Simulacrum
528646e127 Utilize interning to allow Copy/Clone steps 2017-07-20 11:24:32 -06:00
Mark Simulacrum
60388303c7 Fixes warnings and errors introduced while moving code around 2017-07-20 11:23:58 -06:00
Mark Simulacrum
39cf1da81c Store verbosity on Build
Prevents accidental mistakes in not using the right verbosity by going
to only config or flags.
2017-07-04 07:31:56 -06:00
Mark Simulacrum
4dc8fe9083 Store positive instead of negative fail_fast.
This makes later negation much easier to interpret.
2017-07-04 07:31:56 -06:00
Mark Simulacrum
2cc5b084a0 Clarify meaning of Build.cargo, Build.rustc.
Rename Build.{cargo, rustc} to {initial_cargo, initial_rustc}.
2017-07-04 07:31:56 -06:00
Mark Simulacrum
6766abbfa9 Clippy lints 2017-07-04 07:31:55 -06:00
Mark Simulacrum
7ed4ee272e Clean up and restructure sanity checking. 2017-07-04 07:31:55 -06:00
Mark Simulacrum
01e83a362c Don't allocate args in order to run find. 2017-07-04 07:31:55 -06:00
Mark Simulacrum
73267374d4 Use custom cargo/rustc paths when parsing flags. 2017-06-16 07:44:09 -06:00
Ralf Jung
7359c791b5 bootstrap: further clarify build --help 2017-06-07 22:08:48 -07:00
Ralf Jung
e37cfc7dd2 bootstrap: improve 'build --help' by explaining what exactly the last example does 2017-06-06 14:26:56 -07:00
Josh Stone
617aea4c9b rustbuild: Add ./x.py test --no-fail-fast
This option forwards to each `cargo test` invocation, and applies the
same logic across all test steps to keep going after failures.  At the
end, a brief summary line reports how many commands failed, if any.

Note that if a test program fails to even start at all, or if an
auxiliary build command related to testing fails, these are still left
to stop everything right away.

Fixes #40219.
2017-06-02 09:27:44 -07:00
Marc-Antoine Perennou
150d644c21 rustbuild: split Install out of Dist subcommand
only create source tarball for the Dist subcommand
mark install rule as default for Kind::Install
split install-docs
split install-std
factor out empty_dir handling
split install-cargo
split install-analysis
split install-src
rework install-rustc
properly handle cross-compilation setups for install
use pkgname in install
split plain source tarball generation from rust-src dist
document src-tarball in config.toml.exmaple

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2017-05-22 22:10:12 +02:00
Nathan Stocks
ea2bfae869 Branch arms need to match the return value even if it's not being assigned to anything 2017-04-04 13:50:24 -06:00
Nathan Stocks
20cb7005b0 Handle options-with-arguments before subcommands such as './x.py -j 10 build' and detect pathological cases like './x.py --option-that-takes-argument clean build' 2017-04-03 19:15:31 -06:00
Nathan Stocks
1e5389853c Fix breaking the 'clean' subcommand caused replacing a single-letter variable with the same value in two contexts where it was used differently. That's why you don't use "m" as a variable for hundreds of lines in an outer function, and re-use it in closures several times in the same function. Sheesh. 2017-04-02 13:11:53 -06:00
Nathan Stocks
6b7258670f Simplify a "use" statement as per @grunweg's feedback. 2017-04-02 12:57:09 -06:00
Nathan Stocks
2c9ae48149 Oops, we can't parse options until all options have been defined. Tiny bit of manual arg-parsing. Fixed tidy stuff too. 2017-04-02 12:57:08 -06:00
Nathan Stocks
aa4bd0ec0e Finish the improvements I planned.
- No more manual args manipulation -- getopts used for everything.
  As a result, options can be in any position, now, even before the
  subcommand.
- The additional options for test, bench, and dist now appear in the
  help output.
- No more single-letter variable bindings used internally for large
  scopes.
- Don't output the time measurement when just invoking 'x.py'
- Logic is now much more linear.  We build strings up, and then print
  them.
2017-04-02 12:57:08 -06:00
Nathan Stocks
5ba579e7f4 Save my TODO's as comments, so I don't forget. 2017-04-02 12:57:08 -06:00
Nathan Stocks
992a59efc3 Using an untyped, one-letter variable binding as an argument to a function and then not using it until over 100 lines later is just mean. 2017-04-02 12:57:08 -06:00
Nathan Stocks
584b40578d Vastly improve the help output.
- Don't print 'unknown subcommand' at the top of the help message.  The help message now clearly instructs the user to provide a subcommand.
- Clarify the usage line.  Subcommand is required.  Don't echo invalid input back out in the usage line (what the...???).  args renamed to paths, because that's what all the args are referred to elsewhere.
- List the available subcommands immediately following the usage line.  It's the one required argument, after all.
- Slightly improve the extra documentation for the build, test, and doc commands.
- Don't print 'Available invocations:' at all.  It occurred immediately before 'Available paths:'.
- Clearly state that running with '-h -v' will produce a list of available paths.
2017-04-02 12:56:52 -06:00
Nathan Stocks
8ad5c95e52 When dealing with the list of all possible subcommands, deal with them in the same order to ease comparing the sections of code in order. I chose the order that appears in the help text, because that is most likely to have been ordered with specific reasoning. 2017-03-30 20:58:07 -06:00
Nathan Stocks
e1b0027b51 Refer to a subcommand as a subcommand.
For some reason 'command' and 'subcommand' were intermixed to mean the same thing.  Lets just call it the one thing that it is.
2017-03-30 20:49:06 -06:00
Simonas Kazlauskas
0e45a5ed3f [rustbuild] add a way to run command after failure
This is a simple way to workaround the debugging issues caused by the rustc
wrapper used in the bootstrap process. Namely, it uses some obscure environment
variables and you can’t just copy the failed command and run it in the shell or
debugger to examine the failure more closely.

With `--on-fail` its possible to run an arbitrary command within exactly the
same environment under which rustc failed. Theres’s multiple ways to use this
new flag:

$ python x.py build --stage=1 --on-fail=env

    would print a list of environment variables and the failed command, so a
    few copy-pastes and you now can run the same rust in your shell outside the
    bootstrap system.

$ python x.py build --stage=1 --on-fail=bash

    Is a more useful variation of the command above in that it launches a whole
    shell with environment already in place! All that’s left to do is copy-paste
    the command just above the shell prompt!

Fixes #38686
Fixes #38221
2017-02-16 21:12:38 +02:00
Alex Crichton
6b23cc48db travis: Expand the cross linux image
This expands the `cross` travis matrix entry with a few more targets that our
nightlies are building:

* x86_64-rumprun-netbsd
* arm-unknown-linux-musleabi
* arm-unknown-linux-musleabihf
* armv7-unknown-linux-musleabihf
* mips-unknown-linux-musl
* mipsel-unknown-linux-musl

This commit doesn't compile custom toolchains like our current cross-image does,
but instead compiles musl manually and then compiles libunwind manually (like
x86_64) for use for the ARM targets and just uses openwrt toolchains for the
mips targets.
2017-01-16 18:50:01 -08:00
Alex Crichton
318767266f travis: Start uploading artifacts on commits
This commit starts adding the infrastructure for uploading release artifacts
from AppVeyor/Travis on each commit. The idea is that eventually we'll upload a
full release to AppVeyor/Travis in accordance with plans [outlined earlier].

Right now this configures Travis/Appveyor to upload all tarballs in the `dist`
directory, and various images are updated to actually produce tarballs in these
directories. These are nowhere near ready to be actual release artifacts, but
this should allow us to play around with it and test it out. Once this commit
lands we should start seeing artifacts uploaded on each commit.

[outlined earlier]: https://internals.rust-lang.org/t/rust-ci-release-infrastructure-changes/4489
2017-01-12 15:29:04 -08:00
Alex Crichton
57cf2ab31c rustbuild: Deny and fix warnings
Turned out this lint uncovered an actual bug!

Closes #38484
2016-12-20 09:38:57 -08:00
Niko Matsakis
83453bc673 add and document --incremental flag along with misc other changes
For example:

- we now support `-vv` to get very verbose output.
- RUSTFLAGS is respected by `x.py`
- better error messages for some cases
2016-12-19 11:46:38 -05:00
bors
f70ad0adfd Auto merge of #38331 - bluss:assume-stage, r=alexcrichton
rustbuild: Add cli option --keep-stage

This option is intended to be used like:

./x.py build --stage 1 --keep-stage 0

Which skips all stage 0 steps, so that stage 1 can be recompiled
directly (even if for example libcore has changes).

This is useful when working on `cfg(not(stage0))` parts of the
libraries or when re-running stage 1 tests in libraries in general.

Fixes #38326
2016-12-15 14:01:55 +00:00
Seo Sanghyeon
8ed52ed27d Document --test-args for rustbuild 2016-12-14 01:31:48 +09:00
Ulrik Sverdrup
4e696edc71 rustbuild: Add cli option --keep-stage
This option is intended to be used like:

./x.py build --stage 1 --keep-stage 0

Which skips all stage 0 steps, so that stage 1 can be recompiled
directly (even if for example libcore has changes).

This is useful when working on `cfg(not(stage0))` parts of the
libraries, or when re-running stage 1 tests in libraries in general.
2016-12-13 00:05:12 +01:00
Alex Crichton
0e272de69f mk: Switch rustbuild to the default build system
This commit switches the default build system for Rust from the makefiles to
rustbuild. The rustbuild build system has been in development for almost a year
now and has become quite mature over time. This commit is an implementation of
the proposal on [internals] which slates deletion of the makefiles on
2016-01-02.

[internals]: https://internals.rust-lang.org/t/proposal-for-promoting-rustbuild-to-official-status/4368

This commit also updates various documentation in `README.md`,
`CONTRIBUTING.md`, `src/bootstrap/README.md`, and throughout the source code of
rustbuild itself.

Closes #37858
2016-12-07 00:30:23 -08:00
Ulrik Sverdrup
b1566baa0b rustbuild: Add bench subcommand
Add command `./x.py bench`; use `./x.py bench --help -v` to list all
available benchmark targets.
2016-11-25 22:15:52 +01:00
Alex Crichton
a270b8014c rustbuild: Rewrite user-facing interface
This commit is a rewrite of the user-facing interface to the rustbuild build
system. The intention here is to make it much easier to compile/test the project
without having to remember weird rule names and such. An overall view of the new
interface is:

    # build everything
    ./x.py build

    # document everyting
    ./x.py doc

    # test everything
    ./x.py test

    # test libstd
    ./x.py test src/libstd

    # build libcore stage0
    ./x.py build src/libcore --stage 0

    # run stage1 run-pass tests
    ./x.py test src/test/run-pass --stage 1

The `src/bootstrap/bootstrap.py` script is now aliased as a top-level `x.py`
script. This `x` was chosen to be both short and easily tab-completable (no
collisions in that namespace!). The build system now accepts a "subcommand" of
what to do next, the main ones being build/doc/test.

Each subcommand then receives an optional list of arguments. These arguments are
paths in the source repo of what to work with. That is, if you want to test a
directory, you just pass that directory as an argument.

The purpose of this rewrite is to do away with all of the arcane renames like
"rpass" is the "run-pass" suite, "cfail" is the "compile-fail" suite, etc. By
simply working with directories and files it's much more intuitive of how to run
a test (just pass it as an argument).

The rustbuild step/dependency management was also rewritten along the way to
make this easy to work with and define, but that's largely just a refactoring of
what was there before.

The *intention* is that this support is extended for arbitrary files (e.g.
`src/test/run-pass/my-test-case.rs`), but that isn't quite implemented just yet.
Instead directories work for now but we can follow up with stricter path
filtering logic to plumb through all the arguments.
2016-11-02 17:57:28 -07:00
Alex Crichton
48a07bfb95 rustbuild: Remove the build directory
The organization in rustbuild was a little odd at the moment where the `lib.rs`
was quite small but the binary `main.rs` was much larger. Unfortunately as well
there was a `build/` directory with the implementation of the build system, but
this directory was ignored by GitHub on the file-search prompt which was a
little annoying.

This commit reorganizes rustbuild slightly where all the library files (the
build system) is located directly inside of `src/bootstrap` and all the binaries
now live in `src/bootstrap/bin` (they're small). Hopefully this should allow
GitHub to index and allow navigating all the files while maintaining a
relatively similar layout to the other libraries in `src/`.
2016-07-05 21:58:20 -07:00