Commit graph

171 commits

Author SHA1 Message Date
bors
6ebaa3805d 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).

Closes #318
2014-08-06 18:58:18 +00:00
bors
6d78a2f199 auto merge of #319 : alexcrichton/cargo/fix-staticlibs, r=wycats
The file-naming bits weren't handling the staticlib case
2014-08-06 18:49:48 +00:00
Alex Crichton
85b0d0a452 Fix the output type of staticlib
The file-naming bits weren't handling the staticlib case
2014-08-06 11:28:25 -07:00
Björn Steinbrink
dd0df64031 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.
2014-08-05 12:27:51 +02:00
Alex Crichton
2f2769b4e2 Update the lockfile when deps are modified
Closes #314
2014-08-04 13:35:04 -07:00
Alex Crichton
c64d191d20 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).
2014-08-04 07:28:57 -07:00
Alex Crichton
1b957d41fb 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.
2014-08-03 18:38:25 -07:00
bors
8c6e1a3568 auto merge of #303 : alexcrichton/cargo/issue-299, r=wycats
Closes #299
2014-08-03 17:07:06 +00:00
Alex Crichton
bfc1519490 Make freshness tests more robust with time travel
Add a helper function to forcibly move a tree back one hour so new edits are
picked up correctly.
2014-08-02 10:55:02 -07:00
Alex Crichton
dd2c5980b4 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.

Closes #214
Closes #289
2014-08-02 00:16:19 -07:00
Alex Crichton
79768eb0d9 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.
2014-08-02 00:16:19 -07:00
Alex Crichton
b7849f5457 Ensure update updates all shared deps 2014-08-01 10:39:11 -07:00
Alex Crichton
2a94483642 Ensure manifest paths are absolute paths
Closes #299
2014-08-01 08:52:51 -07:00
Alex Crichton
620b2fe1b5 Implement cargo-update 2014-07-31 15:39:52 -07:00
Alex Crichton
1a35097a9a Use sources from the lockfile
The sources in the lock file contain precise information about git deps so we
want them over the non-precise versions in the source.
2014-07-31 12:18:49 -07:00
Alex Crichton
3b77b2c763 Fix all tests and rebase conflicts
This rebases the lockfile branch to master and updates all code necessary to get
the tests passing again.
2014-07-31 10:16:03 -07:00
Tim Carey-Smith
e465ace4f1 [WIP] Generate Cargo.lock on successful resolve 2014-07-31 07:09:53 -07:00
Alex Crichton
f664874281 Migrate from liburl to rust-url
The standard url library is soon-to-be deprecated, and now that we're
bootstrapping it's trivial to move over to rust-url.

Closes #204
2014-07-30 09:55:48 -07:00
bors
672f392528 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.

Closes #284
2014-07-29 21:14:29 +00:00
bors
57fc68cd11 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"
2014-07-29 20:44:31 +00:00
Michael Sproul
f65aeebf64 Improve the error message for missing packages. 2014-07-29 17:31:57 +10:00
Alex Crichton
e97f46562d 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.

Closes #284
2014-07-28 21:13:08 -07:00
Alex Crichton
74c8d5716f 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.
2014-07-28 19:36:45 -07:00
Alex Crichton
6f2173dc9f 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.
2014-07-28 17:08:46 -07:00
Alex Crichton
ba273af564 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

Closes #218
2014-07-28 13:37:19 -07:00
Alex Crichton
3f110840b3 Add a cargo-doc command 2014-07-27 19:17:26 -07:00
Alex Crichton
4abf27e7b5 Bootstrap cargo with cargo 2014-07-25 21:20:28 -07:00
Alex Crichton
73947e5c3b Base get_fingerprint on a PackageId
The fingerprinting code was erroneously using all sources from a manifest when
calculating the fingerprint which meant that sources not yet downloaded were
attempted to be fingerprinted.

The correct source to fingerprint is located in the SourceId field of the
resolved PackageId.

Closes #259
2014-07-24 19:32:49 -07:00
Alex Crichton
f3e43bfced Ensure LD_LIBRARY_PATH is correct for plugins
At runtime rustc will dlopen() plugins, and if plugins have dynamic dependencies
they're likely to be in target/deps, so we need to make sure that directory is
in the right search path.
2014-07-24 12:30:47 -07:00
Carl Lerche
a12beb61d9 Supply the crate version via ENV vars 2014-07-23 23:11:05 -07:00
bors
645c355eba auto merge of #251 : alexcrichton/cargo/print-the-failure, r=wycats
This previously relied on the test itself printing failure, but this is not
always the case for test which, for example, segfault. Instead this ensures that
*something* is always printed when a test fails, normally a short blurb about
what executable failed to run.
2014-07-23 20:10:26 +00:00
Alex Crichton
ab148e863b Ensure a message is printed on test failure
This previously relied on the test itself printing failure, but this is not
always the case for test which, for example, segfault. Instead this ensures that
*something* is always printed when a test fails, normally a short blurb about
what executable failed to run.
2014-07-23 13:08:57 -07:00
Alex Crichton
93c2d0d4ff Allow omitting part of the output of a process
Sometimes it's a pain to match the *exact* output of a process, so this adds a
placeholder where `[..]` indicates "any more input on this line". It can in
theory be used multiple times in a input string.
2014-07-23 12:52:18 -07:00
Alex Crichton
7343afbfa7 Only copy over the native output directory once
Previously it was copying once per target, not once per package.
2014-07-23 12:19:02 -07:00
Alex Crichton
8a14c306d8 Fix cargo test with a dylib when run twice
The filename of the test for a dylib wasn't being calcuated correctly, so when
freshness was copying data over it ended up copying the same file twice.
2014-07-23 12:19:02 -07:00
Alex Crichton
6a8208c9a9 Ensure binaries are present for tests
Also make sure that binaries are named appropriately so they don't clash.
2014-07-23 12:00:18 -07:00
Alex Crichton
82fc887ce3 Fix integration tests with same names as libs
Use extra-filename mixins to ensure that these names never clash.
2014-07-23 11:44:15 -07:00
bors
eb9bd6cb6f auto merge of #248 : alexcrichton/cargo/issue-225, r=wycats
The current package being built should never be overridden, only its
dependencies.

Closes #225
2014-07-23 15:53:49 +00:00
Alex Crichton
32884f0a50 Filter the current package out of override paths
The current package being built should never be overridden, only its
dependencies.

Closes #225
2014-07-23 08:52:27 -07:00
bors
03b3bbc23d auto merge of #246 : alexcrichton/cargo/issue-227, r=wycats
Test by @EdShaw!

Closes #227
2014-07-23 15:29:36 +00:00
Alex Crichton
ed3bb05b42 Fix crates with the same name as standard crates
The test and bin executables weren't getting the correct --extern flags when
tested and built, so the names were conflicting. This passes --extern for the
local crate to ensure the right crate is picked up.
2014-07-22 17:55:17 -07:00
bors
8d0e2d5379 auto merge of #240 : alexcrichton/cargo/cargo-new, r=wycats
This command is used to create a new cargo repository at a destination that
previously does not exist. A separate command, cargo-init, will be implemented
to initialize an already-existing repository.

cc #21

This is currently rebased on #238
2014-07-22 17:44:39 +00:00
Alex Crichton
a4272ef2b7 Implement cargo-new
This command is used to create a new cargo repository at a destination that
previously does not exist. A separate command, cargo-init, will be implemented
to initialize an already-existing repository.

cc #21
2014-07-22 10:36:19 -07:00
Alex Crichton
bcde2c61b1 Don't rename a directory to a directory
Test by @EdShaw!

Closes #227
2014-07-22 10:21:27 -07:00
Alex Crichton
5dc5381fcc Use a hash for -C metadata instead of a string
This ends up serving the same purpose, but a critical change is that it
canonicalizes the relevant git url (if one is used) to ensure that the same
package from two slightly different locations is always built the same way.

Sadly I'm not quite sure how to add a test for this as it involves using remote
git urls which are unusable during tests.
2014-07-22 10:06:36 -07:00
bors
c3f9f9e700 auto merge of #242 : alexcrichton/cargo/issue-111, r=wycats
This was fixed when rustc properly added extra-filename to all temp outputs as
opposed to just libraries.

Closes #111
2014-07-22 16:42:04 +00:00
bors
91453d1ffa auto merge of #238 : alexcrichton/cargo/cstr-builder, r=wycats
At the same time, remove a bunch of `path.display().to_string()` and friends.
2014-07-22 15:44:51 +00:00
Alex Crichton
e670203261 Add a test for closed issue #111
This was fixed when rustc properly added extra-filename to all temp outputs as
opposed to just libraries.

Closes #111
2014-07-22 07:45:46 -07:00
bors
6ff9baed25 auto merge of #235 : rust-lang/cargo/better-test-output, r=alexcrichton
@alexcrichton r?
2014-07-22 05:22:22 +00:00
Alex Crichton
4f9d67bce0 Fix windows tests 2014-07-21 22:21:22 -07:00