]> git.proxmox.com Git - cargo.git/log
cargo.git
7 years agoUse a MinGW that doesn't break pthreads
E. Dunham [Mon, 10 Oct 2016 19:33:22 +0000 (12:33 -0700)]
Use a MinGW that doesn't break pthreads

Also correct the bits to triples mapping, because tyops

7 years agoExpand matrix for #3186
E. Dunham [Mon, 10 Oct 2016 18:11:56 +0000 (11:11 -0700)]
Expand matrix for #3186

7 years agoAuto merge of #3189 - edunham:fix-empty-path-bug, r=alexcrichton
bors [Tue, 11 Oct 2016 17:45:15 +0000 (10:45 -0700)]
Auto merge of #3189 - edunham:fix-empty-path-bug, r=alexcrichton

Make it possible for windows-gnu tests to pass

Skip test that uses empty path on Windows, because Windows doesn't do the empty path thing.

7 years agoempty path is not a thing on Windows
E. Dunham [Mon, 10 Oct 2016 22:15:08 +0000 (15:15 -0700)]
empty path is not a thing on Windows

7 years agoAuto merge of #3185 - semarie:bump-hamcrest, r=alexcrichton
bors [Mon, 10 Oct 2016 19:44:07 +0000 (12:44 -0700)]
Auto merge of #3185 - semarie:bump-hamcrest, r=alexcrichton

bump hamcrest to 0.1.1

update hamcrest to 0.1.1 and its dependencies.

Closes: #3181
7 years agobump hamcrest to 0.1.1
Sébastien Marie [Mon, 10 Oct 2016 10:08:48 +0000 (12:08 +0200)]
bump hamcrest to 0.1.1

7 years agoAuto merge of #3183 - rjgoldsborough:broken-docs-links, r=alexcrichton
bors [Sun, 9 Oct 2016 17:12:36 +0000 (10:12 -0700)]
Auto merge of #3183 - rjgoldsborough:broken-docs-links, r=alexcrichton

removing return false causing links to break

Gah! Sorry about that.

fixes #3182

I added a `return false` to the function above to prevent it from toggling itself back off but for some reason put one here as well which stopped the event before the link could fire.

7 years agoremoving return false causing links to break
Jake Goldsborough [Sun, 9 Oct 2016 00:30:55 +0000 (17:30 -0700)]
removing return false causing links to break

7 years agoAuto merge of #3160 - alexcrichton:rustc-to-proc, r=alexcrichton
bors [Fri, 7 Oct 2016 21:20:26 +0000 (14:20 -0700)]
Auto merge of #3160 - alexcrichton:rustc-to-proc, r=alexcrichton

Blanket rename rustc-macro to proc-macro

7 years agoAuto merge of #3154 - steveklabnik:gh3124, r=alexcrichton
bors [Fri, 7 Oct 2016 20:09:27 +0000 (13:09 -0700)]
Auto merge of #3154 - steveklabnik:gh3124, r=alexcrichton

upgrade semver

This is a spike at fixing #3124.

@alexcrichton I'm not sure how to actually emit the error message here. In the TOML example you linked me: https://github.com/rust-lang/cargo/blob/5593045ddef2744c1042dee0c0037c2ebcc1834e/src/cargo/util/toml.rs#L166

That takes a Config as an argument. This function does not. What's the right approach here?

Also, this code is messy. I am 99% sure I can write it nicer with combinators. This is just to get the discussion going.

7 years agoBump to semver@0.5.0
Steve Klabnik [Fri, 7 Oct 2016 20:03:08 +0000 (16:03 -0400)]
Bump to semver@0.5.0

7 years agoAdd a test for deprecation warnings
Alex Crichton [Fri, 7 Oct 2016 19:43:48 +0000 (12:43 -0700)]
Add a test for deprecation warnings

7 years agoTweak message in Dependency::parse
Alex Crichton [Fri, 7 Oct 2016 19:34:00 +0000 (12:34 -0700)]
Tweak message in Dependency::parse

Provide some contextual information about why a dependency failed to parse.

7 years agoAuto merge of #3177 - matklad:kill-exec-engine, r=alexcrichton
bors [Fri, 7 Oct 2016 18:41:31 +0000 (11:41 -0700)]
Auto merge of #3177 - matklad:kill-exec-engine, r=alexcrichton

Remove ExecEngine abstraction

Hi! Not sure what was the idea behind exec engine (perhaps to allow swapping it out during tests?), but looks like it does absolutely nothing at the moment, and can be removed.

7 years agoRevert addition of a number of Config params
Alex Crichton [Fri, 7 Oct 2016 18:07:37 +0000 (11:07 -0700)]
Revert addition of a number of Config params

7 years agosimplify slightly
Steve Klabnik [Mon, 3 Oct 2016 21:21:46 +0000 (17:21 -0400)]
simplify slightly

7 years agoPrint the warning
Steve Klabnik [Mon, 3 Oct 2016 20:55:24 +0000 (16:55 -0400)]
Print the warning

7 years agothread a config throughout
Steve Klabnik [Mon, 3 Oct 2016 20:40:57 +0000 (16:40 -0400)]
thread a config throughout

7 years agoupgrade semver
Steve Klabnik [Mon, 3 Oct 2016 18:41:02 +0000 (14:41 -0400)]
upgrade semver

7 years agoAuto merge of #3171 - alexcrichton:travis, r=alexcrichton
bors [Fri, 7 Oct 2016 17:55:46 +0000 (10:55 -0700)]
Auto merge of #3171 - alexcrichton:travis, r=alexcrichton

Fix Travis OSX

They recently changed images, gotta tweak how we work with OpenSSL

7 years agoFix Travis OSX
Alex Crichton [Thu, 6 Oct 2016 16:48:12 +0000 (09:48 -0700)]
Fix Travis OSX

They recently changed images, gotta tweak how we work with OpenSSL

7 years agoRemove ExecEngine abstraction
Aleksey Kladov [Fri, 7 Oct 2016 12:01:38 +0000 (15:01 +0300)]
Remove ExecEngine abstraction

7 years agoAuto merge of #3168 - rjgoldsborough:docs-menu-click-busted-2865, r=alexcrichton
bors [Fri, 7 Oct 2016 00:08:12 +0000 (17:08 -0700)]
Auto merge of #3168 - rjgoldsborough:docs-menu-click-busted-2865, r=alexcrichton

tweaking the way the dropdown opens to fix links not working

fixes #2865

7 years agoAuto merge of #3000 - matklad:error-format, r=alexcrichton
bors [Thu, 6 Oct 2016 21:03:22 +0000 (14:03 -0700)]
Auto merge of #3000 - matklad:error-format, r=alexcrichton

Add --message-format flag.

Closes #2982

This adds a `--message-format` flag with values `human` or `json-v1` to commands that may trigger compilation.

After the discussion in the issue I am no longer sure that this is a way to go:

* Looks like it buys nothing compared to `RUST_FLAGS` approach: a flag is more useful on the command line, but from the tool point of view there should be no significant differences between a flag and an environmental variable.

* Looks like we really want to wrap compiler's messages into our own json to tie them to particular compilation.

7 years agoBlanket rename rustc-macro to proc-macro
Alex Crichton [Tue, 4 Oct 2016 16:58:28 +0000 (09:58 -0700)]
Blanket rename rustc-macro to proc-macro

7 years agoAuto merge of #3170 - alexcrichton:ignore-rustc-macro, r=alexcrichton
bors [Thu, 6 Oct 2016 16:47:21 +0000 (09:47 -0700)]
Auto merge of #3170 - alexcrichton:ignore-rustc-macro, r=alexcrichton

Ignore rustc-macro tests for now

We need to ignore them to land rust-lang/rust#36945 and after that we'll shortly
re-enable them.

7 years agoIgnore rustc-macro tests for now
Alex Crichton [Thu, 6 Oct 2016 16:46:32 +0000 (09:46 -0700)]
Ignore rustc-macro tests for now

We need to ignore them to land rust-lang/rust#36945 and after that we'll shortly
re-enable them.

7 years agoAuto merge of #3162 - alexcrichton:ugh-mspdbsrv, r=brson
bors [Thu, 6 Oct 2016 05:47:07 +0000 (22:47 -0700)]
Auto merge of #3162 - alexcrichton:ugh-mspdbsrv, r=brson

Leak mspdbsrv.exe processes on Windows

Instead of having our job object tear them down, instead leak them intentionally
if everything succeeded.

Closes #3161

7 years agoAuto merge of #3146 - alexcrichton:install-same-workspace, r=brson
bors [Thu, 6 Oct 2016 04:33:12 +0000 (21:33 -0700)]
Auto merge of #3146 - alexcrichton:install-same-workspace, r=brson

Use workspaces during `cargo install`

Prevent lock files from oscillating.

Closes #3133

7 years agoAuto merge of #3137 - alexcrichton:bump-curl, r=brson
bors [Thu, 6 Oct 2016 03:48:12 +0000 (20:48 -0700)]
Auto merge of #3137 - alexcrichton:bump-curl, r=brson

Update curl to track more error info

This hopefully will help out with https://github.com/rust-lang/cargo/issues/2464#issuecomment-250583778 by including https://github.com/alexcrichton/curl-rust/commit/07323ab5e868babb7a5437e8d2604761b913dab3 which should give us more information from libcurl

7 years agoAuto merge of #3145 - alexcrichton:rustdoc-cross-test, r=brson
bors [Thu, 6 Oct 2016 02:26:10 +0000 (19:26 -0700)]
Auto merge of #3145 - alexcrichton:rustdoc-cross-test, r=brson

Test requested --target from source of truth

We skip doc tests for any cross compiles (as they don't work) but to detect a
cross compile we checked `--target` but forgot to check other locations like
`CARGO_BUILD_TARGET` or `[build.target]`. This alters the check to ensure that
it verifies from the source of truth whether a cross compilation happened or
not.

Closes #3143

7 years agoAuto merge of #3136 - alexcrichton:warn-bad-override, r=brson
bors [Thu, 6 Oct 2016 00:40:11 +0000 (17:40 -0700)]
Auto merge of #3136 - alexcrichton:warn-bad-override, r=brson

Warn about path overrides that won't work

Cargo has a long-standing [bug] in path overrides where they will cause spurious
rebuilds of crates in the crate graph. This can be very difficult to diagnose
and be incredibly frustrating as well. Unfortunately, though, it's behavior that
fundamentally can't be fixed in Cargo.

The crux of the problem happens when a `path` replacement changes something
about the list of dependencies of the crate that it's replacing. This alteration
to the list of dependencies *cannot be tracked by Cargo* as the lock file was
previously emitted. In the best case this ends up causing random recompiles. In
the worst case it cause infinite registry updates that always result in
recompiles.

A solution to this intention, changing the dependency graph of an overridden
dependency, was [implemented] with the `[replace]` feature in Cargo awhile back.
With that in mind, this commit implements a *warning* whenever a bad dependency
replacement is detected. The message here is pretty wordy, but it's intended to
convey that you should switch to using `[replace]` for a more robust
impelmentation, and it can also give security to anyone using `path` overrides
that if they get past this warning everything should work as intended.

[bug]: https://github.com/rust-lang/cargo/issues/2041
[implemented]: http://doc.crates.io/specifying-dependencies.html#overriding-dependencies

Closes #2041

7 years agotweaking the way the dropdown opens to fix links not working
Jake Goldsborough [Wed, 5 Oct 2016 23:40:10 +0000 (16:40 -0700)]
tweaking the way the dropdown opens to fix links not working

7 years agoAuto merge of #3144 - alexcrichton:less-update-registry, r=brson
bors [Wed, 5 Oct 2016 23:22:25 +0000 (16:22 -0700)]
Auto merge of #3144 - alexcrichton:less-update-registry, r=brson

Avoid updating registry when adding existing deps

Cargo previously erroneously updated the registry whenever a new dependency was
added on a crate which already exists in the DAG. This commit fixes this
behavior by ensuring that if the new dependency matches a previously locked
version it uses that instead.

This commit involved a bit of refactoring around this logic to be a bit more
clear how the locking and "falling back to the registry" is happening.

Closes #2895

7 years agoAdd some docs about JSON messages
Aleksey Kladov [Wed, 5 Oct 2016 18:26:15 +0000 (21:26 +0300)]
Add some docs about JSON messages

7 years agoAuto merge of #3157 - japaric:target-rustflags, r=alexcrichton
bors [Wed, 5 Oct 2016 16:16:15 +0000 (09:16 -0700)]
Auto merge of #3157 - japaric:target-rustflags, r=alexcrichton

add support for per-target rustflags in .cargo/config

you can now specify rustflags on a per-target basis in .cargo/config:

``` toml
[target.x86_64-unknown-linux-gnu]
rustflags = ["x86", "specific", "flags"]

[target.arm-unknown-linux-gnueabi]
rustflags = ["arm", "specific", "flags"]
```

If both build.rustflags and target.*.rustflags are specified, the
target.* ones will be used.

As before RUSTFLAGS overrides either set.

closes #3153

r? @alexcrichton I've only added a smoke test and a precedence test. Let me know if I should add more tests!

7 years agoadd documentation about target.$triple.rustflags
Jorge Aparicio [Wed, 5 Oct 2016 04:59:03 +0000 (23:59 -0500)]
add documentation about target.$triple.rustflags

7 years agoAuto merge of #3163 - brson:docdir, r=alexcrichton
bors [Wed, 5 Oct 2016 00:26:32 +0000 (17:26 -0700)]
Auto merge of #3163 - brson:docdir, r=alexcrichton

Update rust-installer

7 years agoUpdate rust-installer
Brian Anderson [Wed, 5 Oct 2016 00:21:10 +0000 (00:21 +0000)]
Update rust-installer

7 years agoLeak mspdbsrv.exe processes on Windows
Alex Crichton [Tue, 4 Oct 2016 22:59:37 +0000 (15:59 -0700)]
Leak mspdbsrv.exe processes on Windows

Instead of having our job object tear them down, instead leak them intentionally
if everything succeeded.

Closes #3161

7 years agoadd support for per-target rustflags in .cargo/config
Jorge Aparicio [Tue, 4 Oct 2016 01:37:25 +0000 (20:37 -0500)]
add support for per-target rustflags in .cargo/config

you can now specify rustflags on a per-target basis in .cargo/config:

``` toml
[target.x86_64-unknown-linux-gnu]
rustflags = ["x86", "specific", "flags"]

[target.arm-unknown-linux-gnueabi]
rustflags = ["arm", "specific", "flags"]
```

If both build.rustflags and target.*.rustflags are specified, the
target.* ones will be used.

As before RUSTFLAGS overrides either set.

closes #3153

7 years agoAuto merge of #3139 - jhbabon:improve-replace-parsing-error-msg, r=alexcrichton
bors [Mon, 3 Oct 2016 17:52:53 +0000 (10:52 -0700)]
Auto merge of #3139 - jhbabon:improve-replace-parsing-error-msg, r=alexcrichton

Show an error messager for invalid semver spec for packages in the [replace] section.

The `[replace]` section in the `Cargo.toml` file doesn't allow invalid semver specsfor packages, so something like this:

```toml
[dependencies]
foo = "*"

[replace]
"foo:*" = { git = 'https://example.com' }
```

It's not valid. In this case we will display an error message like this:

```
error: failed to parse manifest at `Cargo.toml`

Caused by:
  replacements must specify a valid semver version to replace, but `foo:*` does not

Caused by:
  Parse error
```

closes #3129

7 years agoUse chain_error in TomlManifest.replace when checking valid semver.
Juan Hernández [Mon, 3 Oct 2016 08:55:05 +0000 (10:55 +0200)]
Use chain_error in TomlManifest.replace when checking valid semver.

Don't throw away previous error messages, they might be useful
for the user.

7 years agoAuto merge of #3150 - matklad:deprecate-read-manifest, r=alexcrichton
bors [Mon, 3 Oct 2016 08:43:02 +0000 (01:43 -0700)]
Auto merge of #3150 - matklad:deprecate-read-manifest, r=alexcrichton

Document that read_manifest command is deprecated

I believe we intended to deprecate read_manifest command. I am not sure what a deprecation process for Cargo commands should be, but I guess it should involve mentioning somewhere that the command is deprecated :)

7 years agoAuto merge of #3147 - carols10cents:versions-in-readme, r=alexcrichton
bors [Mon, 3 Oct 2016 07:06:51 +0000 (00:06 -0700)]
Auto merge of #3147 - carols10cents:versions-in-readme, r=alexcrichton

Add information about Cargo releases going with Rust releases

Closes #3101.

This just adds a table of rust release numbers to cargo release numbers, and some text that clarifies that they happen together.

I put the table behind a details tag, which Chrome renders really nicely with a little toggle triangle... Firefox will do the toggling *functionality* but doesn't have much of an indication that you can click on the text, but I think they're working on it. Servo has a little triangle but nothing happens when you click on it ;)

7 years agoStore CargoError inside the ProcessError
Aleksey Kladov [Sat, 1 Oct 2016 10:53:42 +0000 (13:53 +0300)]
Store CargoError inside the ProcessError

7 years agoRename message-format flag to json
Aleksey Kladov [Sat, 1 Oct 2016 10:31:12 +0000 (13:31 +0300)]
Rename message-format flag to json

7 years agoCreate a centralized machine_message module
Aleksey Kladov [Wed, 28 Sep 2016 16:54:35 +0000 (19:54 +0300)]
Create a centralized machine_message module

7 years agoDon't panic while streaming compiler output
Aleksey Kladov [Tue, 27 Sep 2016 11:39:08 +0000 (14:39 +0300)]
Don't panic while streaming compiler output

7 years agoAdd --message-format flag.
Aleksey Kladov [Thu, 11 Aug 2016 21:47:49 +0000 (00:47 +0300)]
Add --message-format flag.

7 years agoDocument that read_manifest command is deprecated
Aleksey Kladov [Sun, 2 Oct 2016 14:20:45 +0000 (17:20 +0300)]
Document that read_manifest command is deprecated

7 years agoAdd information about Cargo releases going with Rust releases
Carol (Nichols || Goulding) [Fri, 30 Sep 2016 23:51:08 +0000 (19:51 -0400)]
Add information about Cargo releases going with Rust releases

7 years agoUse workspaces during `cargo install`
Alex Crichton [Fri, 30 Sep 2016 20:16:38 +0000 (13:16 -0700)]
Use workspaces during `cargo install`

Prevent lock files from oscillating.

Closes #3133

7 years agoTest requested --target from source of truth
Alex Crichton [Fri, 30 Sep 2016 20:07:37 +0000 (13:07 -0700)]
Test requested --target from source of truth

We skip doc tests for any cross compiles (as they don't work) but to detect a
cross compile we checked `--target` but forgot to check other locations like
`CARGO_BUILD_TARGET` or `[build.target]`. This alters the check to ensure that
it verifies from the source of truth whether a cross compilation happened or
not.

Closes #3143

7 years agoAvoid updating registry when adding existing deps
Alex Crichton [Thu, 21 Jul 2016 16:50:33 +0000 (09:50 -0700)]
Avoid updating registry when adding existing deps

Cargo previously erroneously updated the registry whenever a new dependency was
added on a crate which already exists in the DAG. This commit fixes this
behavior by ensuring that if the new dependency matches a previously locked
version it uses that instead.

This commit involved a bit of refactoring around this logic to be a bit more
clear how the locking and "falling back to the registry" is happening.

Closes #2895
Closes #2931

7 years agoAuto merge of #3142 - alexcrichton:siphash, r=alexcrichton
bors [Fri, 30 Sep 2016 16:18:55 +0000 (09:18 -0700)]
Auto merge of #3142 - alexcrichton:siphash, r=alexcrichton

Allow deprecated use of SipHasher

This type is being deprecated in rust-lang/rust#36815, so allow use of the
deprecated type for now. We can fix this later once new APIs have landed.

7 years agoAllow deprecated use of SipHasher
Alex Crichton [Fri, 30 Sep 2016 16:17:36 +0000 (09:17 -0700)]
Allow deprecated use of SipHasher

This type is being deprecated in rust-lang/rust#36815, so allow use of the
deprecated type for now. We can fix this later once new APIs have landed.

7 years agoShow an error messager for invalid semver spec for packages in the [replace] section.
Juan Hernández [Fri, 30 Sep 2016 11:27:10 +0000 (13:27 +0200)]
Show an error messager for invalid semver spec for packages in the [replace] section.

The [replace] section in the Cargo.toml file doesn't allow invalid semver specs
for packages, so something like this:

    [dependencies]
    foo = "*"

    [replace]
    "foo:*" = { git = 'https://example.com' }

It's not valid. In this case we will display an error message like this:

    error: failed to parse manifest at `Cargo.toml`

    Caused by:
      replacements must specify a valid semver version to replace, but `foo:*` does not

7 years agoUpdate curl to track more error info
Alex Crichton [Fri, 30 Sep 2016 00:30:18 +0000 (17:30 -0700)]
Update curl to track more error info

7 years agoWarn about path overrides that won't work
Alex Crichton [Thu, 29 Sep 2016 23:35:22 +0000 (16:35 -0700)]
Warn about path overrides that won't work

Cargo has a long-standing [bug] in path overrides where they will cause spurious
rebuilds of crates in the crate graph. This can be very difficult to diagnose
and be incredibly frustrating as well. Unfortunately, though, it's behavior that
fundamentally can't be fixed in Cargo.

The crux of the problem happens when a `path` replacement changes something
about the list of dependencies of the crate that it's replacing. This alteration
to the list of dependencies *cannot be tracked by Cargo* as the lock file was
previously emitted. In the best case this ends up causing random recompiles. In
the worst case it cause infinite registry updates that always result in
recompiles.

A solution to this intention, changing the dependency graph of an overridden
dependency, was [implemented] with the `[replace]` feature in Cargo awhile back.
With that in mind, this commit implements a *warning* whenever a bad dependency
replacement is detected. The message here is pretty wordy, but it's intended to
convey that you should switch to using `[replace]` for a more robust
impelmentation, and it can also give security to anyone using `path` overrides
that if they get past this warning everything should work as intended.

[bug]: https://github.com/rust-lang/cargo/issues/2041
[implemented]: http://doc.crates.io/specifying-dependencies.html#overriding-dependencies

Closes #2041

7 years agoAuto merge of #3135 - alexcrichton:bump, r=alexcrichton
bors [Thu, 29 Sep 2016 20:39:04 +0000 (13:39 -0700)]
Auto merge of #3135 - alexcrichton:bump, r=alexcrichton

Bump to 0.14.0

7 years agoBump to 0.14.0
Alex Crichton [Thu, 29 Sep 2016 18:31:17 +0000 (11:31 -0700)]
Bump to 0.14.0

7 years agoAuto merge of #3134 - whitequark:patch-1, r=steveklabnik
bors [Thu, 29 Sep 2016 14:12:44 +0000 (07:12 -0700)]
Auto merge of #3134 - whitequark:patch-1, r=steveklabnik

doc: build-script: use cfg(unix), not a hardcoded x86_64 triple

This used to not be possible, but it is now, so let's promote best practices.

7 years agodoc: build-script: use cfg(unix), not a hardcoded x86_64 triple
whitequark [Thu, 29 Sep 2016 11:22:40 +0000 (11:22 +0000)]
doc: build-script: use cfg(unix), not a hardcoded x86_64 triple

This used to not be possible, but it is now, so let's promote best practices.

7 years agoAuto merge of #3127 - kraai:patch, r=alexcrichton
bors [Wed, 28 Sep 2016 18:16:15 +0000 (11:16 -0700)]
Auto merge of #3127 - kraai:patch, r=alexcrichton

Add newlines to SYNOPSIS sections

7 years agoAdd newlines to SYNOPSIS sections
Matt Kraai [Wed, 28 Sep 2016 10:54:09 +0000 (03:54 -0700)]
Add newlines to SYNOPSIS sections

7 years agoAuto merge of #3057 - rjgoldsborough:add-policies, r=steveklabnik
bors [Wed, 28 Sep 2016 00:50:27 +0000 (17:50 -0700)]
Auto merge of #3057 - rjgoldsborough:add-policies, r=steveklabnik

adding policies page to the docs

Fixes #3056

7 years agoAuto merge of #3125 - mbrubeck:dev-deps, r=alexcrichton
bors [Tue, 27 Sep 2016 23:50:36 +0000 (16:50 -0700)]
Auto merge of #3125 - mbrubeck:dev-deps, r=alexcrichton

Build transitive dev-dependencies when needed

When running `cargo test -p foo` where `foo` is a crate in the current workspace, build and link `foo`'s dev-dependencies. Fixes #860.

7 years agoMerge pull request #3032 from brson/rust-installer
Alex Crichton [Tue, 27 Sep 2016 23:48:27 +0000 (08:48 +0900)]
Merge pull request #3032 from brson/rust-installer

Update rust-installer

7 years agoBuild transitive dev-dependencies when needed
Matt Brubeck [Mon, 26 Sep 2016 21:13:49 +0000 (14:13 -0700)]
Build transitive dev-dependencies when needed

When running `cargo test -p foo` where `foo` is a crate in the current
workspace, build and link `foo`'s dev-dependencies. Fixes #860.

7 years agoAuto merge of #3123 - wimh:platform_versions, r=alexcrichton
bors [Tue, 27 Sep 2016 20:03:32 +0000 (13:03 -0700)]
Auto merge of #3123 - wimh:platform_versions, r=alexcrichton

Don't download dependencies from other platforms

Having a Cargo.toml which looks like this:

            [package]
            name = "a"
            version = "0.0.1"
            authors = []

            [target.'cfg(unix)'.dependencies]
            foo = "0.1.0"

            [target.'cfg(windows)'.dependencies]
            foo = "0.2.0"

This would still download foo version 0.2.0 on unix. I think there is no need to do that, but please correct me if I'm wrong.

This was triggered by [this](http://stackoverflow.com/questions/39709542/why-does-the-last-platform-specific-dependency-take-precedence-in-cargo) stackoverflow question, but that situation is more complicated, as the version is the same, just the features are different. This PR will not solve that bug. If you want me to include that too, I would have to debug a bit more first....

7 years agoAuto merge of #3089 - carols10cents:crates-io-registry-url, r=alexcrichton
bors [Tue, 27 Sep 2016 00:02:55 +0000 (17:02 -0700)]
Auto merge of #3089 - carols10cents:crates-io-registry-url, r=alexcrichton

Make crates-io registry URL optional in config; ignore all changes to source.crates-io

Hi! When I was working on the instructions for source replacement [in this crates.io PR](https://github.com/rust-lang/crates.io/pull/440), I found that when I'm replacing `source.crates-io`, [I still have to specify some value for `registry`](https://github.com/rust-lang/crates.io/pull/440/files#diff-04c6e90faac2675aa89e2176d2eec7d8R177), or else I get this:

```
error: no source URL specified for `source.crates-io`, need either `registry` or `local-registry` defined
```

This seems weird and annoying to me: cargo definitely knows the registry URL for crates-io, and I'm trying to replace it anyway.

So the first commit in this PR makes it optional, so that you don't have to specify a registry url for crates-io: it uses `SourceId::crates_io`, like it would if we didn't have any source configs at all.

~~The second commit in this PR might go too far, and/or might break existing uses of cargo, I'm not sure. In my opinion, `source.crates-io` should only be able to be replaced and never changed directly-- crates-io should always be crates-io, and I should be able to assume that in any project. So the second commit ignores all modifications to `source.crates-io`'s `registry`, `local-registry`, and `directory`, and warns that they're being ignored.~~

~~I tried to search github to see if anyone was using these keys with `source.crates-io`, but since github's search ignores `.` (ARE YOU LISTENING GITHUB? I WOULD LIKE TO SEARCH WITH PUNCTUATION PLEASE), there's a lot of false positives to wade through. I didn't see anything in the first few pages though.~~

I'm happy to make whatever modifications to this!

7 years agoDo not download dependencies from other platforms
Wim Hueskes [Mon, 26 Sep 2016 22:55:58 +0000 (00:55 +0200)]
Do not download dependencies from other platforms

7 years agoadd test cfg/ignore_version_from_other_platform
Wim Hueskes [Mon, 26 Sep 2016 22:46:10 +0000 (00:46 +0200)]
add test cfg/ignore_version_from_other_platform

if different platforms have a dependency to a different
version of a crate, only the correct dependency should
be downloaded and used

7 years agoAuto merge of #3110 - jsgf:topic-license-metadata, r=alexcrichton
bors [Mon, 26 Sep 2016 22:51:22 +0000 (15:51 -0700)]
Auto merge of #3110 - jsgf:topic-license-metadata, r=alexcrichton

cargo: add license and license_file to cargo metadata output

Proposed fix for #3108

7 years agoAuto merge of #3122 - shepmaster:patch-1, r=steveklabnik
bors [Mon, 26 Sep 2016 19:36:04 +0000 (12:36 -0700)]
Auto merge of #3122 - shepmaster:patch-1, r=steveklabnik

Add missing quotation mark

7 years agoAdd missing quotation mark
Jake Goulding [Mon, 26 Sep 2016 19:11:36 +0000 (15:11 -0400)]
Add missing quotation mark

7 years agoAuto merge of #3091 - matklad:move-exec-streamed, r=alexcrichton
bors [Mon, 26 Sep 2016 17:48:18 +0000 (10:48 -0700)]
Auto merge of #3091 - matklad:move-exec-streamed, r=alexcrichton

Move stream_output to ProcessBuilder

Make `stream_output` method more reusable (I intend to use it in #3000).

Unrelated question: what is that `ExecEngine` thing? Looks like it does nothing at the moment and can be removed.

7 years agoAuto merge of #3118 - cbiffle:master, r=alexcrichton
bors [Mon, 26 Sep 2016 17:10:18 +0000 (10:10 -0700)]
Auto merge of #3118 - cbiffle:master, r=alexcrichton

Fall back to fs::copy when hard_link fails.

Some filesystems don't allow hard links.  Since Cargo's use of hard
links is an optimization, and not necessary for correctness, it can fall
back to a file copy when hard linking is not available.

This is one possible solution to #3098.

Caveat: this will try to copy if the hard link fails *for any reason*.
It's not clear that there's a more surgical way of handling this; Unix
tends to indicate the condition as "permission denied," not with a
granular "links not supported by filesystem" error.

7 years agoAuto merge of #3121 - alexcrichton:bump-openssl, r=alexcrichton
bors [Mon, 26 Sep 2016 16:15:33 +0000 (09:15 -0700)]
Auto merge of #3121 - alexcrichton:bump-openssl, r=alexcrichton

Update OpenSSL again to 1.0.2j

7 years agoUpdate OpenSSL again to 1.0.2j
Alex Crichton [Mon, 26 Sep 2016 16:15:08 +0000 (09:15 -0700)]
Update OpenSSL again to 1.0.2j

7 years agoShould not have to specify crates-io registry URL to replace-with
Carol (Nichols || Goulding) [Tue, 13 Sep 2016 02:26:16 +0000 (22:26 -0400)]
Should not have to specify crates-io registry URL to replace-with

Since cargo knows crates-io's registry URL and, anyway, you're trying to
say that you don't want to use crates-io.

7 years agocargo: add license and license_file to cargo metadata output
Jeremy Fitzhardinge [Sun, 25 Sep 2016 21:57:51 +0000 (14:57 -0700)]
cargo: add license and license_file to cargo metadata output

7 years agoAuto merge of #3104 - jturner314:fix-publish-man-page, r=alexcrichton
bors [Sun, 25 Sep 2016 21:13:58 +0000 (14:13 -0700)]
Auto merge of #3104 - jturner314:fix-publish-man-page, r=alexcrichton

Remove duplicate option in cargo-publish man page

The `--host` option was listed twice; this commit removes one of the duplicates.

7 years agoFall back to fs::copy when hard_link fails.
Cliff L. Biffle [Sun, 25 Sep 2016 20:53:07 +0000 (13:53 -0700)]
Fall back to fs::copy when hard_link fails.

Some filesystems don't allow hard links.  Since Cargo's use of hard
links is an optimization, and not necessary for correctness, it can fall
back to a file copy when hard linking is not available.

This is one possible solution to #3098.

Caveat: this will try to copy if the hard link fails *for any reason*.
It's not clear that there's a more surgical way of handling this; Unix
tends to indicate the condition as "permission denied," not with a
granular "links not supported by filesystem" error.

7 years agoAuto merge of #3117 - alexcrichton:bump-openssl, r=alexcrichton
bors [Sun, 25 Sep 2016 19:30:50 +0000 (12:30 -0700)]
Auto merge of #3117 - alexcrichton:bump-openssl, r=alexcrichton

Update OpenSSL used by Cargo

7 years agoUpdate OpenSSL used by Cargo
Alex Crichton [Sun, 25 Sep 2016 19:29:51 +0000 (12:29 -0700)]
Update OpenSSL used by Cargo

7 years agoRemove duplicate option in cargo-publish man page
Jim Turner [Tue, 20 Sep 2016 05:57:10 +0000 (01:57 -0400)]
Remove duplicate option in cargo-publish man page

The `--host` option was listed twice; this commit removes one of the
duplicates.

8 years agoMove stream_output to ProcessBuilder
Aleksey Kladov [Wed, 14 Sep 2016 18:10:30 +0000 (21:10 +0300)]
Move stream_output to ProcessBuilder

8 years agoAuto merge of #3092 - jhbabon:fix/dont-panic-on-workspaces, r=alexcrichton
bors [Wed, 14 Sep 2016 20:27:39 +0000 (13:27 -0700)]
Auto merge of #3092 - jhbabon:fix/dont-panic-on-workspaces, r=alexcrichton

FIX: Don't try to generate Gargo.lock on empty workspaces.

There was a `panic!` when the command `cargo update` was executed in a workspace like this:

    mkdir ws
    cd ws
    echo '[workspace]' > Cargo.toml
    cargo new p1
    cargo new p2
    cargo update

The problem is that cargo tries to generate the `Cargo.lock` file even if there aren't any members on the workspace.

This fix checks the existence of members in the workspace before trying to do anything so at least we report an error instead of throwing a `panic!`.

Issue related https://github.com/rust-lang/cargo/issues/3080

8 years agoFIX: Don't try to generate Gargo.lock on empty workspaces.
Juan Hernández [Wed, 14 Sep 2016 19:02:47 +0000 (15:02 -0400)]
FIX: Don't try to generate Gargo.lock on empty workspaces.

There was a panic! when the command `cargo update` was
executed in a workspace like this:

    mkdir ws
    cd ws
    echo '[workspace]' > Cargo.toml
    cargo new p1
    cargo new p2
    cargo update

The problem is that cargo tries to generate the Cargo.lock file
even if there aren't any members on the workspace.

This fix checks the existence of members in the workspace before trying
to do anything so at least we report an error instead of throwing a
panic!

8 years agoAuto merge of #3087 - carols10cents:test-instructions-in-readme, r=alexcrichton
bors [Tue, 13 Sep 2016 04:11:45 +0000 (21:11 -0700)]
Auto merge of #3087 - carols10cents:test-instructions-in-readme, r=alexcrichton

Document recommended way for running tests

Fixes #3084.

8 years agoDocument recommended way for running tests
Carol (Nichols || Goulding) [Tue, 13 Sep 2016 01:45:29 +0000 (21:45 -0400)]
Document recommended way for running tests

Fixes #3084.

8 years agoAuto merge of #3083 - jhbabon:fix-warning-in-feature-tests, r=alexcrichton
bors [Sun, 11 Sep 2016 18:14:34 +0000 (11:14 -0700)]
Auto merge of #3083 - jhbabon:fix-warning-in-feature-tests, r=alexcrichton

FIX: Properly close dep_feature_in_cmd_line test.

It was including the test `all_features_flag_enables_all_features` inside its function body and it was causing this warning when executing `cargo test`:

```
   Compiling cargo v0.13.0 (file:///home/jhbabon/Code/cargo)
tests/features.rs:965:1: 1006:2 warning: function is never used: `all_features_flag_enables_all_features`, #[warn(dead_code)] on by default
tests/features.rs:965 fn all_features_flag_enables_all_features() {
                      ^
tests/features.rs:964:1: 964:8 warning: unused attribute, #[warn(unused_attributes)] on by default
tests/features.rs:964 #[test]
                      ^~~~~~~
     Running target/debug/features-e37991fdf417989c
```

8 years agoProperly close dep_feature_in_cmd_line test.
Juan Hernández [Sat, 10 Sep 2016 21:25:23 +0000 (17:25 -0400)]
Properly close dep_feature_in_cmd_line test.

It was including the test all_features_flag_enables_all_features
inside its function body.

8 years agoAuto merge of #3078 - jhbabon:fix/parse-home-config-once, r=alexcrichton
bors [Fri, 9 Sep 2016 16:16:01 +0000 (09:16 -0700)]
Auto merge of #3078 - jhbabon:fix/parse-home-config-once, r=alexcrichton

Fix: Don't parse the home directory more than once

This PR tries to resolve this issue https://github.com/rust-lang/cargo/issues/3070. The problem is that the `walk_tree` method in the `src/util/config.rs` module was parsing more than once the contents of the config file in the home directory (the file `~/.cargo/config`). The biggest problem with this is with options that can accept multiple values, like `build.rustflags`. If you parse the file twice, the same option can end with duplicated values (e.g: `rustflags=["-Z", "foo", "-Z", "foo"]`).

I made the fix following the comments in the issue. In the fix I keep track of all the parsed config files in a `HashSet` so I can know if a file has been parsed already. ~~I'm also using `std::fs::canonicalize`, as suggested in the issue, to prevent parsing files behind symbolic links more than once.~~

**UPDATE:** I removed the call to `fs::canonicalize` as suggested in the comments. Now the fix is way simpler, which means less code and less possibilities to add a new bug.

8 years agoRemove fs::canonicalize in walk_tree fix.
Juan Hernández [Fri, 9 Sep 2016 00:35:13 +0000 (20:35 -0400)]
Remove fs::canonicalize in walk_tree fix.

* Remove ConfiFile struct, it is not needed without the fs::canonicalize
  call.
* Don't check if the file is in the stash when walking the tree,
  without "canonicalization" it is not necessary.

8 years agoAdd ConfigFile struct to handle config file paths.
Juan Hernández [Thu, 8 Sep 2016 20:20:36 +0000 (16:20 -0400)]
Add ConfigFile struct to handle config file paths.

8 years agoDon't parse the config in home if it was parsed already.
Juan Hernández [Thu, 8 Sep 2016 19:58:53 +0000 (15:58 -0400)]
Don't parse the config in home if it was parsed already.

This is the first version of the fix. It needs clean up.

8 years agoAdd a test that reproduces the error of parsing home config twice.
Juan Hernández [Thu, 8 Sep 2016 19:13:31 +0000 (15:13 -0400)]
Add a test that reproduces the error of parsing home config twice.