Alex Crichton [Mon, 11 Aug 2014 04:27:17 +0000 (21:27 -0700)]
Disable doctests separately from tests
This adds a `doctest = false` option to the `Cargo.toml` config for a target to
disable doc tests for the target. Notably `test = false` does not disable this
as it is separately toggleable.
Alex Crichton [Thu, 7 Aug 2014 00:50:55 +0000 (17:50 -0700)]
Robustly run binaries and tests after compilation
These were previously just run by executing the raw binary, but this didn't
ensure that any of the necessary paths were in the dylib search path for the
host platform.
This commit enhances the return type of `compile_targets` to have information
about the result of compilation, along with the ability to spawn correctly
configured processes.
This primarily fixes `cargo test` and `cargo run` whenever dynamic dependencies
are involved, but it also fixes the two commands whenever there's a native
dynamic dependency involved as well.
bors [Wed, 6 Aug 2014 23:57:54 +0000 (23:57 +0000)]
auto merge of #302 : alexcrichton/cargo/doc-test, r=wycats
Whenever `cargo test` is run and a testable library target is available, the doc
tests will be run. This can be opted out of with `test = false` as usual.
This is currently not super useful due to rust-lang/rust#16157, but I expect
that to be merged soon. In the meantime examples will need to `extern crate foo`
explicitly.
bors [Wed, 6 Aug 2014 19:20:56 +0000 (19:20 +0000)]
auto merge of #328 : alexcrichton/cargo/cargo-building-cargo, r=wycats
Cargo should be able to build with cargo so others can depend on the cargo
library. This means that the one requirement of the CFG_VERSION env var will not
be available. This alters `version()` to prioritize CFG_VERSION but fall back to
the cargo-specified variables.
bors [Wed, 6 Aug 2014 18:58:18 +0000 (18:58 +0000)]
auto merge of #320 : alexcrichton/cargo/fix-doc-bins, r=wycats
This removes the check in the compilation phase, but adds an error if you're
documenting a library and a binary with the same name (as the rustdoc output
would conflict).
Alex Crichton [Wed, 6 Aug 2014 03:54:32 +0000 (20:54 -0700)]
Lift the requirement that cargo is built with make
Cargo should be able to build with cargo so others can depend on the cargo
library. This means that the one requirement of the CFG_VERSION env var will not
be available. This alters `version()` to prioritize CFG_VERSION but fall back to
the cargo-specified variables.
Alex Crichton [Fri, 1 Aug 2014 03:21:13 +0000 (20:21 -0700)]
Implement doc tests
Whenever `cargo test` is run and a testable library target is available, the doc
tests will be run. This can be opted out of with `test = false` as usual.
This is currently not super useful due to rust-lang/rust#16157, but I expect
that to be merged soon. In the meantime examples will need to `extern crate foo`
explicitly.
bors [Tue, 5 Aug 2014 14:44:33 +0000 (14:44 +0000)]
auto merge of #325 : dotdash/cargo/git_no_template, r=alexcrichton
I customized my git repo template to default to the standard pre-commit
hook that checks for e.g. trailing whitespace and refuses to commit if
any trailing whitespace was found. This causes some of cargo's tests to
fail.
To be independent of the user's git template, create the repo for the
test without using any, by specifying an empty template.
Fix running tests using git on systems with customized git templates
I customized my git repo template to default to the standard pre-commit
hook that checks for e.g. trailing whitespace and refuses to commit if
any trailing whitespace was found. This causes some of cargo's tests to
fail.
To be independent of the user's git template, create the repo for the
test without using any, by specifying an empty template.
Alex Crichton [Mon, 4 Aug 2014 14:21:31 +0000 (07:21 -0700)]
Allow documenting binary targets.
This removes the check in the compilation phase, but adds an error if you're
documenting a library and a binary with the same name (as the rustdoc output
would conflict).
bors [Mon, 4 Aug 2014 03:25:05 +0000 (03:25 +0000)]
auto merge of #314 : alexcrichton/cargo/hurray-for-windows, r=wycats
On windows, git will check out files with different line endings causing the
same serialized resolve to be resolved slightly differently. Instead of
comparing contents, this commit alters by testing whether the decoded resolve is
equivalent to the to-be-written resolve and only aborts writing if the two are
equal.
Alex Crichton [Mon, 4 Aug 2014 01:38:25 +0000 (18:38 -0700)]
Deal with different encodings of Cargo.lock
On windows, git will check out files with different line endings causing the
same serialized resolve to be resolved slightly differently. Instead of
comparing contents, this commit alters by testing whether the decoded resolve is
equivalent to the to-be-written resolve and only aborts writing if the two are
equal.
bors [Sat, 2 Aug 2014 17:56:11 +0000 (17:56 +0000)]
auto merge of #294 : alexcrichton/cargo/here-we-go, r=wycats
This is a series of commits which culminate in fixing #214. The last remaining bit is that freshness for an entire package is still considered if the package has a `build` command, but that is pretty easy to fix and I plan on doing so soon-ish.
Alex Crichton [Tue, 29 Jul 2014 18:27:40 +0000 (11:27 -0700)]
Implement per-target fingerprints
This commit refines the granularity of fingerprints from packages to targets,
building on the existing infrastructure. All invocations of rustc now include
the --dep-info flag which will emit makefile-like dependency information. This
information is then parsed later on to determine if all the files are fresh.
The purpose of this commit is to refine the set of files which indicate that a
target needs to be re-built. Before this commit if you modified a test it would
rebuild the entire library, but after this commit it only rebuilds the relevant
test.
Alex Crichton [Tue, 29 Jul 2014 17:20:42 +0000 (10:20 -0700)]
Prepare for per-target fingerprints
This commit refactors all related infrastructure for the cargo_rustc module to
move the granularity of fingerprints from packages to targets. This involved
heavily modifying the `JobQueue` structure to understand a finer-grained target
for dirtiness propagation and dependency management, and then dealing with
fallout in the main module.
The fingerprint module has been refactored to support a per-target fingerprint.
A fallout of this change is that each build step has its own fingerprint,
including the custom build command step. This will be implemented in a future
commit.
As fallout of this reorganization, we are now exploiting the maximal parallelism
within packages themselves whereas before we were only partially parallelizing.
No new features were added as part of this commit, so I just ensured that all
the tests ran.
Alex Crichton [Tue, 29 Jul 2014 04:23:48 +0000 (21:23 -0700)]
Power the TaskPool with a sync channel
This rate limits the jobs entering the pool to ensure that the number of
pending jobs is actually close to the number of cores. The current behavior is
to print all pending jobs, even when they're not executing, which may be
confusing.
bors [Fri, 1 Aug 2014 22:29:29 +0000 (22:29 +0000)]
auto merge of #301 : alexcrichton/cargo/lockfile, r=wycats
This PR is a series of commits building off the `lockfile` branch which finishes the work on the lockfile as well as implementing the `cargo-update` command.
This PR deprecates the `-u` flag in favor of the `cargo update` command.
Alex Crichton [Thu, 31 Jul 2014 19:20:05 +0000 (12:20 -0700)]
Optimize freshness of git repos
This commit cuts down on the number of invocations of `git` to make the "happy
path" of an up-to-date git repo much smoother. The precise information is also
applied from the lockfile to speed things up.
auto merge of #290 : omasanori/cargo/makefile, r=alexcrichton
Both Makefile.in and install.sh prepended `${DESTDIR}` to `${PREFIX}` so the installation prefix became `${DESTDIR}/${DESTDIR}/${PREFIX}`. Also, the script assumes that `${DESTDIR}` ends with a slash or `${PREFIX}` starts with it so I appended a slash to `${DESTDIR}`.
auto merge of #285 : alexcrichton/cargo/fix-cargo-doc, r=wycats
The existing rustdoc behavior for working with an already-present directory is
good enough, so there's no need for cargo to help out by blowing things away.
This also makes the copy-back portion easier by just not having it.
auto merge of #255 : michaelsproul/cargo/missing-pkg-error, r=alexcrichton
I've changed the error message that appears when a dependency can't be located. With my changes, mismatches between Cargo.toml dependency names and actual dependency package names are (slightly) more apparent. This doesn't change the error that appears when a dependency has an invalid source.
Example:
```toml
# Cargo.toml
...
[dependencies.foo]
path = "foo"
```
```toml
# foo/Cargo.toml
[package]
name = "not_foo"
```
Previously:
```
$ cargo build
No package named Dependency { name: foo, namespace: file:/home/michael/cargo_test, req: *, transitive: true } found
```
Now:
```
$ cargo build
No package named `foo` found (required by `bar`).
Location searched: /some/folder/not_foo
Version required: *
```
In verbose mode I think it would be also nice to print a list of packages that Cargo *does* know about. Something like: "Known packages amongst dependencies: not_foo, etc"
auto merge of #283 : alexcrichton/cargo/fix-fresh-plugin-deps, r=wycats
When copying files over from the old root to the new root on a fresh
compilation, care must be taken to preserve the correct plugin/host version of
each dependency. The previous code copied back over at most one library, but
this commit fixes this behavior by copying over all targets necessary for
compilation.
Alex Crichton [Tue, 29 Jul 2014 03:09:07 +0000 (20:09 -0700)]
Don't blow away target/doc
The existing rustdoc behavior for working with an already-present directory is
good enough, so there's no need for cargo to help out by blowing things away.
This also makes the copy-back portion easier by just not having it.
Alex Crichton [Tue, 29 Jul 2014 02:35:08 +0000 (19:35 -0700)]
Correctly preserve plugin deps
When copying files over from the old root to the new root on a fresh
compilation, care must be taken to preserve the correct plugin/host version of
each dependency. The previous code copied back over at most one library, but
this commit fixes this behavior by copying over all targets necessary for
compilation.
auto merge of #277 : alexcrichton/cargo/add-configure-script, r=wycats
This configure script is similar to rust's in that it doesn't require anything
like autotools, it's just a meta-script to "generate" a makefile and perform
run-of-the-mill validation/discovery before the Makefile is run.
The main purpose of this rewrite is to support multi-target and targeted builds.
This will allow us to produce 32-bit snapshots for platforms as well as easily
providing `./configure --target $foo` for initialization.
Alex Crichton [Mon, 28 Jul 2014 15:01:54 +0000 (08:01 -0700)]
Add a configure script
This configure script is similar to rust's in that it doesn't require anything
like autotools, it's just a meta-script to "generate" a makefile and perform
run-of-the-mill validation/discovery before the Makefile is run.
The main purpose of this rewrite is to support multi-target and targeted builds.
This will allow us to produce 32-bit snapshots for platforms as well as easily
providing `./configure --target $foo` for initialization.
auto merge of #282 : alexcrichton/cargo/fix-some-cross-compile-with-plugins, r=wycats
* Make sure plugins link to plugin dependencies, not target dependencies.
Previously the --extern flag was being passed incorrectly but the dependency
was being picked up by -L anyway.
* Fix a type and actually put the host dep directory into LD_LIBRARY_PATH, not
the target directory. A test was added for this change.
Alex Crichton [Tue, 29 Jul 2014 00:08:46 +0000 (17:08 -0700)]
Fix some dep errors with cross-compiled plugins
* Make sure plugins link to plugin dependencies, not target dependencies.
Previously the --extern flag was being passed incorrectly but the dependency
was being picked up by -L anyway.
* Fix a type and actually put the host dep directory into LD_LIBRARY_PATH, not
the target directory. A test was added for this change.
auto merge of #266 : alexcrichton/cargo/docopt, r=wycats
The hammer library currently has some shortcomings such as the inability to
document individual options. Additionally our handling with hammer of extra
arguments is dodgy at best currently.
This commit moves the repository to BurntSushi's docopt.rs library which seems
to more feature-complete at this time. Additionally, docopt has the great
benefit of a "document once, use everywhere" documentation strategy.
This migration solves two primary issues:
* Comprehensive and useful CLI documentation
* Gracefully handling flavorful combinations of arguments in odd combinations
Alex Crichton [Thu, 24 Jul 2014 19:43:10 +0000 (12:43 -0700)]
Move from hammer to docopt for option parsing
The hammer library currently has some shortcomings such as the inability to
document individual options. Additionally our handling with hammer of extra
arguments is dodgy at best currently.
This commit moves the repository to BurntSushi's docopt.rs library which seems
to more feature-complete at this time. Additionally, docopt has the great
benefit of a "document once, use everywhere" documentation strategy.
This migration solves two primary issues:
* Comprehensive and useful CLI documentation
* Gracefully handling flavorful combinations of arguments in odd combinations
auto merge of #254 : alexcrichton/cargo/cargo-doc, r=wycats
This is blocked until https://github.com/rust-lang/rust/pull/15939 lands, but in the meantime I figured I could get some eyes on this to make sure I'm sane.
auto merge of #265 : alexcrichton/cargo/issue-261, r=wycats
Receiving a signal is normally indicative of violent termination, so the
subcommand can't be relied upon to have printed some status information. As a
result, signals now have some extra errors printed to stderr when they fail.
Closes #261. The actual signal is still a bug, but it's an upstream rust bug.