Commit Graph

492 Commits

Author SHA1 Message Date
Alex Crichton 6babe72e7c Parse less JSON on null builds
This commit fixes a performance pathology in Cargo today. Whenever Cargo
generates a lock file (which happens on all invocations of `cargo build`
for example) Cargo will parse the crates.io index to learn about
dependencies. Currently, however, when it parses a crate it parses the
JSON blob for every single version of the crate. With a lock file,
however, or with incremental builds only one of these lines of JSON is
relevant. Measured today Cargo building Cargo parses 3700 JSON
dependencies in the registry.

This commit implements an optimization that brings down the number of
parsed JSON lines in the registry to precisely the right number
necessary to build a project. For example Cargo has 150 crates in its
lock file, so now it only parses 150 JSON lines (a 20x reduction from
3700). This in turn can greatly improve Cargo's null build time. Cargo
building Cargo dropped from 120ms to 60ms on a Linux machine and 400ms
to 200ms on a Mac.

The commit internally has a lot more details about how this is done but
the general idea is to have a cache which is optimized for Cargo to read
which is maintained automatically by Cargo.

Closes #6866
2019-05-03 07:23:00 -07:00
Igor Gnatenko c14a329714
chore: Update opener to 0.4 2019-05-03 10:28:12 +02:00
bors f2ea95a37a Auto merge of #6861 - fluffysquirrels:http2-stream-error-spurious, r=alexcrichton
Treat HTTP/2 stream errors as spurious network errors.

Closes https://github.com/rust-lang/cargo/issues/6788.
2019-04-18 15:08:24 +00:00
Alex Helfet cc29c2b609 Treat HTTP/2 stream errors as spurious network errors. 2019-04-18 11:33:15 +01:00
Eric Huss 2923cfa390 Bump to 0.37.0 2019-04-15 12:09:02 -07:00
dependabot[bot] 227aa851f6
Update toml requirement from 0.4.2 to 0.5.0
Updates the requirements on [toml](https://github.com/alexcrichton/toml-rs) to permit the latest version.
- [Release notes](https://github.com/alexcrichton/toml-rs/releases)
- [Commits](https://github.com/alexcrichton/toml-rs/compare/0.4.2...0.5.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-18 05:35:49 +00:00
Eh2406 ed9386bd24 Proptest 0.9.1
This is a rework of #6636 now possible do to the change in testing from #6748
2019-03-16 08:00:39 -04:00
Alex Crichton d19b41f2c6 Release a jobserver token while locking a file
This is intended to fix #6747 where multiple Cargos invoked with the
same jobserver would all have their own token but not actually run
concurrently due to file locking. Instead the fix is that whenever Cargo
blocks for a file lock with a configured global jobserver, a token is
released just before we block and then reacquired afterwards. This way
we should ensure that we're not hogging a cpu/token unnecessarily
without doing any work!

Closes #6747
2019-03-15 07:07:06 -07:00
Eric Huss 78a60bc74f Stricter package change detection. 2019-03-12 20:33:45 -07:00
dependabot[bot] 5087cc45e4
Update glob requirement from 0.2.11 to 0.3.0
Updates the requirements on [glob](https://github.com/rust-lang/glob) to permit the latest version.
- [Release notes](https://github.com/rust-lang/glob/releases)
- [Commits](https://github.com/rust-lang/glob/compare/0.2.11...0.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-07 05:50:26 +00:00
Eric Huss 1a0430fd88 Bump to 0.36.0 2019-03-04 22:12:21 -08:00
Dale Wijnand 53a0995b4b
Add detail to multiple rename deps 2019-01-28 16:03:30 +00:00
Alex Crichton 78637a6bb8 Bump to 0.35.0
A routine update!
2019-01-22 13:18:16 -08:00
Eric Huss 3d84d0ad77 Add dependency `registry` to `cargo metadata`.
This adds the `registry` field for dependencies for alternate registries in
`cargo metadata`.
2018-12-29 21:14:25 -08:00
dependabot[bot] ed66cbc700
Update git2-curl requirement from 0.8.1 to 0.9.0
Updates the requirements on [git2-curl](https://github.com/alexcrichton/git2-rs) to permit the latest version.
- [Release notes](https://github.com/alexcrichton/git2-rs/releases)
- [Commits](https://github.com/alexcrichton/git2-rs/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-14 16:30:00 +00:00
dependabot[bot] 56dffe70cd
Update git2 requirement from 0.7.5 to 0.8.0
Updates the requirements on [git2](https://github.com/alexcrichton/git2-rs) to permit the latest version.
- [Release notes](https://github.com/alexcrichton/git2-rs/releases)
- [Commits](https://github.com/alexcrichton/git2-rs/commits/git2-curl-0.8.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-14 05:51:03 +00:00
Eric Huss 502ab6505c Update rustfix to 0.4.4. 2018-12-13 14:01:44 -08:00
Eric Huss fffb05d8fc Display errors when `cargo fix` fails.
It can be difficult to figure out what's wrong when a user reports that
`cargo fix` fails. There's often a large list of warnings, and it can
be hard to figure out which one caused a compile error.
2018-12-13 13:59:06 -08:00
Dale Wijnand 0e031b5a96
Allow testsuite warnings in dev
This makes the deny(warnings) in the testsuite conditional on a new
"deny-warnings" feature, that is then enabled in CI.

Ideally I could use the (reasonably well established) CI env var (like
we do for proptests), but I don't know how to get the attribute to be
defined in terms of an env var.
2018-12-13 01:03:08 +00:00
Alex Crichton 76ce4dfebd Reformat after idiom lints 2018-12-11 05:54:56 -08:00
Alex Crichton 9ed82b5779 Start using 2018 idioms in Cargo
Remove a number of `extern crate` directives and tweak a number of
imports. Not all `extern crate` is gone yet but this is the bulk of
them!
2018-12-11 05:45:46 -08:00
Alex Crichton 1b886f7072 Bump to 0.34.0 2018-12-08 03:07:46 -08:00
bors 41a7e150fc Auto merge of #6387 - dwijnand:rust-2018, r=dwijnand
Upgrade to Rust 2018 & fix edition idioms

None
2018-12-07 16:37:19 +00:00
dependabot[bot] c8d9085fd3
Update pretty_env_logger requirement from 0.2 to 0.3
Updates the requirements on [pretty_env_logger](https://github.com/seanmonstar/pretty-env-logger) to permit the latest version.
- [Release notes](https://github.com/seanmonstar/pretty-env-logger/releases)
- [Commits](https://github.com/seanmonstar/pretty-env-logger/commits/v0.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-07 06:48:49 +00:00
Dale Wijnand 04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Dale Wijnand aa8eff88a9
Switch to pretty_env_logger, under --features pretty-env-logger 2018-11-30 14:13:35 +00:00
Eh2406 a703851abe try im-rs 2018-11-19 16:20:15 -05:00
Alex Crichton d9eca8c764 Enable the `zlib` feature of `flate2`
We're already pulling in zlib for other dependencies like curl/libgit2
so there's not really much use in duplicating the compression code with
miniz, so let's instruct `flate2` to use libz as well to compress and
decompress chunks.
2018-11-14 07:56:43 -08:00
bors 438c55d82e Auto merge of #6307 - alexcrichton:upgrade-crossbeam-utils, r=alexcrichton
Upgrade crossbeam-utils to 0.6.0
2018-11-13 00:47:39 +00:00
Alex Crichton 5e71ad6c5b Upgrade crossbeam-utils to 0.6.0 2018-11-12 08:04:28 -08:00
dependabot[bot] d3e22d81fd
Update env_logger requirement from 0.5.11 to 0.6.0
Updates the requirements on [env_logger](https://github.com/sebasmagri/env_logger) to permit the latest version.
- [Release notes](https://github.com/sebasmagri/env_logger/releases)
- [Commits](https://github.com/sebasmagri/env_logger/commits/v0.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-12 05:44:45 +00:00
Alex Crichton c181f490fc Enable HTTP/2 by default
This commit switches Cargo to using HTTP/2 by default. This is
controlled via the `http.multiplexing` configuration variable and has
been messaged out for testing [1] (although got very few responses).

There's been surprisingly little fallout from parallel downloads, so
let's see how this goes!

[1]: https://internals.rust-lang.org/t/testing-cargos-parallel-downloads/8466
2018-11-07 08:14:38 -08:00
bors f938c4f41b Auto merge of #6130 - alexcrichton:less-timeouts-u, r=ehuss
Fix timeouts firing while tarballs are extracted

This commit fixes #6125 by ensuring that while we're extracting tarballs
or doing other synchronous work like grabbing file locks we're not
letting the timeout timers of each HTTP transfer keep ticking. This is
curl's default behavior (which we don't want in this scenario). Instead
the timeout logic is inlined directly and we manually account for the
synchronous work happening not counting towards timeout limits.

Closes #6125
2018-11-06 01:53:17 +00:00
Khionu Sybiern 5a59494134 Remove patch and bump tar to 0.4.18
Signed-off-by: Khionu Sybiern <dev@khionu.net>
2018-11-05 11:42:19 -05:00
Khionu Sybiern 541e990681 Configure tar to not set mtime
Signed-off-by: Khionu Sybiern <dev@khionu.net>
2018-11-03 17:29:00 -04:00
Alex Crichton d2acfb6626 Bump to 0.33.0 2018-10-29 09:14:07 -07:00
Alex Crichton 0b0f089d3d Fix timeouts firing while tarballs are extracted
This commit fixes #6125 by ensuring that while we're extracting tarballs
or doing other synchronous work like grabbing file locks we're not
letting the timeout timers of each HTTP transfer keep ticking. This is
curl's default behavior (which we don't want in this scenario). Instead
the timeout logic is inlined directly and we manually account for the
synchronous work happening not counting towards timeout limits.

Closes #6125
2018-10-12 10:24:29 -07:00
Igor Matuszewski c1763256ac Bump flate2 to 1.0.3 2018-10-05 12:48:04 +02:00
Igor Matuszewski bcaaab03a8 Bump libgit2-sys to 0.7.9 2018-10-04 17:14:38 +02:00
bors 4e09634983 Auto merge of #5921 - Eh2406:proptest, r=alexcrichton
use proptest to fuzz the resolver

This has been a long time goal. This uses proptest to generate random registry indexes and throws them at the resolver.

It would be simple to generate a registry by,
1. make a list of name and version number each picked at random
2. for each pick a list of dependencies by making a list of name and version requirements at random.

Unfortunately, it would be extremely unlikely to generate any interesting cases, as the chance that the random name you depend on was also generated as the name of a crate is vanishingly small. So this implementation works very hard to ensure that it only generates valid dependency requirements.

This is still a WIP as it has many problems:
- [x] The current strategy is very convoluted. It is hard to see that it is correct, and harder to see how it can be expanded. Thanks to @centril for working with me on IRC to get this far. Do you have advice for improving it?
- [X] It is slow as molasses when run without release. I looked with a profilere and we seem to spend 2/3 of the time in `to_url`. Maybe we can special case `example.com` for test, like we do for `crates.io` or something? Edit: Done. `lazy_static` did its magic.
- [x] `proptest` does not yet work with `minimal-versions`, a taste of my own medicine.
- [x] I have not verified that, if I remove the fixes for other test that this regenerates them.

The current strategy does not:
- [x] generate interesting version numbers, it just dose 1.0.0, 2.0.0 ...
- [x] guarantee that the version requirements are possible to meet by the crate named.
- [ ] generate features.
- [ ] generate dev-dependencies.
- [x] build deep dependency trees, it seems to prefer to generate crates with 0 or 1 dependents so that on average the tree is 1 or 2 layers deep.

And last but not least, there are no interesting properties being tested. Like:
- [ ] If resolution was successful, then all the transitive requirements are met.
- [x] If resolution was successful, then unpublishing a version of a crate that was not selected should not change that.
- [x] If resolution was unsuccessful, then it should stay unsuccessful even if any version of a crate is unpublished.

- [ ] @maurer suggested testing for consistency. Same registry, same cargo version, same lockfile, every time.
- [ ] @maurer suggested a pareto optimality property (if all else stays the same, but new package versions are released, we don't get a new lockfile where every version is <= the old one, and at least one is < the old one)
2018-09-25 00:59:33 +00:00
Eh2406 6763eded58 proptest 0.8.7 has a better `ci_no_shrink` 2018-09-24 12:17:16 -04:00
David Tolnay d1218d2961
Fix missing messages when --message-format=json is deeply nested
This commit switches from serde_json::Value to RawValue, which can
process arbitrarily deeply nested JSON content without recursion.
2018-09-23 14:12:10 -07:00
Alex Crichton d9534bf498 Only load `~/.cargo/config` for `cargo install`
This commit tweaks how configuration is loaded for `cargo install`, ensuring
that we only load configuration from `$HOME` instead of the current working
directory. This should make installations a little more consistent in that they
probably shouldn't cover project-local configuration but should respect global
configuration!

Closes #6025
2018-09-21 13:21:32 -07:00
Eh2406 40d9de46d6 Merge remote-tracking branch 'origin/master' into proptest 2018-09-19 22:04:11 -04:00
Alex Crichton bc942919e3 Use `Message::result_for` for better error messages
Recently fixed in the `curl` crate, this'll allow getting the full and complete
error message for each transfer instead of just the error code.
2018-09-18 11:33:18 -07:00
Alex Crichton a46df8fe7d Update the progress bar for parallel downloads
This is actually a super tricky problem. We don't really have the capacity for
more than one line of update-able information in Cargo right now, so we need to
squeeze a lot of information into one line of output for Cargo. The main
constraints this tries to satisfy are:

* At all times it should be clear what's happening. Cargo shouldn't just hang
  with no output when downloading a crate for a long time, a counter ideally
  needs to be decreasing while the download progresses.

* If a progress bar is shown, it shouldn't jump around. This ends up just being
  a surprising user experience for most. Progress bars should only ever
  increase, but they may increase at different speeds.

* Cargo has, currently, at most one line of output (as mentioned above) to pack
  information into. We haven't delved into fancier terminal features that
  involve multiple lines of update-able output.

* When downloading crates as part of `cargo build` (the norm) we don't actually
  know ahead of time how many crates are being downloaded. We rely on the
  calculation of unit dependencies to naturally feed into downloading more
  crates.

* Furthermore, once we decide to download a crate, we don't actually know how
  big it is! We have to wait for the server to tell us how big it is.

There doesn't really seem to be a great solution that satisfies all of these
constraints unfortunately. As a result this commit implements a relatively
conservative solution which should hopefully get us most of the way there. There
isn't actually a progress bar but rather Cargo prints that it's got N crates
left to download, and if it takes awhile it prints out that there are M bytes
remaining.

Unfortunately the progress is pretty choppy and jerky, not providing a smooth
UI. This appears to largely be because Cargo will synchronously extract
tarballs, which for large crates can cause a noticeable pause. Cargo's not
really prepared internally to perform this work on helper threads, but ideally
if it could do so it would improve the output quite a bit! (making it much
smoother and also able to account for the time tarball extraction takes).
2018-09-18 11:33:18 -07:00
Alex Crichton 468f243e0e Parallelize downloads with HTTP/2
This commit implements parallel downloads using `libcurl` powered by
`libnghttp2` over HTTP/2. Using all of the previous refactorings this actually
implements usage of `Multi` to download crates in parallel. This achieves some
large wins locally, taking download times from 30s to 2s in the best case.

The standard output of Cargo is also changed as a result of this commit. It's
no longer useful for Cargo to print "Downloading ..." for each crate really as
they all start instantaneously. Instead Cargo now no longer prints `Downloading`
by default (unless attached to a pipe) and instead only has one progress bar for
all downloads. Currently this progress bar is discrete and based on the total
number of downloads, no longer specifying how much of one particular download
has happened. This provides a less granular view into what Cargo is doing but
it's hoped that it looks reasonable from an outside perspective as there's
still a progress bar indicating what's happening.
2018-09-18 11:33:04 -07:00
Alex Crichton aab0a33859 Bump cargo to 0.32.0
It's that time of every-6-weeks!
2018-09-17 18:42:51 -07:00
bors 8201560b69 Auto merge of #5988 - Eh2406:explore_the_bug, r=alexcrichton
BUG fuzzing found a bug in the resolver, we need a complete set of conflicts to do backjumping

As mentioned in https://github.com/rust-lang/cargo/pull/5921#issuecomment-418890269, the new proptest found a live bug! This PR so far tracs my attempt to minimize the problematic input.

The problem turned out to be that we where backjumping on incomplete set of conflicts.
2018-09-17 22:01:12 +00:00
Eh2406 682b295257 bump env_logger to a more minimal-versions compatible one 2018-09-17 17:58:38 -04:00
Alex Crichton 0b30a790b1 Bump Cargo to 0.30.0
Looks like we accidentally forgot to do this!
2018-09-07 08:43:02 -07:00
Eh2406 17fe190aba update to the new version of proptest 2018-08-26 22:11:20 -04:00
Eh2406 ce1772c85a get working with minimal-versions 2018-08-21 16:43:06 -04:00
Eh2406 56a222cd30 a start on using proptest to fuzz the resolver 2018-08-21 14:10:14 -04:00
dependabot[bot] e36ae43400
Update opener requirement from 0.2.0 to 0.3.0
Updates the requirements on [opener](https://github.com/Seeker14491/opener) to permit the latest version.
- [Release notes](https://github.com/Seeker14491/opener/releases)
- [Changelog](https://github.com/Seeker14491/opener/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Seeker14491/opener/commits/v0.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-20 05:27:11 +00:00
bors a284c3ff96 Auto merge of #5856 - Eh2406:min-test, r=alexcrichton
run some tests with minimal-versions on CI

In #5757 we discovered that sum test don't pass with minimal-versions, and so only added CI for `cargo check`. This PR is to see if that is still needed, and if it is then which test rely on upstream bugfix.
2018-08-15 17:00:22 +00:00
Jacob Finkelman c4d565fc8f Try serde_json 2018-08-14 10:58:42 -04:00
Eh2406 1eaae61289 get `features_are_quoted` working with minimal-versions on CI 2018-08-14 10:58:42 -04:00
Brian Bowman 48d0708aa6 Handle opening browser with `opener` crate
Fixes #5701
2018-08-13 21:00:34 -05:00
bors 0e7a46e327 Auto merge of #5858 - dekellum:git-check-logging-and-test, r=alexcrichton
Improve verbose console and log for finding git repo in package check

Third attempt to resolve #5823 by improving logging and tests. This exposes the issue to testing,  via verbose console output and is dependent on alexcrichton/git2-rs#341 as just released in git2 0.7.5 crate. Thus tests *should* now pass on all platforms, incl. windows, but I also intend to bump the minimal git2 release dependency (in a subsequently added commit).

cc: @Eh2406 thanks for your fix and help!
2018-08-07 22:19:54 +00:00
bors 2b6e99639f Auto merge of #5862 - kennytm:capture-rustc-output, r=alexcrichton
Fully capture rustc and rustdoc output when -Zcompile-progress is passed

Fixes #5764 and #5695.

On Windows, we will parse the ANSI escape code into console commands via my `fwdansi` package, based on @ishitatsuyuki's idea in https://github.com/rust-lang/cargo/issues/5695#issuecomment-406300234. Outside of Windows the content is forwarded as-is.
2018-08-06 15:12:01 +00:00
Alex Crichton 585c7d43f9 Add a feature to build a vendored OpenSSL
This will be enabled through rust-lang/rust to ensure that for dist builds we
can build a Cargo with a vendored OpenSSL
2018-08-04 23:02:57 -07:00
kennytm 641f7ff2c7
Capture output from rustc and rustdoc. 2018-08-04 00:51:42 +08:00
David Kellum fcd86f3270 Update git2 minimal version to 0.7.5 for a fix 2018-08-02 15:46:19 -07:00
Alex Crichton 4477355b01 Switch strategies for how rustc's workspace is unioned
See rust-lang/rust#52919 for more details.
2018-08-01 21:28:47 -07:00
Alex Crichton adbd625e35 Upgrade to `failure 0.1.2` idioms
Fixes some deprecation warnings in Cargo
2018-08-01 07:20:04 -07:00
Alex Crichton 876a50366b fix: Iteratively apply suggestions from the compiler
This commit updates the `cargo fix` implementation to iteratively apply fixes
from the compiler instead of only once. Currently the compiler can sometimes
emit overlapping suggestions, such as in the case of transitioning

    ::foo::<::Bar>();

to ...

    crate::foo::<crate::Bar>();

and `rustfix` rightfully can't handle overlapping suggestions as there's no
clear way of how to disambiguate the fixes. To fix this problem Cargo will now
run `rustc` and `rustfix` multiple times, attempting to reach a steady state
where no fixes failed to apply.

Naturally this is a pretty tricky thing to do and we want to be sure that Cargo
doesn't loop forever, for example. A number of safeguards are in place to
prevent Cargo from going off into the weeds when fixing files, notably avoiding
to reattempt fixes if no successful fixes ended up being applied.

Closes #5813
Closes rust-lang/rust#52754
2018-07-31 14:20:58 -07:00
dependabot[bot] 6f11cd9e14
Update crossbeam-utils requirement to 0.5
Updates the requirements on [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam-utils) to permit the latest version.
- [Release notes](https://github.com/crossbeam-rs/crossbeam-utils/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam-utils/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam-utils/commits/v0.5.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-26 05:30:17 +00:00
Dale Wijnand 8ea90e96cf
Switch to crossbeam_utils crate, sidesteppin 2018-07-25 23:32:25 +01:00
Dale Wijnand ac2d5d0917
Update the minimal parking_lot_core version 2018-07-25 17:11:26 +01:00
dependabot[bot] 4b73ed06cb
Update crossbeam requirement to 0.4
Updates the requirements on [crossbeam](https://github.com/crossbeam-rs/crossbeam) to permit the latest version.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-25 05:31:03 +00:00
Eh2406 4a8c70ecc0 update curl so we don't need so may hacks 2018-07-24 10:41:10 -04:00
Eh2406 96d3c05f84 typo 2018-07-23 10:42:36 -04:00
Eh2406 f6a29a7707 clarify synthetic nature of dep 2018-07-21 12:35:35 -04:00
Eh2406 8a7123c79e update min dependencies to build with minimal-versions on windows 2018-07-20 22:04:27 -04:00
Eh2406 adc8b5d6e1 update min dependencies to build with minimal-versions
Big thanks to @klausi for doing most of the work!
Thanks to @matklad for pointing out that we could finish it.
2018-07-20 17:13:08 -04:00
dependabot[bot] 413e6489ff
Update termcolor requirement to 1.0
Updates the requirements on [termcolor](https://github.com/BurntSushi/termcolor) to permit the latest version.
- [Release notes](https://github.com/BurntSushi/termcolor/releases)
- [Commits](https://github.com/BurntSushi/termcolor/commits/wincolor-1.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-18 05:36:04 +00:00
Alex Crichton b02ba3771e Import `cargo fix` directly in to Cargo
This commit imports the `cargo fix` subcommand in rust-lang-nursery/rustfix
directly into Cargo as a subcommand. This should allow us to ease our
distribution story of `cargo fix` as we prepare for the upcoming 2018 edition
release.

It's been attempted here to make the code as idiomatic as possible for Cargo's
own codebase. Additionally all tests from cargo-fix were imported into Cargo's
test suite as well. After this lands and is published in nightly the `cargo-fix`
command in rust-lang-nursery/rustfix will likely be removed.

cc rust-lang/rust#52272
2018-07-16 21:58:58 -07:00
dependabot[bot] 2f8c049e47
Update lazycell requirement to 1.0
Updates the requirements on [lazycell](https://github.com/indiv0/lazycell) to permit the latest version.
- [Release notes](https://github.com/indiv0/lazycell/releases)
- [Changelog](https://github.com/indiv0/lazycell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/indiv0/lazycell/commits/v1.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-06 20:11:14 +00:00
Nick Cameron 4671a2aa7a Add missing winapi features
To support RLS in Rust repo, features from https://github.com/rust-lang/rust/pull/51677#issuecomment-402781751
2018-07-06 11:05:12 +12:00
kennytm a8081a007e
More fixes. 2018-06-30 01:39:35 +08:00
Alex Crichton b89917a903 Bump to 0.30.0 2018-06-27 11:49:57 -07:00
Alex Crichton 1ac02cebc4 Update version of core-foundation crate 2018-05-22 19:46:30 -07:00
Alex Crichton f7e5315e98 Bump to 0.29.0 2018-05-07 19:40:58 -07:00
Klaus Purer ecbbc90f3a fix(dependendies): Bump minimal dependency versions so that cargo successfully builds with those 2018-04-22 20:55:53 +02:00
Alex Crichton 039ca019d7 Bump version of `filetime` dependency 2018-04-17 15:08:04 -07:00
Alex Crichton a79c2ab6bc Bump to 0.28.0
Looks like we've forgotten to do this so far on nightly!
2018-04-16 20:29:41 -07:00
Bastien Orivel 8daf81e193 Replace tempdir by tempfile
The former has been deprecated in favor of the latter
2018-03-26 13:29:02 +02:00
Alex Crichton 46b18260d9 More effort to only compile Cargo once
Hopefully one final change necessary for rust-lang/rust#49053
2018-03-25 23:52:55 -07:00
Alex Crichton 7cab2b20b3 Remove scoped_tls dependency
This is causing [conflicts] with rebuilding upstream in rust-lang/rust, so
remove this for now until we figure out a better solution.

[conflicts]: https://github.com/rust-lang/rust/pull/49053#issuecomment-375906970
2018-03-24 12:54:26 -07:00
Aleksey Kladov a1735c7aff Regression tests for #5201
Better safe than sorry!
2018-03-19 23:51:49 +03:00
Alex Crichton 841f20ae71 Add a synthetic dependency on num-traits
Right now the rust-lang/rust integration is compiling Cargo twice on dist
builds, once for Cargo and once for the RLS. This is due to a dependency of
Cargo being recompiled with different features when used from the RLS or not.
For now paper over this problem with a synthetic dependency to prevent Cargo
from being compiled twice.
2018-03-15 11:00:32 -07:00
Aleksey Kladov cbd14ee8f0 Use conventions to specify the integration tests 2018-03-14 14:55:19 +03:00
bors 3cfb23bc56 Auto merge of #5152 - matklad:clap, r=alexcrichton
Clap

Reopening of #5129

So, looks like all tests are 🍏 on my machine!

I definitely want to refactor it some more, and also manually checked that we haven't regressed any help messages, but all the major parts are in place already.
2018-03-13 14:46:45 +00:00
Matthias Krüger 63d87d92a3 remove "filetime 0.1" dependency from dev profile, filetime is already a regular dependency. 2018-03-11 15:08:12 +01:00
Aleksey Kladov 285fbdfe3b Remove docopt dependency 2018-03-08 23:38:08 +03:00
Aleksey Kladov 38f81e05b3 Port bench and build to clap 2018-03-08 23:30:46 +03:00
Eh2406 1f764c5548 make a global string interner
In a test on https://github.com/rust-lang/cargo/issues/4810#issuecomment-357553286
Before we got to 5000000 ticks in ~72 sec
After we got to 5000000 ticks in ~65 sec
2018-03-06 15:30:56 -05:00
Alex Crichton 2a063798eb Drop outdated hamcrest dependency
This hasn't been updated in awhile and in general we've been barely using it.
This drops the outdated dependency and vendors a small amount of the
functionality that it provided. I think eventually we'll want to transition away
from this method of assertions but I wanted to get this piece in to avoid too
much churn in one commit.
2018-03-01 11:03:54 -08:00
Alex Crichton de70bc01db Fold cargotest into testsuite
Now that there's only one crate with integration tests there's no need to have
this be a separate crate, yay!
2018-03-01 09:45:56 -08:00
Alex Crichton a85c917b6b Update git2 to 0.7.0
cc #5066
2018-02-27 06:24:26 -08:00
Aleksey Kladov e3eb2868d8 Revert "Seperate licenses with a `/`"
This reverts commit 1ddba76a0f.

OR is the more modern form
2018-02-26 21:19:26 +03:00
Alex Crichton c8c36e47de Bump to 0.27.0 2018-02-26 07:35:03 -08:00
Christopher Durham 1ddba76a0f
Seperate licenses with a `/` 2018-02-24 23:48:09 -05:00
André Rocha c2ff988c9f Reorganize integration tests as one crate with many modules. Issue #4867. 2018-02-21 13:33:51 -05:00
bors 2d42bcf41f Auto merge of #5033 - alexcrichton:update-deps, r=matklad
Update dependencies

Just a few major updates here and there
2018-02-12 22:32:11 +00:00
Alex Crichton b90bb7d6a8 Update dependencies
Just a few major updates here and there
2018-02-12 14:30:18 -08:00
Aleksey Kladov 7f3e86e069 Switch to lazycell from crate.io 2018-02-12 21:33:31 +03:00
Benno Fünfstück 330f32c58e Require at least version 0.1.9 of jobserver crate
There are some important fixes in jobserver >=0.1.8. With earlier
versions, it's possible for cargo to panic with a "failed to acquire
jobserver token" error, which can be very hard to track down.

Requiring the latest version of jobserver makes sure that no such error
can make it into downstream distributions.
2018-01-31 10:16:01 +01:00
Steven Fackler a540a39b84 Upgrade env_logger
0.4 depends on log 0.3 and so misses out on module names.
2018-01-17 09:40:00 -08:00
bors f60ece98c1 Auto merge of #4920 - wking:license-expression, r=matklad
Cargo.toml: Replace '/' with 'OR' in 'license'

Catch up with our recommendations from 7dee65fe (#4898), which deprecated `/` in favor of vanilla SPDX license expressions.

I've gone with the disjunctive `OR`, because the README has:

> Cargo is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).
2018-01-08 19:11:39 +00:00
W. Trevor King 4977c4c041 Cargo.toml: Replace '/' with 'OR' in 'license'
Catch up with our recommendations from 7dee65fe (src/doc/manifest: Pin
'license' to SPDX 2.1 expressions and the 2.4 list, 2018-01-04,
#4898), which deprecated '/' in favor of vanilla SPDX license
expressions.

I've gone with the disjunctive OR, because the README has:

> Cargo is primarily distributed under the terms of both the MIT
> license and the Apache License (Version 2.0).
2018-01-08 10:47:06 -08:00
Alex Crichton 5cca4e8c24 Leverage local links on git checkouts
This commit updates the handling of git checkouts from the database to use
hardlinks if possible, speeding up this operation for large repositories
significantly.

As a refresher, Cargo caches git repositories in a few locations to speed up
local usage of git repositories. Cargo has a "database" folder which is a bare
checkout of any git repository Cargo has cached historically. This database
folder contains effectively a bunch of databases for remote repos that are
updated periodically.

When actually building a crate Cargo will clone this database into a different
location, the checkouts folder. Each rev we build (ever) is cached in the
checkouts folder. This means that once a checkout directory is created it's
frozen for all of time.

This latter step is what this commit is optimizing. When checking out the
database onto the local filesystem at a particular revision. Previously we were
instructing libgit2 to fall back to a "git aware" transport which was
exceedingly slow on some systems for filesystem-to-filesystem transfers. This
optimization (we just forgot to turn it on in libgit2) is a longstanding one and
should speed this up significantly!

Closes #4604
2018-01-08 09:38:40 -08:00
Alex Crichton b3005021ad Bump to 0.26.0 2018-01-04 08:00:08 -08:00
bors 28f89fdfaf Auto merge of #4891 - MaloJaffre:compiler-docs-regression, r=alexcrichton
Try to fix a perf regression by updating log

Upgrade `log` to `0.4` in `cargo` and `cargotest`.

Cc: rust-lang/rust#47154.
2018-01-03 20:43:03 +00:00
Malo Jaffré 5731a732b8 Try to fix a perf regression by updating log
Upgrade `log` to `0.4` in `cargo` and `cargotest`.
2018-01-03 21:19:02 +01:00
bors 2316ca0b7d Auto merge of #4877 - steffengy:master, r=alexcrichton
migrate to winapi 0.3
2018-01-03 19:47:09 +00:00
Alex Crichton 64828ba9ca Touch up style of Windows imports 2018-01-03 11:25:28 -08:00
Bastien Orivel 98eec2ce0f Bump hex to 0.3 2018-01-02 20:35:32 +01:00
Bastien Orivel ece662ca9b Bump dependencies
Those dependencies didn't need any code change
2018-01-02 12:08:44 +01:00
Steffen Butzer 285a1983f8 migrate to winapi 0.3 2017-12-30 18:39:42 +01:00
Malo Jaffré 33fbc02424 Upgrade flate2 crate to 1.0
Unblocks rust#46278.
2017-12-29 15:37:22 +01:00
Alex Crichton 37cffbe0a3 Start migration to the `failure` crate
This commit is the initial steps to migrate Cargo's error handling from the
`error-chain` crate to the `failure` crate. This is intended to be a low-cost
(in terms of diff) transition where possible so it's note "purely idiomatic
`failure` crate" just yet.

The `error-chain` dependency is dropped in this commit and Cargo now canonically
uses the `Error` type from the `failure` crate. The main last remnant of
`error-chain` is a custom local extension trait to use `chain_err` instead of
`with_context`. I'll try to follow up with a commit that renames this later but
I wanted to make sure everything worked first! (and `chain_err` is used
practically everywhere).

Some minor tweaks happened in the tests as I touched up a few error messages
here and there but overall the UI of Cargo should be exactly the same before and
after this commit.
2017-12-18 17:48:36 -08:00
Aidan Hobson Sayers edb02dcf9b Remove overflow checks to eliminate rust build warnings
Although the checks are desirable, they cause warnings in the rust build
(due to workspaces) which could cause needless concern. The checks
aren't too important, so just disable them.
2017-12-14 21:14:32 +00:00
Aidan Hobson Sayers 1c3bba34db Don't incorrectly compute cur from binary heap 2017-12-05 21:08:40 +00:00
Alex Crichton 2aed91fc18 Bump to 0.25.0 2017-11-30 15:17:35 -08:00
Alex Crichton 5c9665f41c Delete Cargo.lock from this repo
There's now a lock file upstream in rust-lang/rust so the one here isn't
actually used, and otherwise this crate is used as a dependency so the lock file
isn't respected anyway!
2017-10-18 07:43:15 -07:00
Alex Crichton 9b8efd18e9 Bump to 0.24.0
It's that time of the year again!
2017-10-15 08:30:11 -07:00
equal-l2 4acb69897b Use crypto-hash to calculate SHA256 2017-09-27 22:27:55 +09:00
Alex Crichton 4c077033dd Update dependencies
Just a usual `cargo update` plus moving over some major versions
2017-09-05 15:29:07 -07:00
Alex Crichton 1e54d9efa3 Bump Cargo to 0.23.0 2017-08-28 07:45:43 -07:00
bors 8720d63bc1 Auto merge of #4390 - alexcrichton:read-hard-links, r=matklad
Use `same-file` to avoid unnecessary hard links

This is targeted at removing the need for a workaround in rust-lang/rust#39518,
allowing the main rust build system to move back to hard links which should be
much more efficient.
2017-08-10 09:04:21 +00:00
Kornel 8e0a7caddf Exclude target directory from Time Machine
Temporary/derived files outside dedicated system directories should be explicitly excluded from backups to prevent undesirable bloat and churn.
2017-08-10 01:42:32 +01:00
Alex Crichton 599db09980 Use `same-file` to avoid unnecessary hard links
This is targeted at removing the need for a workaround in rust-lang/rust#39518,
allowing the main rust build system to move back to hard links which should be
much more efficient.
2017-08-09 17:22:34 -07:00
Guillaume Gomez 6f23ce5cc2 Update to rc error chain 2017-07-28 21:12:05 +02:00
Kevin Yap aa4f86fcd4 Convert Options struct into unit struct
Unit struct support was added in Docopt 0.8.1 via
docopt/docopt.rs#217. Fixes #4174.
2017-07-22 13:44:47 -07:00
Alex Crichton e8a7132805 Bump to 0.22.0 and update deps 2017-07-20 08:35:07 -07:00
Brian Anderson fdb9f1bd1d Replace homedir definition with home crate 2017-07-18 17:25:31 -07:00
Behnam Esfahbod c072ba4242 [sources/path] Add gitignore-like pattern matching and warn on mismatches
Add gitignore-like pattern matching logic to `list_files()` and throw
warnings for paths getting different inclusion/exclusion results from
the old and the new methods.

Migration Tracking: <https://github.com/rust-lang/cargo/issues/4268>
2017-07-18 00:14:14 -06:00
Alex Crichton f429be4f4c Don't set MAKEFLAGS for build scripts
Closes #4156
Closes rust-lang/rust#42635
2017-07-12 14:15:56 -07:00
Alex Crichton 9629f99dd0 Use the `atty` crate for TTY detection
This is more robust in the face of msys terminals and otherwise helps share more
dependencies!

Closes #4166
2017-06-15 08:08:35 -07:00
Alex Crichton f8fb0a0228 Migrate from the `term` crate to `termcolor`
The API of `termcolor` fits what the system gives us much more nicely and should
be well battle-tested from ripgrep. Additionally we don't really need huge
terminfo parsers, that wasn't every really the intention of the color support
here.
2017-06-13 14:28:37 -07:00
Andronik Ordian 10373f4039 Drop rustc-serialize dependency 2017-06-09 00:56:48 +03:00
Alex Crichton 90299a66f2 Bump to 0.21.0
We're working on the next version now!
2017-06-08 09:08:01 -07:00
Marco A L Barbosa 728694abf0 Bump jobserver to 0.1.4 2017-06-05 14:15:40 -03:00
Alex Crichton 74777c1274 Remove more allocatoins in index querying
Removing some allocations arounds the stored hashes by having nested hash maps
instead of tuple keys. Also remove an intermediate array when parsing
dependencies through a custom implementation of `Deserialize`. While this
doesn't make this code path blazingly fast it definitely knocks it down in the
profiles below other higher-value targets.
2017-06-05 07:36:44 -07:00
Alex Crichton cbf25a9b0a Add a GNU make jobserver implementation to Cargo
This commit adds a GNU make jobserver implementation to Cargo, both as a client
of existing jobservers and also a creator of new jobservers. The jobserver is
actually just an IPC semaphore which manifests itself as a pipe with N bytes
of tokens on Unix and a literal IPC semaphore on Windows. The rough protocol
is then if you want to run a job you read acquire the semaphore (read a byte on
Unix or wait on the semaphore on Windows) and then you release it when you're
done.

All the hairy details of the jobserver implementation are housed in the
`jobserver` crate on crates.io instead of Cargo. This should hopefully make it
much easier for the compiler to also share a jobserver implementation
eventually.

The main tricky bit here is that on Unix and Windows acquiring a jobserver token
will block the calling thread. We need to either way for a running job to exit
or to acquire a new token when we want to spawn a new job. To handle this the
current implementation spawns a helper thread that does the blocking and sends a
message back to Cargo when it receives a token. It's a little trickier with
shutting down this thread gracefully as well but more details can be found in
the `jobserver` crate.

Unfortunately crates are unlikely to see an immediate benefit of this once
implemented. Most crates are run with a manual `make -jN` and this overrides the
jobserver in the environment, creating a new jobserver in the sub-make. If the
`-jN` argument is removed, however, then `make` will share Cargo's jobserver and
properly limit parallelism.

Closes #1744
2017-06-02 08:06:30 -07:00
jluner 7f6dbc14da Resolve upstream updates to referenced crates 2017-05-27 23:50:55 -05:00
Alex Crichton 0ceab8e3c1 Update a slew of dependencies and such
Standard bug fixes and otherwise keeping up to date
2017-05-27 17:21:42 -07:00
jluner e95044e313 Add error-chain errors
Convert CargoResult, CargoError into an implementation provided by error-chain. The previous is_human machinery is mostly removed; now errors are displayed unless of the Internal kind, verbose mode will print all errors.
2017-05-24 21:14:04 -05:00
Alex Crichton 852968e679 Remove chrono as a dependency
Turns out we don't use it!
2017-05-18 09:02:40 -07:00
Alex Crichton 2dd168c14e Bump to 0.20.0 2017-04-27 20:11:52 -07:00
Alex Crichton 0b59f17d63 Update dependencies Cargo uses
Namely update to serde 1.0.0!
2017-04-27 12:06:34 -07:00
Ewan Higgs b998130435 Cleanup of template patch reversion. 2017-03-29 22:23:46 +02:00
Ewan Higgs 7e66058af4 Revert "Cargo templating for `new` and `init`"
This reverts commit 875a8aba79.
2017-03-29 21:57:33 +02:00
Ewan Higgs d869179c48 Revert "Upgrade handlebars to 0.25."
This reverts commit 0aad658f09.
2017-03-29 21:54:39 +02:00
Ewan Higgs 82830c77bd Revert "Use time crate directly to get the year"
This reverts commit 47221e9818.
2017-03-29 21:51:50 +02:00
Ewan Higgs 2c8f94288d Revert "Add year to project template variables"
This reverts commit 69ffd99f42.
2017-03-29 21:50:53 +02:00
Alex Crichton d6f088a028 Bump to 0.19.0 2017-03-16 14:03:30 -07:00
bors 3bc886585d Auto merge of #3795 - jryans:template-year, r=alexcrichton
Add year to project template variables

This adds the current year as a `year` variable for project templates. Some license files / headers include the year, so this should make it easier to include those in a template.
2017-03-06 20:42:29 +00:00
J. Ryan Stinnett 47221e9818 Use time crate directly to get the year 2017-03-06 11:41:19 -06:00
J. Ryan Stinnett 69ffd99f42 Add year to project template variables 2017-03-03 12:49:44 -06:00
Ning Sun 72d0a72d64
Use serde type system for handlebars
This will help cargo to drop rustc_serialize as dependency
2017-03-03 17:25:06 +08:00
Alex Crichton 923f21c32e Add an option to ignore SSL revocation checking
This is apparently required in some Windows setups to get past SSL context
creation in schannel.
2017-02-22 12:31:47 -08:00
Alex Crichton a5a298f1fd Migrate from rustc-serialize to Serde
This commit migrates Cargo as much as possible from rustc-serialize to
Serde. This not only provides an excellent testing ground for the toml
0.3 release but it also is a big boost to the speed of parsing the JSON
bits of the registry.

This doesn't completely excise the dependency just yet as docopt still
requires it along with handlebars. I'm sure though that in time those
crates will migrate to serde!
2017-02-22 10:29:40 -08:00
Alex Crichton a2c82595e9 Update dependencies
Another major version of Cargo, another suite of updated dependencies!
2017-02-07 09:43:15 -08:00
bors ad92930421 Auto merge of #3647 - alexcrichton:dox, r=alexcrichton
Update API doc URL for Cargo

Closes #3640
2017-02-03 22:15:29 +00:00
Alex Crichton d941bea3d7 Update API doc URL for Cargo
Closes #3640
2017-02-03 14:14:36 -08:00
bors c0650fb9fe Auto merge of #3635 - alexcrichton:bump, r=alexcrichton
Bump to 0.18.0
2017-02-03 05:58:33 +00:00
Alex Crichton d53ab1d8e3 Bump to 0.18.0 2017-02-02 11:30:37 -08:00
Steve Klabnik 090d48b39d bump semver version 2017-02-02 13:52:09 -05:00
Ewan Higgs 0aad658f09 Upgrade handlebars to 0.25. 2017-01-31 10:23:44 +01:00
Ewan Higgs 875a8aba79 Cargo templating for `new` and `init`
PR #3004 This is a resubmission of the PR #1747 (from scratch) which adds
support for templating in Cargo. The templates are implemented using the
handlebars crate (where the original PR used mustache).

Examples:
cargo new --template https://url/to/template somedir foo
cargo new --template https://url/to/templates --template-subdir somedir foo
cargo new --template ../path/to/template somedir foo
2017-01-31 10:23:42 +01:00
Nathan Froyd f6dd5c2e20 make certain dependencies Windows-only
Inspired by servo/heapsize#71, we make certain dependencies only
required under Windows.
2017-01-06 07:03:05 -05:00
Steven Fackler d105e75271 Use externally sourced shell-escape
Closes #3374
2016-12-30 10:21:10 -08:00
Alex Crichton 5f4b9f27d0 Bump crates-io to 0.6.0 2016-12-25 08:02:35 -08:00
Alex Crichton 9c0be483f6 Bump to 0.17.0 2016-12-19 16:28:47 -08:00
Alex Crichton 8dc8c08624 Bump to 0.16.0 2016-11-16 16:05:31 -08:00
Alex Crichton 15acaa9c31 More updates for OpenSSL 1.1.0 2016-11-14 13:55:11 -08:00
Josh Stone 0af16532b2 Update dependencies for OpenSSL 1.1.0 compatibility
The primary targets here are openssl and openssl-sys crates 0.9,
bringing support for OpenSSL 1.1.0.  This requires updating the curl
and git2 related dependencies as well.

A small change is required in cargo itself for the new Hasher API.
Results from the hasher are simply unwrapped for now, matching the
Windows behavior that already panics on error.
2016-11-11 11:06:07 -08:00
Alex Crichton 61860021c3 Bump to 0.15.0 2016-11-10 12:17:45 -08:00
Steve Klabnik 464e6a96fb Bump to semver@0.5.0 2016-10-07 16:03:08 -04:00
Steve Klabnik c0f854cfc6 upgrade semver 2016-10-07 10:57:31 -07:00
Alex Crichton 5ede71e539 Leak mspdbsrv.exe processes on Windows
Instead of having our job object tear them down, instead leak them intentionally
if everything succeeded.

Closes #3161
2016-10-04 16:15:28 -07:00
Alex Crichton 4c2bfad067 Bump to 0.14.0 2016-09-29 11:31:17 -07:00
Steve Klabnik c49c1a9ba3 Revert to previous semver version.
As it turns out, people were taking advantage of bugginess in semver, so
we can't do this upgrade yet.

Fixes #3001
2016-08-17 10:10:10 -04:00
Alex Crichton 7a8ad36997 Update dependencies in Cargo.lock
A few bug fixes here and there we'll pick up (e.g. the gcc crate on newer MSVC
versions), but otherwise just staying on top of things.
2016-08-08 10:46:55 -07:00
John Ericson 2a66dfba1f Use openssl on Unix rather than C functions directly for SHA256 2016-08-01 13:28:25 -07:00
Steve Klabnik 9ba793a9af bump to newer semver version 2016-07-30 14:09:51 -04:00
Alex Crichton fb2faf29b2 Bump to 0.13.0 2016-07-07 09:44:05 -07:00
Steve Klabnik 6f240656e5 Change cargo.toml to use `[package]`
These are aliases, but `[project]` is considered incorrect these days.
2016-06-28 15:17:47 -04:00
Alex Crichton 26690d33e4 Stream build script output to the console
This commit alters Cargo's behavior when the `-vv` option is passed (two verbose
flags) to stream output of all build scripts to the console. Cargo makes not
attempt to prevent interleaving or indicate *which* build script is producing
output, rather it simply forwards all output to one to the console.

Cargo still acts as a middle-man, capturing the output, to parse build script
output and interpret the results. The parsing is still deferred to completion
but the stream output happens while the build script is running.

On Unix this is implemented via `select` and on Windows this is implemented via
IOCP.

Closes #1106
2016-06-14 07:35:51 -07:00
bors f8e75eca75 Auto merge of #2680 - alexcrichton:update-toml, r=brson
Update TOML parser to pick up a bugfix

Cargo has previously accepted invalid TOML as valid, but this bugfix should fix
the problem. In order to prevent breaking all crates immediately toml-rs has a
compatibility mode which emulates the bug that was fixed. Cargo will issue a
warning if this compatibility is required to parse a crate.
2016-06-12 05:21:23 -07:00
Alex Crichton 2a1e16c08a Update TOML parser to pick up a bugfix
Cargo has previously accepted invalid TOML as valid, but this bugfix should fix
the problem. In order to prevent breaking all crates immediately toml-rs has a
compatibility mode which emulates the bug that was fixed. Cargo will issue a
warning if this compatibility is required to parse a crate.
2016-06-12 04:14:35 -07:00
bors 4fbd47c1a5 Auto merge of #2770 - alexcrichton:new-curl, r=brson
Update to curl 0.3
2016-06-07 15:52:14 -07:00
Alex Crichton f7d213e744 Update to curl 0.3 2016-06-04 23:48:05 -07:00
Alex Crichton bb82035f9c Bump version numbers
Working on 0.12.0 now
2016-05-26 09:36:37 -07:00
Alex Crichton 763ba535eb Shared the test suite into multiple binaries
Compiling everything in one binary was getting annoying as it just took forever
to build, instead shard it all up so we can build just particular test suites at
a time.
2016-05-25 21:25:13 -07:00
Demur Rumed 6083780ad8 Remove dependency on time in favor of std::time 2016-05-14 14:10:07 +00:00
Stephen Becker IV 7b03532b4f Network retry issue 1602
Dearest Reviewer,

This branch resolves #1602 which relates to retrying network
issues automatically. There is a new utility helper for retrying
any network call.

There is a new config called net.retry value in the .cargo.config
file. The default value is 2. The documentation has also been
updated to reflect the new value.

Thanks
Becker
2016-05-12 11:26:58 -07:00
Simon Sapin 32562e9288 Update to rust-url 1.x 2016-05-03 19:41:06 +02:00
Jorge Aparicio 1a6bad8e5b cargo-install: prefer building artifacts in the system temporary directory
and each cargo-install instance creates and uses its own build directory. This
allows running several cargo-install instances in parallel.

If we fail to create a temporary directory for whatever reason fallback to
creating and using a target-install directory in the current directory.

closes #2606
2016-04-22 17:49:12 -05:00
bors 59238e852c Auto merge of #2575 - alexcrichton:bump, r=alexcrichton
Bump to 0.11.0
2016-04-14 10:36:06 -07:00
Alex Crichton 1f889f7447 Bump to 0.11.0 2016-04-14 10:10:02 -07:00
Alex Crichton 5d87c4fef2 Bump the crates-io crate to 0.2 2016-04-14 10:04:34 -07:00
Alex Crichton 8eac1d62d8 Fix running Cargo concurrently
Cargo has historically had no protections against running it concurrently. This
is pretty unfortunate, however, as it essentially just means that you can only
run one instance of Cargo at a time **globally on a system**.

An "easy solution" to this would be the use of file locks, except they need to
be applied judiciously. It'd be a pretty bad experience to just lock the entire
system globally for Cargo (although it would work), but otherwise Cargo must be
principled how it accesses the filesystem to ensure that locks are properly
held. This commit intends to solve all of these problems.

A new utility module is added to cargo, `util::flock`, which contains two types:

* `FileLock` - a locked version of a `File`. This RAII guard will unlock the
  lock on `Drop` and I/O can be performed through this object. The actual
  underlying `Path` can be read from this object as well.
* `Filesystem` - an unlocked representation of a `Path`. There is no "safe"
  method to access the underlying path without locking a file on the filesystem
  first.

Built on the [fs2] library, these locks use the `flock` system call on Unix and
`LockFileEx` on Windows. Although file locking on Unix is [documented as not so
great][unix-bad], but largely only because of NFS, these are just advisory, and
there's no byte-range locking. These issues don't necessarily plague Cargo,
however, so we should try to leverage them. On both Windows and Unix the file
locks are released when the underlying OS handle is closed, which means that
if the process dies the locks are released.

Cargo has a number of global resources which it now needs to lock, and the
strategy is done in a fairly straightforward way:

* Each registry's index contains one lock (a dotfile in the index). Updating the
  index requires a read/write lock while reading the index requires a shared
  lock. This should allow each process to ensure a registry update happens while
  not blocking out others for an unnecessarily long time. Additionally any
  number of processes can read the index.
* When downloading crates, each downloaded crate is individually locked. A lock
  for the downloaded crate implies a lock on the output directory as well.
  Because downloaded crates are immutable, once the downloaded directory exists
  the lock is no longer needed as it won't be modified, so it can be released.
  This granularity of locking allows multiple Cargo instances to download
  dependencies in parallel.
* Git repositories have separate locks for the database and for the project
  checkout. The datbase and checkout are locked for read/write access when an
  update is performed, and the lock of the checkout is held for the entire
  lifetime of the git source. This is done to ensure that any other Cargo
  processes must wait while we use the git repository. Unfortunately there's
  just not that much parallelism here.
* Binaries managed by `cargo install` are locked by the local metadata file that
  Cargo manages. This is relatively straightforward.
* The actual artifact output directory is just globally locked for the entire
  build. It's hypothesized that running Cargo concurrently in *one directory* is
  less of a feature needed rather than running multiple instances of Cargo
  globally (for now at least). It would be possible to have finer grained
  locking here, but that can likely be deferred to a future PR.

So with all of this infrastructure in place, Cargo is now ready to grab some
locks and ensure that you can call it concurrently anywhere at any time and
everything always works out as one might expect.

One interesting question, however, is what does Cargo do on contention? On one
hand Cargo could immediately abort, but this would lead to a pretty poor UI as
any Cargo process on the system could kick out any other. Instead this PR takes
a more nuanced approach.

* First, all locks are attempted to be acquired (a "try lock"). If this
  succeeds, we're done.
* Next, Cargo prints a message to the console that it's going to block waiting
  for a lock. This is done because it's indeterminate how long Cargo will wait
  for the lock to become available, and most long-lasting operations in Cargo
  have a message printed for them.
* Finally, a blocking acquisition of the lock is issued and we wait for it to
  become available.

So all in all this should help Cargo fix any future concurrency bugs with file
locking in a principled fashion while also allowing concurrent Cargo processes
to proceed reasonably across the system.

[fs2]: https://github.com/danburkert/fs2-rs
[unix-bad]: http://0pointer.de/blog/projects/locking.html

Closes #354
2016-03-16 22:14:26 -07:00
Alex Crichton d41e83eebd Update documentation link for API docs
The API docs for Cargo live at doc.crates.io/cargo, not doc.crates.io in
general.
2016-03-03 13:09:52 -08:00
Alex Crichton ac20c99020 Bump to 0.10.0 2016-03-03 11:12:10 -08:00
Alex Crichton 333ba43fe2 Update dependency on git2
This crate was recently updated to the next release of libgit2, and I've noticed
historically that a noop `cargo build` was slow in the git2-rs repository.
Curious to see if the new libgit2 version helped speed things up at all, I
tested it out.

Before this commit, a noop `cargo build` produced 599108 syscalls. After this
commit, a noop build produced 86925 syscalls, an 85% reduction in the number of
syscalls! Needless to say it's much faster.
2016-02-26 13:47:56 -08:00
bors 7330169feb Auto merge of #2348 - steveklabnik:gh2337, r=alexcrichton
Fixes #2337
2016-02-01 22:04:19 +00:00
Steven Allen cfcfa08a0a Detect whether or not the terminal supports color.
Before v0.4, term used to return `Ok(true)` if something succeeded,
`Ok(false)` if the operation was unsupported, and `Err(io::Error)` if
there was an IO error. Now, it returns `Ok(())` if the operation
succeeds and `Err(term::Error)` if the operation fails. If the operation
is unsupported, it returns `Err(term::Error::NotSupported)`. This means
that, if `op` is unsupported, `try!(term.op())` will now return an error
instead of silently failing (well, return false but that's effectively
silent).

Fixes #2338
2016-02-01 16:06:01 -05:00
Steve Klabnik a2fa2d27e2 Bump semver version
Fixes #2337
2016-02-01 15:12:17 -05:00
Steven Allen fd463d65f9 Revert "Downgrade term crate back down to 0.2 (from 0.4)."
This reverts commit 75e0371ba0.
2016-01-30 15:30:53 -05:00
Felix S. Klock II 75e0371ba0 Downgrade term crate back down to 0.2 (from 0.4).
This is undoing part of commit dd34296

Fix #2338

(Unfortunately I do not have a suggestion for how to make a unit test
for this problem; doing so would require putting in a bit more effort
than I have time for at the moment.)
2016-01-30 14:57:15 +01:00
bors 44c0d7b785 Auto merge of #2297 - alexcrichton:update, r=alexcrichton
Just a routine for niche bug fixes, linkage errors, perf improvements, etc.

Closes #2295
2016-01-25 17:34:19 +00:00
Alex Crichton dd34296008 Update dependencies and Rust version
Just a routine for niche bug fixes, linkage errors, perf improvements, etc.
2016-01-25 09:33:51 -08:00
Alex Crichton 43cc710b6c Bump to 0.9.0 2016-01-21 13:47:11 -08:00
Steven Fackler a40f7d90fb Bump libc to 0.2
Also update everything else which removes all remaining libc 0.1
dependencies
2015-12-20 15:58:55 -07:00
Alex Crichton 75ce18d676 Bump to 0.8.0 2015-12-10 07:26:17 -08:00
Steve Klabnik 94cc5e1eab Update semver to 0.2.0 2015-12-04 11:14:39 -05:00
Alex Crichton ab05dbb66b Bump to 0.7.0 2015-10-30 11:25:30 -07:00
Alex Crichton 8778797dc7 Update some build tools and libgit2
* Updates git2-rs back to 0.3 now that the distribution issue on OSX has been
  fixed.
* Updates libgit2-sys to using the `cmake` crate so building with VS 2015 can
  work.
* Update pkg-config to totally disable it on MSVC (basically guaranteed to never
  work)
2015-10-07 11:33:39 -07:00
Alex Crichton 659f824406 Refactor Cargo's backend, again!
This commit started out identifying a relatively simple bug in Cargo. A recent
change made it such that the resolution graph included all target-specific
dependencies, relying on the structure of the backend to filter out those which
don't need to get built. This was unfortunately not accounted for in the portion
of the backend that schedules work, mistakenly causing spurious rebuilds if
different runs of the graph pulled in new crates. For example if `cargo build`
didn't build any target-specific dependencies but then later `cargo test` did
(e.g. a dev-dep pulled in a target-specific dep unconditionally) then it would
cause a rebuild of the entire graph.

This class of bug is certainly not the first in a long and storied history of
the backend having multiple points where dependencies are calculated and those
often don't quite agree with one another. The purpose of this rewrite is
twofold:

1. The `Stage` enum in the backend for scheduling work and ensuring that maximum
   parallelism is achieved is removed entirely. There is already a function on
   `Context` which expresses the dependency between targets (`dep_targets`)
   which takes a much finer grain of dependencies into account as well as
   already having all the logic for what-depends-on-what. This duplication has
   caused numerous problems in the past, an unifying these two will truly grant
   maximum parallelism while ensuring that everyone agrees on what their
   dependencies are.

2. A large number of locations in the backend have grown to take a (Package,
   Target, Profile, Kind) tuple, or some subset of this tuple. In general this
   represents a "unit of work" and is much easier to pass around as one
   variable, so a `Unit` was introduced which references all of these variables.
   Almost the entire backend was altered to take a `Unit` instead of these
   variables specifically, typically providing all of the contextual information
   necessary for an operation.

A crucial part of this change is the inclusion of `Kind` in a `Unit` to ensure
that everyone *also* agrees on what architecture they're compiling everything
for. There have been many bugs in the past where one part of the backend
determined that a package was built for one architecture and then another part
thought it was built for another. With the inclusion of `Kind` in dependency
management this is handled in a much cleaner fashion as it's only calculated in
one location.

Some other miscellaneous changes made were:

* The `Platform` enumeration has finally been removed. This has been entirely
  subsumed by `Kind`.
* The hokey logic for "build this crate once" even though it may be depended on
  by both the host/target kinds has been removed. This is now handled in a much
  nicer fashion where if there's no target then Kind::Target is just never used,
  and multiple requests for a package are just naturally deduplicated.
* There's no longer any need to build up the "requirements" for a package in
  terms of what platforms it's compiled for, this now just naturally falls out
  of the dependency graph.
* If a build script is overridden then its entire tree of dependencies are not
  compiled, not just the build script itself.
* The `threadpool` dependency has been replaced with one on `crossbeam`. The
  method of calculating dependencies has quite a few non-static lifetimes and
  the scoped threads of `crossbeam` are now used instead of a thread pool.
* Once any thread fails to execute a command work is no longer scheduled unlike
  before where some extra pending work may continue to start.
* Many functions used early on, such as `compile` and `build_map` have been
  massively simplified by farming out dependency management to
  `Context::dep_targets`.
* There is now a new profile to represent running a build script. This is used
  to inject dependencies as well as represent that a library depends on running
  a build script, not just building it.

This change has currently been tested against cross-compiling Servo to Android
and passes the test suite (which has quite a few corner cases for build scripts
and such), so I'm pretty confident that this refactoring won't have at least too
many regressions!
2015-10-05 11:32:58 -07:00
Alex Crichton 604e867845 Bump to 0.6.0 2015-09-16 09:35:43 -07:00
Alex Crichton 6bf164203b Revert update of libgit2
Unfortunately this flew past on the bots because we didn't built on one of the
10.7 bots, but it looks like libgit2 doesn't currently build on OSX 10.7 so
we'll have to wait until that's fixed to update.
2015-08-17 10:08:13 -07:00
Alex Crichton 530e1d180d Update dependencies and Rust that's used
* Picks up a few breaking changes to dependency APIs, notably the tar-rs changes
  and git2-rs changes.
* Builds should now work with VS 2015
2015-08-14 13:30:53 -07:00
Alex Crichton 4c851ceac5 Bump to 0.5.0 2015-08-11 13:31:21 -07:00
Alex Crichton a4c5438431 Tweak metadata to publish Cargo on crates.io
This commit tweaks some metadata here and there to publish Cargo on crates.io.

* License fields are added to Cargo.tomls
* `registry` was renamed to `crates-io`
* API docs for the `cargo` crate are now generated via `make doc`
2015-07-24 15:07:01 -07:00
Alex Crichton a24ca998ba Remove MSVC logic from the configure script
Cargo will soon support testing the cross compilation capabilities between 32/64
bit Windows, meaning that there's not "one true value" for any of these
environment variables that Cargo is setting (e.g. where to find `cl`, `link`,
etc). Instead, all dependencies have been updated to probe the system (in the
same manner as the compiler) for the tools that they're using.

All of the logic is housed in the `gcc` crate which now exposes a function to
probe the system for a particular tool. The updated crates here then use the
result of this probe to run the various build scripts. This all boils down to
being able to build MSVC targets inside an MSYS shell instead of requiring use
of a MSVC shell (which doesn't allow for simultaneous host builds and cross
builds).
2015-07-22 22:53:09 -07:00
Alex Crichton 9912590acd Bump version to 0.4.0 2015-06-26 08:27:02 -07:00
Alex Crichton 0da6c943c8 Fix build on MSVC
* Download all snapshots and such from static.rust-lang.org (drive-by fix)
* Update dependencies to work and build on MSVC
  * ssh2-sys uses `nmake` to build libssh2
  * libgit2-sys uses `cmake` to build libgit2
  * curl-sys uses `nmake` to build libcurl
  * libz-sys uses `nmake` to build zlib
  * miniz-sys uses `gcc-rs` to drive `cl.exe` manually
  * term updated to pick up windows-specific deps on MSVC
* Updated .travis.install.deps.sh to install MSVC target libraries on Windows,
  so the compiler can be used to target MSVC. A 64-bit target is now used by
  default as well.
* Updated the configure script and Makefile to set appropriate environment
  variables to build Cargo from a MSYS shell with a MSVC target. This is similar
  to how Rust bootstraps on MSVC as well.

With this commit Cargo can successfully bootstrap itself on MSVC (use the MSVC
product to build itself again). The tests currently do not pass because
unwinding is not implemented, but soon!
2015-06-23 18:01:32 -07:00
Alex Crichton 23762e4586 Move Cargo onto stable Rust
This commit moves Cargo onto 100% stable Rust now that the necessary fs features
have been stabilized. The tests were updated to understand when they're running
with a non-nightly compiler and disable all plugin-related tests. The only major
feature here is that the calls to `fs::set_file_times` were reimplemented
manually in the tests that Cargo has.

Cargo still requires a *nightly compiler* due to the stable features not having
made their way into the stable channel yet, but it will soon work on all of the
stable, beta, and nightly compilers once 1.1 is released!
2015-06-16 22:31:34 -07:00
bors 3b164462d6 Auto merge of #1657 - alexcrichton:share-target-dirs, r=brson
This commit adds support to allow specifying a custom output directory to Cargo.
First, the `build.target-dir` configuration key is checked, and failing that the
`CARGO_TARGET_DIR` environment variable is checked, and failing that the root
package's directory joined with the directory name "target" is used.

There are a few caveats to switching target directories, however:

* If the target directory is in the current source tree, and the folder name is
  not called "target", then Cargo may walk the output directory when determining
  whether a tree is fresh.
* If the target directory is not called "target", then Cargo may look inside it
  currently for `Cargo.toml` files to learn about local packages.
* Concurrent usage of Cargo will still result in badness (#354), and this is now
  exascerbated because many Cargo projects can share the same output directory.
* The top-level crate is not cached for future compilations, so if a crate is
  built into directory `foo` and then that crate is later used as a dependency,
  it will be recompiled.

The naming limitations can be overcome in time, but for now it greatly
simplifies the crawling routines and shouldn't have much of a negative impact
other than some Cargo runtimes (which can in turn be negated by following the
"target" name convention).

Closes #482
2015-06-04 17:30:58 +00:00
Alex Crichton 7d49029a1c Switch from a custom MTime to the filetime crate
The crate provides the same functionality necessary for Cargo, but it's
maintained elsewhere now.
2015-06-02 18:05:47 -07:00
Ivan Ukhov 632780ebef Fix the detection of directories when listing files using libgit2 2015-06-02 10:55:04 -04:00
Alex Crichton 655c40be25 Bump Cargo.toml's version to 0.3.0 2015-05-28 15:39:03 -07:00
Alex Crichton 54d1ac3966 Update cargo deps
Opt in to nightly features for a few, and update others to get bitrig support
2015-05-18 14:47:33 -07:00
Alex Crichton d46aec562d Update Cargo to rust master
There was a lifetime parameter regression in git2-rs which prevented Cargo from
building on nightly
2015-05-12 21:22:14 -07:00
Jakub Bukaj e4ae24b124 Loosen the dependency versions in Cargo.toml 2015-05-01 13:25:09 +02:00
ozmorph a72ddb73df updated threadpool dependency from v0.1.1 to v0.1.4 2015-04-18 18:12:45 -04:00
Alex Crichton 30bc5a6517 Bump cargo to 0.2.0
Closes #808
Closes #1178
2015-04-16 15:59:14 -07:00
Alex Crichton 80fe0e6df6 Update to rust-2015-04-02
Along the way, this also removes the ability to specify `[[lib]]` targets while
getting warnings. While we're at it remove nearly all unstable features that
Cargo is depending on as well!
2015-04-02 16:28:53 -07:00
Alex Crichton e8944ac6b0 Update to rust 2015-03-30 2015-03-30 12:30:50 -07:00
Alex Crichton 964e72ffc0 Update to rust 2015-03-26 2015-03-26 11:59:30 -07:00
Alex Crichton 50c6eb4d46 Update to rust master 2015-03-17 09:26:13 -07:00
Alex Crichton 22e7ede6c8 Fix all tests from the update to rust master 2015-03-09 13:51:11 -07:00
Victor-Nicolae Savu 2fac34aa90 Updated versions for rustc, curl, docopt and regex. 2015-03-06 22:52:55 +01:00
Victor-Nicolae Savu a1faa7cb14 Updated to rust nightly 2015-03-04 2015-03-05 07:20:58 +01:00
Alex Crichton a6dad62221 Update to rust master and std::{io, path} 2015-02-27 15:34:13 -08:00
Alex Crichton b20b0f6bd8 Add git2-curl as a dependency
Due to libgit2 not supporting HTTP proxies, the custom transport API of the
library must be used to reimplement the HTTP transport with proxy support. The
git2-curl crate implements this transport on top of the curl-rust crate. By
using libcurl we gain all sorts of proxy support for free.

This transport is not used by default, however, as it is not well battle tested
and the architecture is not currently ideal (download the entire repo into
memory on a clone). Only when an HTTP proxy is present is the new transport
used.

The other drawback of git2-curl is that it does not currently support
authentication. If a private git repository is cloned or authentication is
required then it will generate an error instead of correctly asking for
credentials.

Closes #636
2015-02-09 21:26:13 -08:00