]> git.proxmox.com Git - cargo.git/log
cargo.git
9 years agoAdd 'did you mean...' message when a subcommand is not found.
Paul Woolcock [Thu, 6 Nov 2014 02:05:01 +0000 (21:05 -0500)]
Add 'did you mean...' message when a subcommand is not found.

9 years agoauto merge of #799 : alexcrichton/cargo/moar-parallel, r=brson
bors [Thu, 6 Nov 2014 00:02:30 +0000 (00:02 +0000)]
auto merge of #799 : alexcrichton/cargo/moar-parallel, r=brson

When building unit tests for a library, we don't need the library itself to be
built beforehand, so the two can be built in parallel. If the crate takes awhile
to compile, this shows some excellent wall-time speedups.

9 years agoauto merge of #804 : alexcrichton/cargo/moar-fixes, r=alexcrichton
bors [Wed, 5 Nov 2014 23:43:18 +0000 (23:43 +0000)]
auto merge of #804 : alexcrichton/cargo/moar-fixes, r=alexcrichton

Some flaky test improvements as well as some updates to the styling of the docs.

9 years agoFix up some styling on the build-script docs
Alex Crichton [Wed, 5 Nov 2014 23:14:30 +0000 (15:14 -0800)]
Fix up some styling on the build-script docs

9 years agoFix some more flaky tests
Alex Crichton [Wed, 5 Nov 2014 23:06:06 +0000 (15:06 -0800)]
Fix some more flaky tests

At the same time, also improve the deprecation message for the old build command
to be a little more descriptive about how to migrate

9 years agoauto merge of #802 : alexcrichton/cargo/issue-801, r=brson
bors [Wed, 5 Nov 2014 23:02:41 +0000 (23:02 +0000)]
auto merge of #802 : alexcrichton/cargo/issue-801, r=brson

Previously all features were traversed when adding information to the lockfile,
but the traversal forgot to add optional dependencies that did not have a
corresponding feature.

Closes #801

9 years agoauto merge of #803 : alexcrichton/cargo/fix-some-tests, r=alexcrichton
bors [Wed, 5 Nov 2014 22:35:35 +0000 (22:35 +0000)]
auto merge of #803 : alexcrichton/cargo/fix-some-tests, r=alexcrichton

Right now we're accidentally not actually leveraging this function well in some
tests due to this sequence of events:

1. The tests run at time X, building artifacts that remember the fingerprint is
   at time X.
2. The entire project is moved back one hour to (X-1).
3. A new file is created, at time X (second-level resolution on some systems).
4. On a rebuild, the maximum mtime is still X (due to the new file).

For this reason there are some more calls to move_into_the_past() to push files
back another hour after they've been created to make sure the maximum mtime is
(X-1), or something different than X.

9 years agoMore aggresively move_into_the_past for tests
Alex Crichton [Wed, 5 Nov 2014 22:00:38 +0000 (14:00 -0800)]
More aggresively move_into_the_past for tests

Right now we're accidentally not actually leveraging this function well in some
tests due to this sequence of events:

1. The tests run at time X, building artifacts that remember the fingerprint is
   at time X.
2. The entire project is moved back one hour to (X-1).
3. A new file is created, at time X (second-level resolution on some systems).
4. On a rebuild, the maximum mtime is still X (due to the new file).

For this reason there are some more calls to move_into_the_past() to push files
back another hour after they've been created to make sure the maximum mtime is
(X-1), or something different than X.

9 years agoBuild lib tests and libraries in parallel
Alex Crichton [Wed, 5 Nov 2014 03:40:06 +0000 (19:40 -0800)]
Build lib tests and libraries in parallel

When building unit tests for a library, we don't need the library itself to be
built beforehand, so the two can be built in parallel. If the crate takes awhile
to compile, this shows some excellent wall-time speedups.

9 years agoauto merge of #792 : alexcrichton/cargo/build-cmd, r=brson
bors [Wed, 5 Nov 2014 21:13:08 +0000 (21:13 +0000)]
auto merge of #792 : alexcrichton/cargo/build-cmd, r=brson

This series of commits (based on https://github.com/rust-lang/cargo/pull/763) is an implementation of the recent [Cargo RFC](https://github.com/rust-lang/rfcs/blob/master/text/0403-cargo-build-command.md). This should implement all portions of the RFC, but there's a lot so an extra set of eyes would be nice!

I haven't added documentation for it all yet, but I would like to do so before landing (starting with https://github.com/rust-lang/cargo/pull/749). Otherwise I've been migrating all of the existing cargo dependencies away from the build command to a build script, and the progress can be seen with these repositories:

* https://github.com/alexcrichton/gcc-rs
* https://github.com/alexcrichton/pkg-config-rs
* https://github.com/alexcrichton/git2-rs/tree/build-cmd
* https://github.com/alexcrichton/openssl-sys
* https://github.com/alexcrichton/flate2-rs/tree/build-cmd
* https://github.com/alexcrichton/libz-sys
* https://github.com/alexcrichton/ssh2-rs/tree/build-cmd

I haven't quite gotten around to curl just yet, but it's next on my list!

9 years agoFix custom build tests on windows
Alex Crichton [Wed, 5 Nov 2014 20:28:00 +0000 (12:28 -0800)]
Fix custom build tests on windows

9 years agoBe sure to lock purely optional dependencies
Alex Crichton [Wed, 5 Nov 2014 19:13:04 +0000 (11:13 -0800)]
Be sure to lock purely optional dependencies

Previously all features were traversed when adding information to the lockfile,
but the traversal forgot to add optional dependencies that did not have a
corresponding feature.

Closes #801

9 years agoExpand the "link to system libraries" section
Alex Crichton [Tue, 4 Nov 2014 21:20:31 +0000 (13:20 -0800)]
Expand the "link to system libraries" section

9 years agoFollow through on the OUT_DIR promise for rustc compiles
Alex Crichton [Tue, 4 Nov 2014 07:20:19 +0000 (23:20 -0800)]
Follow through on the OUT_DIR promise for rustc compiles

9 years agoFix some flaky tests
Alex Crichton [Tue, 4 Nov 2014 07:20:13 +0000 (23:20 -0800)]
Fix some flaky tests

9 years agoDox fixups
Alex Crichton [Tue, 4 Nov 2014 06:45:11 +0000 (22:45 -0800)]
Dox fixups

9 years agoFix the build command passing -L/-l without links
Alex Crichton [Tue, 4 Nov 2014 00:23:42 +0000 (16:23 -0800)]
Fix the build command passing -L/-l without links

9 years agoBeef up documentation about build scripts
Alex Crichton [Mon, 3 Nov 2014 20:08:01 +0000 (12:08 -0800)]
Beef up documentation about build scripts

9 years agoUpdate documentation for new build command system
Pierre Krieger [Thu, 23 Oct 2014 10:48:01 +0000 (12:48 +0200)]
Update documentation for new build command system

9 years agoReally fix `cargo test` and fix an OUT_DIR bug
Alex Crichton [Sat, 1 Nov 2014 18:51:58 +0000 (11:51 -0700)]
Really fix `cargo test` and fix an OUT_DIR bug

Assorted bug fixes discovered while migrating packages to using this build
command infrastructure.

9 years agoAdd a test for build commands with build commands
Alex Crichton [Sat, 1 Nov 2014 02:16:39 +0000 (19:16 -0700)]
Add a test for build commands with build commands

9 years agoImplement build-dependencies
Alex Crichton [Sat, 1 Nov 2014 01:39:39 +0000 (18:39 -0700)]
Implement build-dependencies

This adds a flavor of Dependency for build dependencies. Build dependencies are
only ever used when building build commands themselves.

9 years agoAdd tests for other cargo cmds + -L propagation
Alex Crichton [Sat, 1 Nov 2014 00:36:48 +0000 (17:36 -0700)]
Add tests for other cargo cmds + -L propagation

9 years agoEnsure fresh build commands populate build info
Alex Crichton [Fri, 31 Oct 2014 23:20:13 +0000 (16:20 -0700)]
Ensure fresh build commands populate build info

Whenever a build command is fresh, we need to be sure to propagate its build
information upwards from the cache stored on disk.

9 years agoRefine the dependency graph for build scripts
Alex Crichton [Fri, 31 Oct 2014 22:51:13 +0000 (15:51 -0700)]
Refine the dependency graph for build scripts

Build scripts can immediately start building as soon as all build dependencies
are available and not need to wait for normal dependencies. This commit also
includes a number of refactorings and reorganizations to tidy up how build
scripts are processed.

One primary piece of state introduced in this commit is a shared Arc<Mutex<T>>
which contains information about the processed build scripts as compilation
continues. Compilation commands will draw information from this state and build
scripts will feed information back into this state to ensure it's up to date.

9 years agoImplement overrides via local cargo configuration
Alex Crichton [Fri, 31 Oct 2014 19:25:40 +0000 (12:25 -0700)]
Implement overrides via local cargo configuration

This is an implementation of overriding native dependencies and passing
aribtrary metadata and such.

9 years agoFix lines_match test for matching process output
Alex Crichton [Fri, 31 Oct 2014 18:17:29 +0000 (11:17 -0700)]
Fix lines_match test for matching process output

9 years agoImplement the `links` manifest key
Alex Crichton [Fri, 31 Oct 2014 17:49:04 +0000 (10:49 -0700)]
Implement the `links` manifest key

This commit adds the `links` manifest key as a string of a C library which is
being linked to. This is passed as an argument to the build command when not
overridden. The implementation of overrides will come soon!

9 years agoTweak tests that check whether the build script is being run
Pierre Krieger [Wed, 29 Oct 2014 10:23:52 +0000 (11:23 +0100)]
Tweak tests that check whether the build script is being run

9 years agoMove custom-build-related code in its own module
Pierre Krieger [Tue, 28 Oct 2014 13:22:02 +0000 (14:22 +0100)]
Move custom-build-related code in its own module

9 years agoAddress minor issues
Pierre Krieger [Tue, 28 Oct 2014 09:00:25 +0000 (10:00 +0100)]
Address minor issues

9 years agoDeprecated a few more things
Pierre Krieger [Mon, 27 Oct 2014 16:26:49 +0000 (17:26 +0100)]
Deprecated a few more things

9 years agoAdd draft for passing metadata to dependencies
Pierre Krieger [Mon, 27 Oct 2014 16:22:14 +0000 (17:22 +0100)]
Add draft for passing metadata to dependencies

9 years agoJobs now send back their own description when they start
Pierre Krieger [Mon, 27 Oct 2014 16:09:21 +0000 (17:09 +0100)]
Jobs now send back their own description when they start

9 years agoFlags from custom build script are now used
Pierre Krieger [Mon, 27 Oct 2014 15:29:03 +0000 (16:29 +0100)]
Flags from custom build script are now used

9 years agoBuild command output now being checked and written to filesystem
Pierre Krieger [Mon, 27 Oct 2014 14:13:37 +0000 (15:13 +0100)]
Build command output now being checked and written to filesystem

9 years agoCustom build commands are now being run
Pierre Krieger [Wed, 22 Oct 2014 21:32:57 +0000 (23:32 +0200)]
Custom build commands are now being run

9 years agoDeprecate old build system and add rust build script as target
Pierre Krieger [Wed, 22 Oct 2014 18:32:40 +0000 (20:32 +0200)]
Deprecate old build system and add rust build script as target

9 years agoExtract custom build tests and prefix with "old_"
Pierre Krieger [Wed, 22 Oct 2014 12:35:23 +0000 (14:35 +0200)]
Extract custom build tests and prefix with "old_"

9 years agoauto merge of #776 : alexcrichton/cargo/issue-488, r=alexcrichton
bors [Wed, 5 Nov 2014 18:08:33 +0000 (18:08 +0000)]
auto merge of #776 : alexcrichton/cargo/issue-488, r=alexcrichton

This helps us not unwrap() and rather propagate the error upwards.

Closes #488

9 years agoUpdate to rust master
Alex Crichton [Mon, 3 Nov 2014 01:54:06 +0000 (17:54 -0800)]
Update to rust master

9 years agoAdd a custom join_paths function to wrap the error
Alex Crichton [Thu, 30 Oct 2014 00:56:07 +0000 (17:56 -0700)]
Add a custom join_paths function to wrap the error

This helps us not unwrap() and rather propagate the error upwards.

Closes #488

9 years agoauto merge of #791 : alexcrichton/cargo/update, r=alexcrichton
bors [Sat, 1 Nov 2014 19:29:48 +0000 (19:29 +0000)]
auto merge of #791 : alexcrichton/cargo/update, r=alexcrichton

9 years agoUpdate the curl-rust dependency
Alex Crichton [Sat, 1 Nov 2014 19:08:06 +0000 (12:08 -0700)]
Update the curl-rust dependency

9 years agoupdated to work with DSTify Hash commit in rust
Jason Ozias [Sat, 1 Nov 2014 03:50:29 +0000 (23:50 -0400)]
updated to work with DSTify Hash commit in rust

9 years agoauto merge of #775 : alexcrichton/cargo/issue-771, r=brson
bors [Fri, 31 Oct 2014 22:14:45 +0000 (22:14 +0000)]
auto merge of #775 : alexcrichton/cargo/issue-771, r=brson

The examples output directory was accidentally taken into account twice, and
this removes one source of the output directory confusion.

Closes #771

9 years agoauto merge of #774 : alexcrichton/cargo/issue-740, r=brson
bors [Fri, 31 Oct 2014 21:29:46 +0000 (21:29 +0000)]
auto merge of #774 : alexcrichton/cargo/issue-740, r=brson

Closes #740

9 years agoauto merge of #773 : alexcrichton/cargo/update-all-packages-from-a-git-repo, r=brson
bors [Fri, 31 Oct 2014 20:44:47 +0000 (20:44 +0000)]
auto merge of #773 : alexcrichton/cargo/update-all-packages-from-a-git-repo, r=brson

With the recent resolve rewrite, `cargo update -p foo` would only update one
package in a git repository, even if the repository provided many packages.
Cargo does not currently support depending on the same git repository source
with different precise revisions, and this would cause errors down the line
depending on what happened.

This adds a fix to the `resolve_with_previous` method to ensure that any
non-registry sources being updated will not have any locked packages inside them
which would result in an invalid lockfile.

9 years agoauto merge of #783 : steveklabnik/cargo/require_curl, r=alexcrichton
bors [Fri, 31 Oct 2014 17:11:25 +0000 (17:11 +0000)]
auto merge of #783 : steveklabnik/cargo/require_curl, r=alexcrichton

9 years agoauto merge of #786 : alexcrichton/cargo/update, r=alexcrichton
bors [Fri, 31 Oct 2014 16:55:50 +0000 (16:55 +0000)]
auto merge of #786 : alexcrichton/cargo/update, r=alexcrichton

9 years agoUpdate to rust master
Alex Crichton [Fri, 31 Oct 2014 16:37:44 +0000 (09:37 -0700)]
Update to rust master

9 years agoFix requirements in README
Steve Klabnik [Fri, 31 Oct 2014 03:34:11 +0000 (23:34 -0400)]
Fix requirements in README

9 years agoauto merge of #780 : EduardoBautista/cargo/add-example-output-path-to-docs, r=alexcri...
bors [Fri, 31 Oct 2014 00:14:50 +0000 (00:14 +0000)]
auto merge of #780 : EduardoBautista/cargo/add-example-output-path-to-docs, r=alexcrichton

Solves #764.

9 years agoauto merge of #735 : tomaka/cargo/platform-specific-deps, r=alexcrichton
bors [Thu, 30 Oct 2014 23:29:53 +0000 (23:29 +0000)]
auto merge of #735 : tomaka/cargo/platform-specific-deps, r=alexcrichton

cc #610

9 years agoSay where examples are placed after they are compiled
Eduardo Bautista [Thu, 30 Oct 2014 19:10:57 +0000 (13:10 -0600)]
Say where examples are placed after they are compiled

9 years agoauto merge of #779 : alexcrichton/cargo/update-deps, r=alexcrichton
bors [Thu, 30 Oct 2014 15:50:50 +0000 (15:50 +0000)]
auto merge of #779 : alexcrichton/cargo/update-deps, r=alexcrichton

9 years agoUpdate deps with fail => panic
Alex Crichton [Thu, 30 Oct 2014 15:46:07 +0000 (08:46 -0700)]
Update deps with fail => panic

Also fix a few test's assertion messages

9 years agofail -> panic
Steve Klabnik [Thu, 30 Oct 2014 01:59:06 +0000 (21:59 -0400)]
fail -> panic

9 years agoCheck USERNAME for a users's name with `cargo new`
Alex Crichton [Wed, 29 Oct 2014 23:27:16 +0000 (16:27 -0700)]
Check USERNAME for a users's name with `cargo new`

Closes #740

9 years agoFix a repeated `cargo test` with examples
Alex Crichton [Wed, 29 Oct 2014 23:33:52 +0000 (16:33 -0700)]
Fix a repeated `cargo test` with examples

The examples output directory was accidentally taken into account twice, and
this removes one source of the output directory confusion.

9 years agoauto merge of #772 : mattyhall/cargo/master, r=alexcrichton
bors [Wed, 29 Oct 2014 19:32:55 +0000 (19:32 +0000)]
auto merge of #772 : mattyhall/cargo/master, r=alexcrichton

Fixes #762. I'm not sure if I've used the correct style here. Apologies if it is and/or if the way I've fixed this is wrong!

9 years agoauto merge of #702 : tomassedovic/cargo/run-examples, r=alexcrichton
bors [Wed, 29 Oct 2014 19:04:40 +0000 (19:04 +0000)]
auto merge of #702 : tomassedovic/cargo/run-examples, r=alexcrichton

This lets users run any executable from the `examples` or `bin` directories by
passing its name with `--example` or `--bin` flag.

If neither is specified, we fall back to the old behaviour (running the only bin
target in the project, failing if there are more).

Closes #538

9 years agoBe sure to update all packages from a git source
Alex Crichton [Wed, 29 Oct 2014 18:42:45 +0000 (11:42 -0700)]
Be sure to update all packages from a git source

With the recent resolve rewrite, `cargo update -p foo` would only update one
package in a git repository, even if the repository provided many packages.
Cargo does not currently support depending on the same git repository source
with different precise revisions, and this would cause errors down the line
depending on what happened.

This adds a fix to the `resolve_with_previous` method to ensure that any
non-registry sources being updated will not have any locked packages inside them
which would result in an invalid lockfile.

9 years agoauto merge of #768 : alexcrichton/cargo/ssl-fixes, r=brson
bors [Wed, 29 Oct 2014 18:49:43 +0000 (18:49 +0000)]
auto merge of #768 : alexcrichton/cargo/ssl-fixes, r=brson

The second commit message has the details, and these are the relevant external commits:

* https://github.com/alexcrichton/openssl-static-sys/commit/2e1c50a7f35ef52ce38dbd405a175b6dccc0ebad
* https://github.com/alexcrichton/curl-rust/commit/1098e4dd3b89b168b412dfeaba033e41796ea794

9 years agoFix compat with the current rust master
Alex Crichton [Wed, 29 Oct 2014 18:47:44 +0000 (11:47 -0700)]
Fix compat with the current rust master

9 years agoUpdate curl-rust to handle SSL config for linuxes
Alex Crichton [Tue, 28 Oct 2014 15:32:54 +0000 (08:32 -0700)]
Update curl-rust to handle SSL config for linuxes

Right now the cargo built on the snapshot bot isn't able to talk to the registry
due to failing to validate the SSL certificate. This is likely due to the
certificate path being hardcoded to something that's compatible with CentOS
(which isn't what I'm running locally).

I've modified curl-rust to use openssl-static-sys to probe the system for where
certificates are located and inform handles by default about the found
locations. This is the same strategy that git2-rs uses to inform openssl about
where the certificates are located.

9 years agoMake help command accept -h and --help
Matthew Hall [Wed, 29 Oct 2014 12:28:52 +0000 (12:28 +0000)]
Make help command accept -h and --help

9 years agoAdd `--name` to `cargo test` and `cargo bench`
Tomas Sedovic [Tue, 28 Oct 2014 08:31:34 +0000 (09:31 +0100)]
Add `--name` to `cargo test` and `cargo bench`

You can now run a single test/bench file by passing its name to `cargo
test` or `cargo bench`.

9 years agoRegister new snapshots and update the lockfile format
Alex Crichton [Tue, 28 Oct 2014 15:30:30 +0000 (08:30 -0700)]
Register new snapshots and update the lockfile format

9 years agoAdd `--name` and `--example` to cargo run
Tomas Sedovic [Mon, 27 Oct 2014 21:49:20 +0000 (22:49 +0100)]
Add `--name` and `--example` to cargo run

This lets us compile and run examples using `cargo run --example NAME`.
Selecting the other binary targets is now done using the `--name` flag.

`cargo run` falls back to the old behaviour (running the only bin target
in the project, failing if there are more) in neither `--name` nor
`--example` are present.

Closes #538

9 years agoauto merge of #769 : tomaka/cargo/delete-design, r=alexcrichton
bors [Tue, 28 Oct 2014 19:59:49 +0000 (19:59 +0000)]
auto merge of #769 : tomaka/cargo/delete-design, r=alexcrichton

9 years agoRemove .vimrc, MANIFEST.md, and the DESIGN directory
Pierre Krieger [Tue, 28 Oct 2014 18:33:21 +0000 (19:33 +0100)]
Remove .vimrc, MANIFEST.md, and the DESIGN directory

9 years agoFix `sources::registry::parse_registry_dependency`
Pierre Krieger [Tue, 28 Oct 2014 15:47:33 +0000 (16:47 +0100)]
Fix `sources::registry::parse_registry_dependency`

9 years agoFill `ops::registry::transmit` with the right value
Pierre Krieger [Tue, 28 Oct 2014 08:30:57 +0000 (09:30 +0100)]
Fill `ops::registry::transmit` with the right value

9 years agoImplement platform-specific dependencies
Pierre Krieger [Tue, 21 Oct 2014 16:36:55 +0000 (18:36 +0200)]
Implement platform-specific dependencies

9 years agoauto merge of #767 : alexcrichton/cargo/issue-637, r=wycats
bors [Mon, 27 Oct 2014 23:49:37 +0000 (23:49 +0000)]
auto merge of #767 : alexcrichton/cargo/issue-637, r=wycats

Each dependency itself already has the precise source listed, and we're
guaranteed that for each (source, name) pair that there is exactly one
dependency, so there is always a way to rebuild the precise dependency graph
after the fact by looking up the (source, name) pair in the hash map.

This should help with some of the readability concerns in #637 because the git
SHA that a source is locked to is now only mentioned once in a lockfile.

This commit does preserve, however, the mention of the version in each
dependency line which will likely never go away. This means that for
registry-based packages will still run into the same lockfile merge conflict
troubles, there will just be more readable versions than git hashes.

It should also be noted that this will alter all currently generated lockfiles
as any dependencies mentioned will lose the hashes mentioned afterwards. This
will likely cause somewhat of a transitionary pain as this version of cargo
propagates throughout.

9 years agoDon't encode precise in lockfile dep pointers
Alex Crichton [Mon, 27 Oct 2014 18:54:48 +0000 (11:54 -0700)]
Don't encode precise in lockfile dep pointers

Each dependency itself already has the precise source listed, and we're
guaranteed that for each (source, name) pair that there is exactly one
dependency, so there is always a way to rebuild the precise dependency graph
after the fact by looking up the (source, name) pair in the hash map.

This should help with some of the readability concerns in #637 because the git
SHA that a source is locked to is now only mentioned once in a lockfile.

This commit does preserve, however, the mention of the version in each
dependency line which will likely never go away. This means that for
registry-based packages will still run into the same lockfile merge conflict
troubles, there will just be more readable versions than git hashes.

It should also be noted that this will alter all currently generated lockfiles
as any dependencies mentioned will lose the hashes mentioned afterwards. This
will likely cause somewhat of a transitionary pain as this version of cargo
propagates throughout.

9 years agoauto merge of #765 : steveklabnik/cargo/fix_warnings, r=alexcrichton
bors [Mon, 27 Oct 2014 23:30:13 +0000 (23:30 +0000)]
auto merge of #765 : steveklabnik/cargo/fix_warnings, r=alexcrichton

9 years agoauto merge of #758 : alexcrichton/cargo/issue-751, r=brson
bors [Mon, 27 Oct 2014 22:43:26 +0000 (22:43 +0000)]
auto merge of #758 : alexcrichton/cargo/issue-751, r=brson

This ends up killing two birds with one stone! The rationale behind this is that
the example and bin namespaces are not the same, and we don't mix metadata into
either filename, so the outputs need to be in different locations.

Closes #193
Closes #751

9 years agoauto merge of #757 : alexcrichton/cargo/issue-743, r=brson
bors [Mon, 27 Oct 2014 22:33:38 +0000 (22:33 +0000)]
auto merge of #757 : alexcrichton/cargo/issue-743, r=brson

Closes #743

9 years agoauto merge of #734 : alexcrichton/cargo/issue-728, r=brson
bors [Mon, 27 Oct 2014 20:53:41 +0000 (20:53 +0000)]
auto merge of #734 : alexcrichton/cargo/issue-728, r=brson

Previously only the local package was erroneously compiled with optimizations.

Closes #728

9 years agoauto merge of #725 : alexcrichton/cargo/registry-fixes, r=brson
bors [Mon, 27 Oct 2014 20:41:25 +0000 (20:41 +0000)]
auto merge of #725 : alexcrichton/cargo/registry-fixes, r=brson

This PR contains a laundry list of improvements when using the registry as a source, and should be one of the last steps necessary for whipping cargo into shape to using the registry. Some of the highlights include:

* All APIs have been updated to the registry's current interface
* Lockfiles are now respected with registry sources
  * Conservatively updating dependencies should work
  * The network shouldn't be touched unless absolutely necessary
  * Lockfiles actually keep versions locked when using a newer registry with more versions
* A new standalone lib was added for interoperating with the registry (HTTP-request-wise)
* Packages are now verified before being published to the registry (this can be opted out of)
* `cargo upload` was renamed to `cargo publish`

The commit series is intended to be individually reviewable and each commit should compile and pass all tests independently (but still needs to be applied in order).

9 years agoauto merge of #766 : alexcrichton/cargo/fix-test-state, r=alexcrichton
bors [Mon, 27 Oct 2014 20:02:05 +0000 (20:02 +0000)]
auto merge of #766 : alexcrichton/cargo/fix-test-state, r=alexcrichton

Ensure that a system `rm -rf target` will continue to work across test runs.

9 years agoPropagate configuration parser errors
Alex Crichton [Fri, 24 Oct 2014 15:48:00 +0000 (08:48 -0700)]
Propagate configuration parser errors

Closes #743

9 years agoBuild examples into `target/examples`
Alex Crichton [Fri, 24 Oct 2014 16:18:19 +0000 (09:18 -0700)]
Build examples into `target/examples`

This ends up killing two birds with one stone! The rationale behind this is that
the example and bin namespaces are not the same, and we don't mix metadata into
either filename, so the outputs need to be in different locations.

Closes #193
Closes #751

9 years agoDon't leave behind corrupt directories
Alex Crichton [Mon, 27 Oct 2014 19:44:50 +0000 (12:44 -0700)]
Don't leave behind corrupt directories

Ensure that a system `rm -rf target` will continue to work across test runs.

9 years agoDocument the new manifest keys
Alex Crichton [Fri, 24 Oct 2014 01:20:08 +0000 (18:20 -0700)]
Document the new manifest keys

9 years agoAvoid updating the registry too frequently
Alex Crichton [Thu, 23 Oct 2014 20:04:08 +0000 (13:04 -0700)]
Avoid updating the registry too frequently

This logic is based off the precision of the registry source's id as well as the
dependencies being passed in. More info can be found in the comments.

9 years agoRemove some unused imports
Alex Crichton [Thu, 23 Oct 2014 19:52:20 +0000 (12:52 -0700)]
Remove some unused imports

9 years agoAdd a cache to the registry source
Alex Crichton [Thu, 23 Oct 2014 19:51:51 +0000 (12:51 -0700)]
Add a cache to the registry source

This should help avoid hitting disk wherever possible and will also be leveraged
in just a second!

9 years agoRespect yanks in the registry
Alex Crichton [Thu, 23 Oct 2014 19:21:08 +0000 (12:21 -0700)]
Respect yanks in the registry

In general the semantics of a yank are that the code itself is not removed from
the registry, but rather packages are no longer allowed to depend on the
version. A yank is normally done to remove broken code or perhaps secrets, but
actually deleting code means that all packages depending on the yanked version
all of a sudden break. For these reasons a yank does not actually delete code,
but only flags the version as yanked in the index.

Yanked packages are therefore able to be depended upon if a lockfile points at a
yanked version, but are not allowed to become new dependencies of packages.

Implementation-wise, the following changes were made:

* SourceIds originating from a lockfile for registries will have a precise
  version listed (just a generic string "locked")
* Dependencies which use precise source ids are allowed to read yanked versions
* Dependencies without a precise source id are not allowed to use yanked
  versions

When using a lockfile (or a previous instance of resolve), all operations will
rewrite dependencies to have the precise source ids where applicable, meaning
the locked versions have access to yanked versions, but the unlocked versions do
not.

9 years agoFix a flaky test relying on nondeterminsm
Alex Crichton [Thu, 23 Oct 2014 19:12:03 +0000 (12:12 -0700)]
Fix a flaky test relying on nondeterminsm

When updating a source with multiple packages, the registry will lazily discover
both the precise and imprecise versions of the source at some point. Previously
the source would be updated depending on which was discovered first, but this
commit adds logic to understand that if an imprecise version is discovered after
a precise version then the imprecise version should be favored (because it will
always trigger an update).

This needs to understand, however, that if `cargo update --precise` is used that
those sources should not be updated again, so the sources treated in
`add_sources` are considered "special" in the sense that they're locked and will
not be updated again.

9 years agoMake SourceKind private
Alex Crichton [Thu, 23 Oct 2014 19:01:48 +0000 (12:01 -0700)]
Make SourceKind private

This is a bit of an implementation detail of the `SourceId` and we should be
able to get away without exposing it.

9 years agoIntegrate the lockfile and registry-based deps
Alex Crichton [Thu, 23 Oct 2014 17:38:44 +0000 (10:38 -0700)]
Integrate the lockfile and registry-based deps

This commit radically changes the approach of how lockfiles are handled in the
package registry and how resolve interacts with it. Previously "using a
lockfile" entailed just adding all of the precise sources to the registry and
relying on them not being updated to remain locked. This strategy does not work
out well for the registry, however, as one source can provide many many packages
and it may need to be updated for other reasons.

This new strategy is to rewrite instances of `Summary` in an on-demand fashion
to mention locked versions and sources wherever possible. This will ensure that
any relevant `Dependency` will end up having an exact version requirement as
well as a precise source to originate from (if possible). This rewriting is
performed in a few locations:

1. The top-level package has its dependencies rewritten to their precise
   variants if the dependency still matches the precise variant. This covers the
   case where a dependency was updated the the lockfile now needs to be updated.
2. Any `Summary` returned from the package registry which matches a locked
   `PackageId` will unconditionally have all of its dependencies rewritten to
   their precise variants. This is done because any previously locked package
   must remain locked during resolution.
3. Any `Summary` which points at a package which was not previously locked still
   has its dependencies modified to point at any matching locked package. This
   is done to ensure that updates are as conservative as possible.

There are still two outstanding problems with lockfiles and the registry which
this commit does not attempt to solve:

* Yanked versions are not respected
* The registry is still unconditionally updated on all compiles.

9 years agoRestructure resolve/lockfile ops
Alex Crichton [Thu, 23 Oct 2014 05:18:49 +0000 (22:18 -0700)]
Restructure resolve/lockfile ops

Move functionality from cargo_fetch and cargo_generate_lockfile into dedicated
lockfile/resolve modules. The plan is to expand the resolve module significantly
to deal with the lockfile that's loaded.

9 years agoMake it easier to map dependencies in a summary
Alex Crichton [Thu, 23 Oct 2014 05:14:23 +0000 (22:14 -0700)]
Make it easier to map dependencies in a summary

This will hopefully become useful in the upcoming changes to resolve for
lockfiles with the registry.

9 years agoRewrite registry tests for easier mocking and such
Alex Crichton [Thu, 23 Oct 2014 05:05:30 +0000 (22:05 -0700)]
Rewrite registry tests for easier mocking and such

9 years agoDon't de-dup added sources
Alex Crichton [Wed, 22 Oct 2014 22:33:08 +0000 (15:33 -0700)]
Don't de-dup added sources

We have a hash map on the side and a method that already aborts re-adding a
source if it was already added.

9 years agoDon't seed Registry with known source ids
Alex Crichton [Wed, 22 Oct 2014 22:21:34 +0000 (15:21 -0700)]
Don't seed Registry with known source ids

In the normal case this isn't necessary due to the Registry dynamically
discovering sources when dependencies are queried for. Consequently there's no
need to register all these sources ahead-of-time, and it reduces the cognitive
load when thinking about sources and updates.

9 years agoRemove the hokey add_lockfile_sources
Alex Crichton [Wed, 22 Oct 2014 22:05:49 +0000 (15:05 -0700)]
Remove the hokey add_lockfile_sources

This method shouldn't be necessary as it should be possible to simply add all
sources known in the lockfile to a package registry, and
core::{resolve, registry} should take care of weeding them out if necessary.

In the process of doing so, this actually ends up fixing a problem with
rewriting a dependency to a new one which shares transitive deps. Previously all
the transitive deps were updated, but now the transitive deps remain locked at
where they were previously locked.