Commit graph

1470 commits

Author SHA1 Message Date
bors d5bfd58a03 Auto merge of #4046 - jmatraszek:fix_rust_41797, r=alexcrichton
Change inferring bin's name logic

Should fix rust-lang/rust#41797.
2017-05-15 20:28:27 +00:00
bors 00af72eec3 Auto merge of #3929 - Xion:master, r=alexcrichton
Allow cargo:rustc-env in build scripts

This is an attempt to address issue #2875. Basically, I'm trying to allow build scripts to produce`cargo:rustc-env=FOO=foo` lines in their output. These are then translated to `env!()`-friendly env. vars that rustc is run with.
2017-05-15 18:34:40 +00:00
bors 62acd6e329 Auto merge of #4043 - alexcrichton:fix-flaky-test, r=alexcrichton
Don't try to reach example.com in a test

Instead specify localhost
2017-05-15 16:12:09 +00:00
Alex Crichton 4e0ac72bf2 Don't try to reach example.com in a test
Instead specify localhost
2017-05-15 07:49:12 -07:00
Jakub Matraszek f79337324f Change inferring bin's name logic 2017-05-14 22:47:24 +02:00
Karol Kuczmarski cb1e615715 Fix build script envvars for cargo test/doc 2017-05-13 16:51:40 +01:00
Ingvar Stepanyan 851a28404d Allow runner params 2017-05-12 23:14:11 +01:00
Ingvar Stepanyan e1a85a607c Add support for custom target-specific runners
When `target.$triple.runner` is specified, it will be used for any execution commands by cargo including `cargo run`, `cargo test` and `cargo bench`. The original file is passed to the runner executable as a first argument.

This allows to run tests when cross-comping Rust projects.

This is not a complete solution, and might be extended in future for better ergonomics to support passing extra arguments to the runner itself or overriding runner from command line, but it should already unlock major existing usecases.

Fixes #1411
Resolves #3626
2017-05-12 23:14:11 +01:00
Karol Kuczmarski f1ae9f840f Fix PR comments 2017-05-12 21:47:28 +01:00
Karol Kuczmarski 8b744a05dd Allow cargo:rustc-env in build scripts 2017-05-12 20:18:18 +01:00
Steven Fackler a36787578c Expose the target directory in cargo metadata
Closes #4017
2017-05-10 10:14:57 -07:00
bors 80f19a8e24 Auto merge of #4006 - mcgoo:cargo_test_dylib, r=alexcrichton
fix `cargo test` of dylib projects for end user runs too

Fixes running `cargo test` and `cargo test --target <target>` for dylib projects.

Moves the logic just landed in https://github.com/rust-lang/cargo/pull/3996 into cargo itself, so cargo sets the dylib path for anyone running `cargo test` or `cargo run`. Current master sets the dylib path only for  `cargo test` on cargo itself.

This PR pins to rustup 1.2.0 for the purposes of testing. If https://github.com/rust-lang-nursery/rustup.rs/pull/1093 ends up working out, then this PR would only be important for non-rustup users and people doing cross testing, `cargo test --target <target>`.

Arguably ed273851f8/src/cargo/ops/cargo_rustc/context.rs (L249-L253) should point to lib/rustlib/\<host triple\>/lib instead of sysroot/lib, because I think if the libs are different, you will never be able to compile a working plugin anyway, and for the host=target case you get the  lib/rustlib/\<host triple\>/lib anyhow. Is there ever a case where the lib/rustlib/\<host triple\>/lib and sysroot/lib versions of the libs would be expected to differ?

This is not a huge deal for me one way or the other - it doesn't impact my workflow at all. I nearly dropped it when I saw @alexcrichton had made it all work in 3996, but I think it's worth doing because it removes a surprise. It certainly would have saved me a couple of days of confusion. Either way, thanks for looking it over.
2017-05-09 17:15:40 +00:00
Jim McGrath b8158cfdc8 fix dynamic library search path for build scripts
Make dynamic library search path handling for build scripts mirror the
behaviour for cargo run etc. -L paths are taken and stripped of the
native= and similar prefixes and added to the dynamic library search
path if they are inside the target dir.
Resolves https://github.com/rust-lang/cargo/issues/3957
2017-05-08 14:24:57 -05:00
bors 108c4873d5 Auto merge of #3998 - fantoine:patch-1, r=alexcrichton
Ignore malformed manifests on git dependencies

Fix for #3935
2017-05-08 14:48:01 +00:00
Jim McGrath 784d3154cf set dylib path correctly for target when running cargo test etc 2017-05-07 20:46:05 -05:00
Fabien Antoine c560869176 Added test 2017-05-06 14:44:41 +02:00
Alex Crichton d869907862 Upgrade rustup used on AppVeyor 2017-05-05 07:27:22 -07:00
Aleksey Kladov 6633e2902f Blacklist some binary names in cargo new 2017-05-04 15:23:38 +03:00
Alex Crichton 1db53b78fe Improve configuration load errors
Add some more context information on the backtrace
2017-05-03 10:00:30 -07:00
bors de52ccd535 Auto merge of #3951 - alexcrichton:lift-cdylib, r=alexcrichton
Don't use `-C metadata` cdylibs like we do with dylibs

Dylibs don't get any metadata/extra filename info applied to them as "final
targets" because it can mess with system-specific information (e.g. on OSX) so
this just applies the same logic to cdylibs which need similar treatment on more
platforms (like Windows).

Closes #3934
2017-05-02 18:35:07 +00:00
Alex Crichton fccaffb158 Don't use -C metadata cdylibs like we do with dylibs
Dylibs don't get any metadata/extra filename info applied to them as "final
targets" because it can mess with system-specific information (e.g. on OSX) so
this just applies the same logic to cdylibs which need similar treatment on more
platforms (like Windows).

Closes #3934
2017-05-02 08:52:07 -07:00
Sebastian Dröge 952f3b584d Add tests for "bench --all"
These are basically the same as the ones from "test --all" and "doc --all"
2017-05-02 16:50:14 +03:00
Marc-Antoine Perennou 5d76dd233e fix build-auth test
libgit2 somehow reverted the version back to 0.25.0 after the 0.25.1 release

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2017-04-30 08:51:19 +02:00
Alex Crichton 0b59f17d63 Update dependencies Cargo uses
Namely update to serde 1.0.0!
2017-04-27 12:06:34 -07:00
bors fa7584c149 Auto merge of #3921 - alexcrichton:less-asserts, r=matklad
Relax overly strict asserts in dependency queue

Don't actually need to assert that these are unique, it works both ways and we
can have flavorful dependency graphs which otherwise trigger the assertions.

Closes #3902
2017-04-26 20:42:15 +00:00
bors 06708ffa44 Auto merge of #3899 - alexcrichton:vendor-empty-ok, r=matklad
Support vendor dirs with "empty" directories

Looks like when vendor directories are checked into a VCS there's been instances
where deleting a folder in the VCS doesn't fully delete the folder from the
filesystem. This can lead to [spurious errors][moz] that are difficult to debug.

To help handle this tweak directory sources to ignore empty directories or
directories with only dotfiles by default.

[moz]: https://bugzilla.mozilla.org/show_bug.cgi?id=1342292
2017-04-26 15:10:04 +00:00
Alex Crichton 2511141450 Relax overly strict asserts in dependency queue
Don't actually need to assert that these are unique, it works both ways and we
can have flavorful dependency graphs which otherwise trigger the assertions.

Closes #3902
2017-04-26 07:09:14 -07:00
bors 0f27ca344d Auto merge of #3947 - matklad:bench-bench, r=alexcrichton
Allow test named `test`

Looks like `srt/test.rs` and `src/bench.rs` used to be default
integraion test and benchmark, but they no longer are.

closes #3932
2017-04-26 05:48:11 +00:00
bors 2064245e6a Auto merge of #3948 - alexcrichton:update-deps, r=alexcrichton
Update dependencies in Cargo.lock

This also fixes a few CVEs reported with libcurl and libgit2, so pulling in those updates.
2017-04-24 19:11:49 +00:00
bors b987ce4f26 Auto merge of #3901 - BenWiederhake:all-kinds, r=alexcrichton
Implementation and CLI-support for `--all-$KIND` flags

This implements #3112.

This means all of the following commands are now possible and meaningful:
```
cargo build --all-bins
cargo build --all-tests
cargo test --all-tests
cargo test --all-bins
cargo check --all-bins --all-examples --all-tests --all-benches
```

The commits try to represent the incremental "propagation" of the new feature:
- core functionality (`cargo check --lib` passes)
- CLI suport (`cargo build` passes)
- additional tests (`cargo test` covers new functionality)

Note that `--all` is already reserved to mean "all packages of the workspace", so it can't be used to mean `--all-bins --all-examples --all-tests --all-benches`.

I intend to follow this up by some other PRs, so please do tell me where I could improve.
2017-04-24 17:11:58 +00:00
Alex Crichton f881e863b1 Update dependencies in Cargo.lock 2017-04-24 07:32:53 -07:00
Aleksey Kladov 74deb6e065 Allow test named test
Looks like `srt/test.rs` and `src/bench.rs` used to be default
integraion test and benchmark, but they no longer are.
2017-04-24 15:37:37 +03:00
bors 8326a3683a Auto merge of #3887 - luser:rustc-wrapper, r=alexcrichton
Add support for wrapping cargo's rustc invocations by setting RUSTC_WRAPPER

To use sccache for cargo builds we need a simple way to get sccache into the rustc commandline when cargo invokes rustc. Currently this is only possible by hard-linking or copying the `sccache` binary to be named `rustc` and then either setting `RUSTC` to its path or putting it first in `$PATH`, both of which are sort of clunky and require manual steps even if installing sccache via `cargo install`.

This patch adds support for a `RUSTC_WRAPPER` environment variable which, if set, will simply be inserted as the actual binary for all rustc process execution, with rustc and all other rustc arguments following.

I didn't add any tests for this, I couldn't figure out the right place to put them, and presumably we'd need to build a helper binary of some sort to use as the wrapper. If you've got suggestions for how to do that properly I'd be happy to write tests.

This works well in my local testing:
```
luser@eye7:/build/read-process-memory$ /build/cargo/target/release/cargo clean; time RUSTC_WRAPPER=/build/sccache2/target/release/sccache RUSTC=/home/luser/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/bin/rustc /build/cargo/target/release/cargo build
   Compiling getopts v0.2.14
   Compiling log v0.3.6
   Compiling libc v0.2.16
   Compiling rand v0.3.14
   Compiling pulldown-cmark v0.0.3
   Compiling tempdir v0.3.5
   Compiling skeptic v0.5.0
   Compiling read-process-memory v0.1.2-pre (file:///build/read-process-memory)
    Finished dev [unoptimized + debuginfo] target(s) in 7.31 secs

real	0m7.733s
user	0m0.060s
sys	0m0.036s
luser@eye7:/build/read-process-memory$ /build/cargo/target/release/cargo clean; time RUSTC_WRAPPER=/build/sccache2/target/release/sccache RUSTC=/home/luser/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/bin/rustc /build/cargo/target/release/cargo build
   Compiling getopts v0.2.14
   Compiling libc v0.2.16
   Compiling log v0.3.6
   Compiling pulldown-cmark v0.0.3
   Compiling rand v0.3.14
   Compiling tempdir v0.3.5
   Compiling skeptic v0.5.0
   Compiling read-process-memory v0.1.2-pre (file:///build/read-process-memory)
    Finished dev [unoptimized + debuginfo] target(s) in 0.97 secs

real	0m1.049s
user	0m0.060s
sys	0m0.036s
```

The use of beta rustc is just to pick up the fix for making `--emit=dep-info` faster (which should ship in 1.17). If this patch ships in cargo then in the future developers should simply be able to `cargo install sccache; export RUSTC_WRAPPER=sccache` and `cargo build` as normal, but benefit from local sccache caching.
2017-04-19 02:19:25 +00:00
Nathan Froyd 799515eb8e re-enable previously nightly-only tests
These tests all play nicely with Rust 1.16.
2017-04-18 09:42:47 -04:00
Ted Mielczarek 20f23d9074 Add support for wrapping cargo's rustc invocations by setting RUSTC_WRAPPER 2017-04-18 08:12:04 -04:00
bors 770512b08f Auto merge of #3928 - andwur:version-not-found-error-msgs, r=alexcrichton
Better error message when a package version is not found

This changes the error message when a package *is* found but there's no
matching version to be a little more helpful.

Old: "no matching package named `<dep name>`"
New: "no matching version `<version>` found for package `<dep name>`"

Fixes #2997
2017-04-18 06:12:37 +00:00
bors 01d403f34d Auto merge of #3924 - koivunej:issue_3922, r=alexcrichton
Adjust submodule updating failure reporting

This PR changes output of cargo when updating a dependency fails because of it's submodules cannot be loaded. In my original example this was caused by submodule pointing to a revision which was deleted by force pushing. Fixes #3922.

Before:

```
$ cargo check
    Updating git repository `<foo-url>`
error: failed to load source for a dependency on `foo`
Caused by:
  Unable to update <foo-url>?rev=hash
To learn more, run the command again with --verbose.
```

After:

```
$ cargo check
    Updating git repository `<foo-url>`
error: failed to load source for a dependency on `foo`
Caused by:
  Unable to update <foo-url>?rev=hash
Caused by:
  Failed to update submodule `submodule`
To learn more, run the command again with --verbose.
```

`--verbose` showing an additional `[9/-3] object not found - no match for id (hash)` has not been changed.

@alexcrichton since we have this nice timezone difference there was no chance of mentoring so far but any comments/suggestions are highly welcome. I'll likely check back on this next week.
2017-04-18 04:26:49 +00:00
bors 434e7a822c Auto merge of #3908 - froydnj:overflow-checks, r=alexcrichton
add `overflow-checks` field to profiles

...and pass `-C overflow-checks` to the compiler when necessary.

Fixes #2262.
2017-04-18 02:52:17 +00:00
Alex Crichton 63947f714b Clean some more env vars during tests
Will be required to run tests as part of rust-lang/rust
2017-04-17 17:55:59 -07:00
Andrew Watts f2b7fd73a9
Fix #2997: error message when version not found could be improved
This changes the error message when a package *is* found but there's no
matching version to be a little more helpful.

Old: "no matching package named `...`"
New: "no matching version `...` found for package `...`"
2017-04-17 22:11:11 +09:30
Joonas Koivunen c9f86804ef git: use lower case in error message 2017-04-17 15:08:51 +03:00
Nathan Froyd 803d748ac2 add overflow-checks field to profiles
...and pass `-C overflow-checks` to the compiler when necessary.

Fixes #2262.
2017-04-14 16:44:45 -04:00
Joonas Koivunen e9908c71e2 style fixes 2017-04-14 10:55:26 +03:00
Joonas Koivunen d31f24bdbb git: adjust error on submodule update failure
Now instead of reporting single generic "submodule update failed" a
dependency specific submodule update failed error message will be
reported and shown without --verbose.
2017-04-14 09:31:12 +03:00
Joonas Koivunen d804b03afb reproduce error msg in test case 2017-04-14 06:58:02 +03:00
bors ec8e824895 Auto merge of #3847 - SergioBenitez:master, r=alexcrichton
Always emit build script warnings for crates that fail to build

Resolves #3777.

r? @alexcrichton
2017-04-12 19:03:16 +00:00
Ben Wiederhake 01782fe639 AllKinds tests: interoperability with '--all' 2017-04-10 20:20:32 +02:00
Ben Wiederhake 3f2ecb4a42 AllKinds tests: cargo-test 2017-04-10 20:20:32 +02:00
Ben Wiederhake 205a50dc88 AllKinds tests: cargo-bench, cargo-build 2017-04-10 20:20:32 +02:00
Ben Wiederhake abeb39c5ad AllKinds tests: cargo-run 2017-04-10 20:20:32 +02:00