Commit graph

6628 commits

Author SHA1 Message Date
Joshua DeSeno db134e958e Fix warnings for constant names 2014-10-07 09:25:05 +09:00
bors 548fdf4116 auto merge of #661 : alexcrichton/cargo/issue-660, r=brson
When using `cargo test -p`, be sure to run only the doc tests for the package
actually being tested.

Closes #660
2014-10-06 23:45:06 +00:00
Alex Crichton a9f650b02b Don't always run doc tests for the root package
When using `cargo test -p`, be sure to run only the doc tests for the package
actually being tested.

Closes #660
2014-10-06 16:04:07 -07:00
bors 159bb4448d auto merge of #663 : alexcrichton/cargo/issue-648, r=brson
This means that if a project has a file with a space in the name it will
properly have its freshness calculated as opposed to always having it as a
candidate to be rebuilt.

Closes #648
2014-10-06 23:00:04 +00:00
Alex Crichton ec1091e9ee Remove the notion of "primary" from Context
Now that we have selective testing, this no longer makes any sense and all
queries to the path layout need to be based on the package being queried for.
This removes the primary flag from the Context, and requires that the `layout`
method have a local Package available

cc servo/servo#3580
2014-10-06 11:27:16 -07:00
Alex Crichton 99087dd31b Sort feature lists for fingerprint hashing
Otherwise the order was nondeterministic likely due to some hash map along the
way being used to deduplicate the set of features.

Closes #665
2014-10-05 20:23:18 -07:00
Alex Crichton 3efe0704d1 Parse escaped spaces in makefile dependencies
This means that if a project has a file with a space in the name it will
properly have its freshness calculated as opposed to always having it as a
candidate to be rebuilt.

Closes #648
2014-10-03 07:54:03 -07:00
Alex Crichton a7423e6765 Add a test for #432
All problems have been fixed in the previous commits, and this now closes #432
2014-10-02 18:43:26 -07:00
Alex Crichton 15e2076e87 Allow "cycles" through dev-deps
Development dependencies can never be the root of a cycle because nothing
depends on a development dependency, so there's no need to track the start of a
cycle at the edge going out to a development dependency.

If a cycle is later detected, it will still be reported.
2014-10-02 18:38:15 -07:00
Alex Crichton 1ef09734ed Refine dependencies on dev-deps
Currently whenever a dev-dep is brought in to the build process the entire
library is rebuilt, but this is just unnecessary recompilation because the
library *can't* depend on the dev-dep.

This commit refines the dependency graph so the lib stage only depends on
transitive dependencies (non-dev-deps), and a new stage for tests was added
which depends on the packages libraries *and* the dev-deps. This way only the
test are rebuilt when dev-deps change, not libraries.
2014-10-02 18:38:15 -07:00
bors 56dfb19a9a auto merge of #631 : alexcrichton/cargo/issue-514, r=brson
If the host system had $HOME/.cargo/config which configured a user name/email
then this test would fail because those would be prioritized over $USER.

Closes #514
2014-10-02 19:13:13 +00:00
Alex Crichton 37dbfd2ec6 Improve the error message for ambiguous specs 2014-09-29 16:55:45 -07:00
Alex Crichton 217ff7fb93 Deprecate cargo update foo
To maintain consistency with `cargo {build,test,bench,clean}` the `update`
subcommand now takes a specific package via the `-p` argument instead of as a
positional argument.
2014-09-29 16:54:45 -07:00
Alex Crichton f97cef0c30 Add cargo {test,bench} -p <spec>
This functionality allows running tests and benchmarks on any upstream
dependencies in the dependency graph. This is most useful for path sources all
developed in tandem (see Servo for instance).

In terms of built artifacts, this will actually preserve as many artifacts as
possible. That means that if you test a low-level dependency with the high-level
artifacts already built, the high-level artifacts will not get removed. This
means that it's possible to accidentally have a low-level dependency to depend
on a higher level one just because it's lib is picked up via -L, but this is
generally a necessary evil to get testing to not rebuild packages too often.

Closes #483
2014-09-29 16:54:45 -07:00
Alex Crichton 69bc3d055a Allow specifying what to build as part of cargo build
This allows selectively building one dependency within a dependency graph for
debugging its build or such.

Closes #537
2014-09-29 16:54:24 -07:00
Alex Crichton 325c5f2def Allow selectively cleaning packages
This adds a new argument to `cargo clean` which will enable selectively cleaning
particular packages. The command only cleans the package specified, no other
(not the dependencies of the package).

cc #537
2014-09-29 16:54:24 -07:00
Alex Crichton f4e91546a4 Make a test more resilient against the host system
If the host system had $HOME/.cargo/config which configured a user name/email
then this test would fail because those would be prioritized over $USER.

Closes #514
2014-09-26 21:16:31 -07:00
Alex Crichton c098a9a7a9 Allow updating to a precise revision
This commit adds a flag, --precise, to cargo update. This flag is used to update
a dependency to precisely an exact revision (or branch) as part of an update
step. For git repositories the argument is some form of reference, while
registry packages this will be a version number.

The flag --precise forces a non-aggressive update and will fail if the
--aggresive flag is specified.

Closes #484
2014-09-25 08:51:45 -07:00
Alex Crichton bdba59f6f1 Update to rust master
Also stop denying all warnings and only deny some common warnings. Allow
warnings such as deprecation.

Closes #634
2014-09-25 08:38:13 -07:00
bors b491ffeb5c auto merge of #617 : alexcrichton/cargo/issue-597, r=brson
Ensure that the dynamic linker search path contains the location of the output
directories for these dependencies when compiling with plugins.

Closes #597
2014-09-24 23:45:16 +00:00
Alex Crichton 2b46d039c0 Implement features
This feature was outlined in #385 [1], and documentation has been included as
part of this commit.

[1]: https://github.com/rust-lang/cargo/issues/385#issuecomment-53917539
2014-09-22 18:52:53 -07:00
bors 262c794949 auto merge of #614 : alexcrichton/cargo/issue-613, r=brson
As described in #613, this commit switches the semantics of `cargo update foo`
to updating *only* `foo`, not any of its dependencies. A new flag,
`--aggressive` was added to restore the old behavior.

The behavior of attempting to only unlock `foo`, and then if resolve fails
unlock all dependencies of `foo` is unimplemented as it's not super relevant
right now when the majority of dependencies are git dependencies and resolution
cannot fail for version-related reasons.

Closes #613
2014-09-22 20:58:34 +00:00
Alex Crichton 0c8f6dba56 Allow plugins to have native dylib dependencies
Ensure that the dynamic linker search path contains the location of the output
directories for these dependencies when compiling with plugins.

Closes #597
2014-09-21 15:15:36 -07:00
Alex Crichton d1a332d19a Make cargo update more conservative.
As described in #613, this commit switches the semantics of `cargo update foo`
to updating *only* `foo`, not any of its dependencies. A new flag,
`--aggressive` was added to restore the old behavior.

The behavior of attempting to only unlock `foo`, and then if resolve fails
unlock all dependencies of `foo` is unimplemented as it's not super relevant
right now when the majority of dependencies are git dependencies and resolution
cannot fail for version-related reasons.

Closes #613
2014-09-21 14:27:30 -07:00
Alex Crichton 541a535f71 Stop capturing output of all dependencies
There are some competing concerns when it comes to the output of compiling
dependencies:

* Not capturing anything leads to getting drowned in unrelated output
* Capturing requires coloration be compromised because of the way windows
  terminal colors are implemented.
* Path dependencies are often developed in tandem with the rest of a package,
  and capturing their output is not always desired.

To address these concerns, cargo previously captured output of dependent
compilations and then re-printed it to the screen if an error occurred. This
patch modifies the behavior to as follows:

* No output is captured. This preserves any coloration rustc provides.
* All dependencies are compiled with `-Awarnings`. This should suppress any
  extraneous output from the compiler and it is considered a bug otherwise if
  the compiler prints a warnings when `-Awarnings` is specified.
* All *path* dependencies (`path="..."`, overrides, etc) are *not* compiled with
  `-Awarnings`. The reason for this is that you are always in control of these
  packages and probably want to see warnings anyway.

Closes #490
Closes #496
2014-09-21 14:06:58 -07:00
Alex Crichton 3b0cf780b4 Shorten the cargo integration test directory name
Right now the win64 snapshot builders are failing to produce a snapshot, and
I've managed to track it down to a path length issue. Windows paths have a
maximum of 260 characters, and the characters add up pretty fast for a path
like:

    c:\bot\slave\cargo-nightly-win-64
      \build\target\x86_64-w64-mingw32
      \cargo-integration-test\home\.cargo
      \git\checkouts\meta-dep-<hash>\
      \$SHA\.git\...

The normal builders aren't failing I presume because `cargo-nightly-win-64` is
longer than `cargo-win64-64` (we must be *right up* against the limit). I've
confirmed that this shortening fixes the tests on the bots.
2014-09-17 08:30:35 -07:00
Alex Crichton dfae53c406 Fix some more deprecation warnings 2014-09-17 08:27:41 -07:00
bors 168bcab3e3 auto merge of #580 : alexcrichton/cargo/fix-cargo-doc, r=brson
There's no "doc-all" profile, so it needs to be canonicalized when finding the
name of the profile to pass to a build command.
2014-09-17 00:28:36 +00:00
Alex Crichton 2dff1ed610 Implement a cargo fetch command
This command is used to download all dependencies of a package ahead of time to
ensure that no more network communication will be necessary as part of a build.

cc #358
2014-09-16 15:59:39 -07:00
Alex Crichton 8732d07260 Tweak filesystem hierarchy format 2014-09-16 15:32:24 -07:00
Alex Crichton 61b8102dfb Fix cargo doc with custom build commands
There's no "doc-all" profile, so it needs to be canonicalized when finding the
name of the profile to pass to a build command.
2014-09-16 12:09:42 -07:00
Alex Crichton 0bab4ab034 Update deps 2014-09-16 12:05:21 -07:00
Alex Crichton ce57c09b66 Fix tests on windows 2014-09-16 12:05:21 -07:00
Alex Crichton eccdcae0c8 More and more tests (cargo upload) 2014-09-16 12:05:21 -07:00
Alex Crichton 07b06e9a74 Add tests exercising the registry source 2014-09-16 12:05:21 -07:00
Alex Crichton 97f073ef10 Test the output of cargo package 2014-09-16 12:05:21 -07:00
Alex Crichton 18e884d8de Implement a registry source
# cargo upload

The cargo-upload command will take the local package and upload it to the
specified registry. The local package is uploaded as a tarball compressed with
gzip under maximum compression. Most of this is done by just delegating to
`cargo package` The host to upload to is specified, in order of priority, by a
command line `--host` flag, the `registry.host` config key, and then the default
registry. The default registry is still `example.com`

The registry itself is still a work in progress, but the general plumbing for a
command such as this would look like:

1. Ensure the local package has been compressed into an archive.
2. Fetch the relevant registry and login token from config files.
3. Ensure all dependencies for a package are listed as coming from the same
   registry.
4. Upload the archive to the registry with the login token.
5. The registry will verify the package is under 2MB (configurable).
6. The registry will upload the archive to S3, calculating a checksum in the
   process.
7. The registry will add an entry to the registry's index (a git repository).
   The entry will include the name of the package, the version uploaded, the
   checksum of the upload, and then the list of dependencies (name/version req)
8. The local `cargo upload` command will succeed.

# cargo login

Uploading requires a token from the api server, and this token follows the same
config chain for the host except that there is no fallback. To implement login,
the `cargo login` command is used. With 0 arguments, the command will request
that a site be visited for a login token, and with an argument it will set the
argument as the new login token.

The `util::config` module was modified to allow writing configuration as well as
reading it. The support is a little lacking in that comments are blown away, but
the support is there at least.

# RegistrySource

An implementation of `RegistrySource` has been created (deleting the old
`DummyRegistrySource`). This implementation only needs a URL to be constructed,
and it is assumed that the URL is running an instance of the cargo registry.

## RegistrySource::update

Currently this will unconditionally update the registry's index (a git
repository). Tuning is necessary to prevent updating the index each time (more
coming soon).

## RegistrySource::query

This is called in the resolve phase of cargo. This function is given a
dependency to query for, and the source will simply look into the index to see
if any package with the name is present. If found, the package's index file will
be loaded and parsed into a list of summaries.

The main optimization of this function is to not require the entire registry to
ever be resident in memory. Instead, only necessary packages are loaded into
memory and parsed.

## RegistrySource::download

This is also called during the resolve phase of cargo, but only when a package
has been selected to be built (actually resolved). This phase of the source will
actually download and unpack the tarball for the package.

Currently a configuration file is located in the root of a registry's index
describing the root url to download packages from.

This function is optimized for two different metrics:

1. If a tarball is downloaded, it is not downloaded again. It is assumed that
   once a tarball is successfully downloaded it will never change.
2. If the unpacking destination has a `.cargo-ok` file, it is assumed that the
   unpacking has already occurred and does not need to happen again.

With these in place, a rebuild should take almost no time at all.

## RegistrySource::get

This function is simply implemented in terms of a PathSource's `get` function by
creating a `PathSource` for all unpacked tarballs as part of the `download`
stage.

## Filesystem layout

There are a few new directories as part of the `.cargo` home folder:

* `.cargo/registry/index/$hostname-$hash` - This is the directory containing the
  actual index of the registry. `$hostname` comes from its url, and `$hash` is
  the hash of the entire url.

* `.cargo/registry/cache/$hostname-$hash/$pkg-$vers.tar.gz` - This is a
  directory used to cache the downloads of packages from the registry.

* `.cargo/registry/src/$hostname-$hash/$pkg-$vers` - This is the location of the
  unpacked packages. They will be compiled from this location.

# New Dependencies

Cargo has picked up a new dependency on the `curl-rust` package in order to send
HTTP requests to the registry as well as send HTTP requests to download
tarballs.
2014-09-16 12:05:21 -07:00
Alex Crichton 48399a1b76 Pass profile env vars to build commands
Closes #553
2014-09-15 11:47:31 -07:00
Alex Crichton 2d994b93a4 Rewrite git tests to not rely on the CLI
The CLI has started to have differences on windows than on other systems, and
instead of coding against multiple CLI versions, instead just rewrite everything
to use libgit2.
2014-09-15 09:43:54 -07:00
Alex Crichton a09ad635cc Update to rust master 2014-09-15 08:31:21 -07:00
Matt Brubeck 2e0ba67704 Try to fix intermittent test failures
Travis is showing intermittent failures in
`test_cargo_compile_path_deps::path_dep_build_cmd` and
`test_cargo_compile_git_deps::git_dep_build_cmd` (added in #561 and #563).

I haven't managed to reproduce these failures locally, but I suspect the tests
are timing-sensitive.  This tries to guarantee that the timestamps during the
two operations can't be the same.
2014-09-13 08:27:15 -07:00
bors 287abd87d2 auto merge of #563 : mbrubeck/cargo/list-files-git, r=alexcrichton
`list_files_git` assumes that the package is at the root of the git repository. This breaks when trying to list files for a package in a subdirectory of a repo, or in other cases, e.g. if the user's home directory is a git repo.
2014-09-13 02:43:50 +00:00
bors 8fa7375e9f auto merge of #561 : mbrubeck/cargo/list_file_walk, r=alexcrichton
Previously this was calling `.is_file()` on a relative path.  This would fail if the path was not relative to the current working directory, for example when listing files in a path dependency.
2014-09-13 01:43:38 +00:00
Matt Brubeck 5d029d9e94 Better fix for tests on the Mac builders 2014-09-12 18:06:52 -07:00
Matt Brubeck b4adda4d15 Test for build commands in git subdirs 2014-09-12 15:30:43 -07:00
Matt Brubeck bfe94c910b Fix tests on Mac builders
Comparing URIs in /tmp was failing because of symlinks.
2014-09-12 10:21:38 -07:00
Matt Brubeck b4885c3b1f Test for build command fingerprints in path deps
This tests the fix for list_files_walk from #561.
2014-09-12 10:21:38 -07:00
Alex Crichton 6742dde83b Don't clone remote repos, use fetch instead
When cloning a remote repository, the default behavior of libgit2 is to only
update the local ref that's actually checked out, when we actually would prefer
to update all refs of the remote repo. This removes a call to clone() to a
init_bare() + fetch() which should update all refs accordingly

Closes #565
2014-09-11 19:05:14 -07:00
bors 9d93ba09d1 auto merge of #555 : alexcrichton/cargo/issue-215, r=brson
Also print the commands only right before they're actually run.

Closes #215
2014-09-11 21:28:53 +00:00
Alex Crichton 7a542c51b7 Don't print Running for commands that aren't run
Also print the commands only right before they're actually run.

Closes #215
2014-09-11 07:35:25 -07:00
Brian Koropoff 11d2e999b3 Fix obsolete extern crate syntax in some of the tests 2014-09-10 22:36:23 -07:00
bors 96d07d9aaf auto merge of #549 : alexcrichton/cargo/git-no-delete, r=brson
This primarily blows away all *submodules* as well, which sometimes can be quite
large and take some time to update. Instead, re-use an existing checkout, just
reset it to the right revision if possible.

Also, move the submodule update step to occur unconditionally to account for
corrupt submodule checkouts or interrupted downloads. This update step should be
much faster than `git submodule update` because we're using libgit2, so yay!
2014-09-10 18:27:54 +00:00
bors 33cb518a59 auto merge of #548 : alexcrichton/cargo/frobbing-git-deps, r=brson
The previous logic for recompiling any dependency was almost entirely based on
the mtimes of the relevant input files. This isn't quite what's desired for git
and registry dependencies because the mtime could be fluctuating while the files
aren't changing. For example:

1. Project A checks out git repo C at revision C1
2. Project A builds, records mtimes of C
3. Project B checks out git repo C at revision C2
4. Project B builds, records new mtimes of C
5. Project A is rebuilt, rebuilding C b/c mtimes are different

In step 5 here C should not be rebuilt because the revision didn't actually
change.

This commit alters git/registry dependencies to completely bypass the --dep-info
emitted and only rely on the git/registry source to inform what the fingerprint
is. This is the revision/version, respectively, and should be all that's
necessary to track changes to the repo and trigger a rebuild.
2014-09-10 18:03:21 +00:00
Alex Crichton 78acc73989 Don't blow away checked out git repos
This primarily blows away all *submodules* as well, which sometimes can be quite
large and take some time to update. Instead, re-use an existing checkout, just
reset it to the right revision if possible.

Also, move the submodule update step to occur unconditionally to account for
corrupt submodule checkouts or interrupted downloads. This update step should be
much faster than `git submodule update` because we're using libgit2, so yay!
2014-09-10 07:47:11 -07:00
Alex Crichton c0127391bf Don't recompile git deps so frequently
The previous logic for recompiling any dependency was almost entirely based on
the mtimes of the relevant input files. This isn't quite what's desired for git
and registry dependencies because the mtime could be fluctuating while the files
aren't changing. For example:

1. Project A checks out git repo C at revision C1
2. Project A builds, records mtimes of C
3. Project B checks out git repo C at revision C2
4. Project B builds, records new mtimes of C
5. Project A is rebuilt, rebuilding C b/c mtimes are different

In step 5 here C should not be rebuilt because the revision didn't actually
change.

This commit alters git/registry dependencies to completely bypass the --dep-info
emitted and only rely on the git/registry source to inform what the fingerprint
is. This is the revision/version, respectively, and should be all that's
necessary to track changes to the repo and trigger a rebuild.
2014-09-10 07:26:42 -07:00
Alex Crichton 2d5d7b4e47 Add a NUM_JOBS env var to builds
Closes #539
2014-09-09 15:05:32 -07:00
bors 444dc1e28e auto merge of #528 : alexcrichton/cargo/deadlock, r=brson 2014-09-09 02:13:47 +00:00
bors 763e216907 auto merge of #532 : alexcrichton/cargo/issue-530, r=brson
Closes #530
2014-09-08 22:28:48 +00:00
bors 4ee87ded92 auto merge of #515 : alexcrichton/cargo/issue-472, r=brson
But still show it with --verbose

Closes #473
2014-09-08 17:58:56 +00:00
Alex Crichton 5706ebdbbe Mention the name of a package in a custom build failure
Closes #530
2014-09-07 16:06:19 -07:00
bors fd92ef98e2 auto merge of #513 : bkoropoff/cargo/revert-static, r=alexcrichton
This reverts a commit that worked around an overly restrictive lifetime bound on the `Writer` impl for `Box<Writer>` in libstd.  Now that this restriction has been lifted, the workaround can be reverted.
2014-09-07 18:58:58 +00:00
Alex Crichton ac094e893b Don't deadlock when a dep has no libs 2014-09-07 11:48:35 -07:00
Alex Crichton 4a70a7a111 Don't show Fresh by default
But still show it with --verbose

Closes #473
2014-09-05 10:16:21 -07:00
Alex Crichton 219f9902c9 Implement git authentication
This commit updates git2-rs to get the implementation of the authentication
callback in libgit2. Additionally this specifies the callback for whenever we're
cloning into the database or updating submodules.

Currently cargo will *not* ask for user input, but rather require you to have
authentication configured in git through some other means. There are currently
two primary methods of doing so:

1. Any SSH key in the local ssh-agent will be used for authentication with SSH
   repositories.
2. The `credential.helper` interface (as specified by gitcredential(7)) has been
   implemented in git2-rs to allow for picking up of storage of passwords in the
   local git cache or keychain.

If these two methods fail, then there will likely be an authentication failure.
Interactive prompts for authentication have not been implemented as there is no
method to currently enter your password into the terminal silently.

A consequence of this commit is that cargo now depends on libssh2. A package was
created to create a static copy of libssh2, and this is now linked into cargo by
default.

It turned out that just building libssh2 was quite a beast in and of itself on
windows. The primary stickler point is that on the current release, 1.4.3,
libssh2 requires openssl on windows. At this time I don't want to pick up a
dependency on openssl for windows, and it turned out that the unreleased 1.4.4
version has a new backend for windows not based on openssl, but rather windows's
cryptography API.

The current bundled version of libssh2 is 1.4.4 with some light modifications to
actually build on windows (wow that was hard). All in all, we're now statically
linking to libssh 1.4.4 (not a runtime dependency).

Closes #493
2014-09-05 07:25:56 -07:00
Brian Koropoff dda2bfd212 Add back fix for cross compile tests
This change was accidentally included in the reverted commit.
2014-09-05 01:15:11 -07:00
Brian Koropoff eef43af88e Revert "Be compatible with the stdlib for now ('static shell)"
This reverts commit a601d049fe.
2014-09-05 00:18:44 -07:00
Сухарик cc9ed63222 Merge with upstream and update Cargo.lock
Conflicts:
	src/bin/new.rs
	src/cargo/ops/cargo_new.rs
2014-09-04 13:37:09 +04:00
Сухарик a13fddc9d1 cargo/new: add a test for the --travis flag 2014-09-04 13:21:56 +04:00
Сухарик 0600ffee91 Revert "cargo/new: add test for `--travis flag; also update Cargo.lock"
This reverts commit 4ee5fd352a.
2014-09-04 13:20:37 +04:00
Carl Lerche 045254ed20 Do not pass static lib targets to rustc 2014-09-03 17:36:41 -07:00
bors d59c76dbc8 auto merge of #474 : alexcrichton/cargo/issue-461, r=wycats
Overrides are only queried by name, and it's possible for multiple to show up,
and just pick the first one.

Closes #461 

r? @wycats -- I'm not convinced this is correct
2014-09-03 22:20:06 +00:00
bors 08f9a73646 auto merge of #470 : alexcrichton/cargo/cargo-new-git, r=brson
This adds a command-line --no-git option to disable this behavior, as well as
adding a global config section for `git = false`. While I was at it I write some
documentation for the configuration format that cargo uses.
2014-09-03 21:01:00 +00:00
Alex Crichton de0f60410f Turn --git on by default for cargo-new.
This adds a command-line --no-git option to disable this behavior, as well as
adding a global config section for `git = false`. While I was at it I write some
documentation for the configuration format that cargo uses.
2014-09-03 14:00:16 -07:00
Alex Crichton 365190fe31 Implement manifest profiles
For documentation, see the included documentation in the commit.
2014-09-03 11:54:29 -07:00
Сухарик 4ee5fd352a cargo/new: add test for `--travis flag; also update Cargo.lock 2014-09-03 20:06:28 +04:00
Alex Crichton 9f6234707b Generate a lockfile sooner in cargo build
It's quite annoying if you update a dependency, but it takes you awhile to get
the dependency building. Previously the dependency graph would have to be
updated each time because the lockfile was only written *after* a successful
build.

Other tools like `cargo generate-lockfile` will already generate a lockfile at
any time, so just make it easier by moving it up in the compilation process.
2014-09-03 08:25:44 -07:00
bors 300b9c4cfd auto merge of #500 : alexcrichton/cargo/fix-flaky-test, r=brson
This test has been flaky on the bots for quite some time now, and the cause has
now been discovered. The root cause of the failure is that the execve for the
`cargo --list` command was failing with ETXTBUSY. In querying the manpage, this
means:

    Executable was open for writing by one or more processes.

This error can be explained by the following trace:

1. Thread A, running the `cargo --list` test, opens the destination executable
   for writing because it's copying the current executable into a different
   location.
2. Thread B, some other test, forks the process. The file descriptor of the
   destination executable of thread A is now duplicated in this process.
3. Thread A closes all files and such, and then goes to fork/exec
   `cargo --list`.
4. Thread B has not had time to close all its descriptors. so it still has the
   executable open for writing, causing the `execve` of thread A to fail.

This commit just removes these tested portions of the test, only testing that
cargo probes PATH.
2014-09-03 04:38:30 +00:00
bors d5e90ff128 auto merge of #499 : alexcrichton/cargo/issue-486, r=brson
They're not really related to benchmarks!

Closes #486
2014-09-03 04:03:09 +00:00
bors b4247e5edb auto merge of #495 : alexcrichton/cargo/issue-492, r=brson
Closes #492
2014-09-03 03:49:07 +00:00
bors 2bfa6283e5 auto merge of #475 : alexcrichton/cargo/issue-458, r=brson
Relative paths are now considered relative to the directory containing the
`.cargo/config` file specifying the relative path.

I also merge ConfigValueValue into ConfigValue by moving the Path directly next
to the String that defined it so we can track which strings came from which
paths.

Closes #458
2014-09-03 02:48:05 +00:00
bors e573384e65 auto merge of #471 : alexcrichton/cargo/issue-449, r=brson
This is often useful for picking up things like headers files from `*-sys`
packages when they had to compile locally (or perhaps for pkg-config).

Closes #449
2014-09-03 01:30:36 +00:00
bors e03fc6ac11 auto merge of #469 : alexcrichton/cargo/issue-442, r=brson
Discovering the prefix/suffix needs to understand that it's not actually
available.

Closes #442
2014-09-03 00:40:07 +00:00
Alex Crichton 086f2ae1ab Pass native output directories of dependencies
This is often useful for picking up things like headers files from `*-sys`
packages when they had to compile locally (or perhaps for pkg-config).

Closes #449
2014-09-02 17:33:50 -07:00
Alex Crichton 4f4e3236bb Fix relative override paths
Relative paths are now considered relative to the directory containing the
`.cargo/config` file specifying the relative path.

I also merge ConfigValueValue into ConfigValue by moving the Path directly next
to the String that defined it so we can track which strings came from which
paths.

Closes #458
2014-09-02 17:32:40 -07:00
Alex Crichton f3cb4232d8 Slim down the cargo --list test
This test has been flaky on the bots for quite some time now, and the cause has
now been discovered. The root cause of the failure is that the execve for the
`cargo --list` command was failing with ETXTBUSY. In querying the manpage, this
means:

    Executable was open for writing by one or more processes.

This error can be explained by the following trace:

1. Thread A, running the `cargo --list` test, opens the destination executable
   for writing because it's copying the current executable into a different
   location.
2. Thread B, some other test, forks the process. The file descriptor of the
   destination executable of thread A is now duplicated in this process.
3. Thread A closes all files and such, and then goes to fork/exec
   `cargo --list`.
4. Thread B has not had time to close all its descriptors. so it still has the
   executable open for writing, causing the `execve` of thread A to fail.

This commit just removes these tested portions of the test, only testing that
cargo probes PATH.
2014-09-02 11:49:36 -07:00
Alex Crichton 6ab594305b Don't run doc tests for cargo bench
They're not really related to benchmarks!

Closes #486
2014-09-02 11:49:16 -07:00
Alex Crichton d187620718 Update docopt to fix -- option parsing
Closes #492
2014-09-02 11:48:51 -07:00
Alex Crichton 7192e29aa7 Dedup overrides by name
Overrides are only queried by name, and it's possible for multiple to show up,
and just pick the first one.

Closes #461
2014-09-02 11:48:03 -07:00
Alex Crichton aa9ec52841 Support cross compiling to triples without dylibs
Discovering the prefix/suffix needs to understand that it's not actually
available.

Closes #442
2014-09-02 11:46:08 -07:00
Alex Crichton 127f659c88 Print longer paths to Cargo.toml on failure
Whenever possible, try to print a short path by using path_relative_from.

Closes #404
2014-09-02 11:45:25 -07:00
Alex Crichton a601d049fe Be compatible with the stdlib for now ('static shell) 2014-08-29 12:00:15 -07:00
Alex Crichton 20e37c6a81 Update the git2 dependency
It turned out most of the methods in libgit2 don't actually require a Signature
structure, they're all mostly optional. This commit updates to this version of
libgit2 where the arguments are all optional.
2014-08-28 11:15:49 -07:00
Alex Crichton c13d1cf9de Fix cargo-run rebasings and tests
Closes #443
2014-08-27 08:09:35 -07:00
Alex Crichton c5d0d21ea4 Merge remote-tracking branch 'cmr/master'
Conflicts:
	src/cargo/ops/cargo_run.rs
	tests/test_cargo_run.rs
2014-08-27 08:04:38 -07:00
Alex Crichton d5cb12cad2 Roll back git2 a bit to fix tests 2014-08-26 22:33:06 -07:00
bors 09f5c4d0d4 auto merge of #444 : alexcrichton/cargo/issue-54, r=brson
This generates errors for malformed semver versions during the decoding process
rather than later in the convertion to a package id. This also cuts down on the
large number of derived traits to only what's necessary.

Closes #54
2014-08-27 02:51:45 +00:00
bors 445bd52c68 auto merge of #423 : alexcrichton/cargo/cargo-package, r=brson
This command will assemble the current package into a tarball ready for
uploading to the cargo registry. Currently no further verification is done
beyond packaging the local repository into a tarball, but in the future this
could execute other operations such as api stability tools.
2014-08-27 02:17:17 +00:00
Alex Crichton 69c16fc6c8 Implement cargo-package
This command will assemble the current package into a tarball ready for
uploading to the cargo registry. Currently no further verification is done
beyond packaging the local repository into a tarball, but in the future this
could execute other operations such as api stability tools.
2014-08-26 19:03:12 -07:00
Alex Crichton 1322a392eb Help debug a flaky windows test 2014-08-26 18:58:58 -07:00
Alex Crichton a658968135 Add a harness manifest option
This option is used to disable the --test flag to rustc for a test or benchmark
target in order to signal that the binary already knows how to run the testing
infrastructure.

The test/benchmark is still compiled and run as usual, and the exit code is
expected to reflect the result of the test/benchmark.

Closes #431
2014-08-26 18:51:47 -07:00
Alex Crichton 8cce8996be Remove all subcommand executables
This commit removes all distributed executables except for `cargo`. All
builtin subcommands are implemented through library calls, and the fallback
methods are retained to maintain extensability through new subcommands.

Closes #393
2014-08-26 18:25:28 -07:00
bors b750ef2b51 auto merge of #421 : alexcrichton/cargo/issue-418, r=wycats 2014-08-27 01:13:22 +00:00
Alex Crichton 92eed92a24 Fix cargo run for renamed bin targets 2014-08-26 17:57:01 -07:00
Alex Crichton 05bdddaa7b Add a --no-run option to cargo test
This allows tests to be built, but not run.
2014-08-26 17:45:49 -07:00
Alex Crichton 5bc5439d1c Fix a flaky test while the compiler is changing 2014-08-26 17:21:45 -07:00
Björn Steinbrink 1804feedcb Fix building with current rust 2014-08-26 20:55:39 +02:00
Alex Crichton eebbfa0286 Decode directly into a semver::Version
This generates errors for malformed semver versions during the decoding process
rather than later in the convertion to a package id. This also cuts down on the
large number of derived traits to only what's necessary.

Closes #54
2014-08-26 08:47:02 -07:00
Corey Richardson 37eba45395 cargo-run: support target and release the same as cargo-build 2014-08-25 11:49:54 -04:00
Alex Crichton 9732133133 Add a new CARGO_MANIFEST_DIR environment variable
All subprocesses will now be invoked with CARGO_MANIFEST_DIR pointing at the
root of the source directory that they are working on (compiling). This commit
also reorganizes the version environment variables to use the new
infrastructure.

Closes #433
2014-08-25 05:48:51 -07:00
Alex Crichton 2ead380f76 Fix doc tests for libs with deps
The movement of tests to the main `target` directory forgot to update a spot
where rustdoc used a -L flag.
2014-08-19 13:13:13 -07:00
Tim Carey-Smith 2c12269e20 Syncs submodules after remote update (closes #370)
Previously, the Git code avoided cloning a local copy of the local
database for a repository if the repo already existed (and instead tried
to fetch). However, fetching does not sync and reinitialize submodules,
which would require more work.

To avoid this problem, and possibly other subtle updating issues in the
future, the code now wipes the local clone whenever it detects that the
HEAD of a particular branch has changed. This avoids subtle
inconsistencies between fresh clones and updates.

Note: This only affects local-to-local clones. It does not initiate any
new network activity. It may require some additional disk usage, but
only when a remote fetch that was already happening discovers new
commits on the checked-out branch.
2014-08-19 09:10:15 -07:00
Alex Crichton fff5de375a Make a timing test a little less flaky 2014-08-18 23:47:57 -07:00
Alex Crichton ae1962d759 Allow updating transitive deps
Previously `cargo update foo` would only update the package `foo` if it were a
direct dependency of the local package. This meant that to update a transitive
dependency you would have to update the top-level dependency.

This commit adds the ability to update any dependency by name, regardless of
where it is in the dependency graph. This commit is a bit lossy in terms of
behavior. We are guaranteed that the set of immediate dependencies for any one
package have unique names, but not for the entire package graph. This means that
when you invoke `cargo update foo` it could possibly update two packages named
`foo`.

I believe this behavior to be acceptable for now and we can add a more stringent
update syntax later (something like `cargo update --namespace foo bar`). I
believe we'll always want this CLI usage, however.
2014-08-18 23:43:27 -07:00
Alex Crichton a216b9f7cd Preserve $OUT_DIR across rebuilds
The original choice for completely destroying $OUT_DIR was to focus on
repeatable builds to ensure that stale items in $OUT_DIR don't affect later
compilations. This commit moves this responsibility from cargo to the build
command itself.

Build commands are now responsible for cleaning out old artifacts and ensuring
that when invoked the state of $OUT_DIR is as it would be if it started with an
empty $OUT_DIR. This will allow for very long build commands based on `make` to
have a much faster incremental build time as they won't have to rebuild
everything when updated.

This can cause non-repeatable builds with build commands if stale artifacts are
never removed (but still used in the rust compilation step), but this will now
be considered a bug in the build command rather than for cargo itself.

Closes #382
2014-08-18 23:43:27 -07:00
Alex Crichton 0e8f8d50aa Add an exclude key to the manifest
This key is used to help determine the set of input files for a package. The
normal method (via walking or git ls-files) is filtered via all the patterns
provided in `exclude` of the project section.

The toml key is a string array corresponding to a set of glob patterns according
to the syntax of libglob (provided in the standard distribution). The set of
files normally found will be filtered by each pattern, and if any pattern
matches then the path is excluded.

This will later on be used for `cargo package` when generating a tarball to get
uploaded.
2014-08-18 23:43:27 -07:00
Alex Crichton 8a19eb7437 Factor in .gitignore for build cmd freshness
When testing the freshness of a build command, the fingerprint of an entire
package is generated. The current method of fingerprinting a path source is to
just stat() the entire tree and look at mtimes. This works fine when the build
command places *all* output in the build directory.

Some systems, like autotools, place *most* output in the build directory and
some output in the source directory, however (see spidermonkey). In this case
the coarse-grained "consider all files in a directory as input" is too painful
for the build command as the package will forever be rebuilt.

This commit adds support for filtering the list of files in a directory
considered to be part of a package by using `git ls-files`. This git-specific
logic can be extended to other VCSs when cargo grows support for them.

Closes #379
2014-08-18 23:43:27 -07:00
Alex Crichton 37538a13ac Don't build docs/tests into separate dirs
This commit changes the hash of Profile to only take into account
flags/variables that affect the actual output file itself (as opposed to its
location), and then changes cargo {test, build, doc} to all use the same
directory of output (in order to share deps).

This will cause a `cargo build` to remove all of the tests generated by `cargo
test`, but it speeds up the cycle of `cargo test` followed by a `cargo build` by
not needing to rebuild all dependencies.

Additionally, `cargo bench` now shares the same directory as
`cargo build --release` for the same reasons as above.

Closes #348
2014-08-18 23:16:13 -07:00
bors 6a55dc850b auto merge of #389 : alexcrichton/cargo/dev-dependency-lockfile, r=wycats
Previously an invocation of `cargo build` would generate a lockfile *without*
dev dependencies, but an invocation of `cargo test` would generate a lockfile
*with* dependencies. This causes odd problems and diffs with the lockfile.

This commit switches the resolve-to-be-a-lockfile to using all dependencies of a
package, while the resolve-to-be-compiled continues to use just the dependencies
needed for the current build.
2014-08-19 05:56:43 +00:00
Alex Crichton 9886f1cb74 More import renaming fallout 2014-08-18 22:00:50 -07:00
Brian Koropoff c6f0d28323 Fix import shadowing errors in tests 2014-08-17 18:34:50 -07:00
Alex Crichton 8626fa725d Always generate a lockfile with dev-dependencies
Previously an invocation of `cargo build` would generate a lockfile *without*
dev dependencies, but an invocation of `cargo test` would generate a lockfile
*with* dependencies. This causes odd problems and diffs with the lockfile.

This commit switches the resolve-to-be-a-lockfile to using all dependencies of a
package, while the resolve-to-be-compiled continues to use just the dependencies
needed for the current build.
2014-08-16 22:38:32 -07:00
Alex Crichton 51de050e6c If --target is specified, pass that to build commands
0c834d7b accidentally broke this by favoring rustc's target triple over the
actual target triple.
2014-08-16 22:17:55 -07:00
Alex Crichton e090e2ad78 Run cargo off the main thread.
On windows the main thread suffers the same fate as rustdoc (as linked in the
comments), and hence needs to run off the main thread for now.
2014-08-16 16:16:32 -07:00
Alex Crichton 793134c2c4 Add submodule test from #381 2014-08-16 15:54:07 -07:00
Alex Crichton 1a985a5b73 Ensure TARGET is always present for build commands 2014-08-16 12:41:17 -07:00
bors 002bf7d080 auto merge of #369 : alexcrichton/cargo/issue-327, r=wycats
The syntax was originally chosen to perhaps allow multiple libraries in the future, but that is less and less likely to happen at this point. This commit deprecates the now-misleading `[[lib]]` in favor of `[lib]` to indicate that only one can be present.

This does not start allowing `[bin]` or `[example]` and such as I felt that it was too many ways to specify what's essentially the same thing. This also as a bonus allows a top-level `bin = []` to completely opt-out of binary inference (as well as for tests and examples).

Closes #327
2014-08-15 04:28:57 +00:00
bors 1206abdb61 auto merge of #378 : wycats/cargo/fix-git-issues, r=alexcrichton 2014-08-15 04:07:00 +00:00
Yehuda Katz + Carl Lerche abe2686caf Fix issues related to git updates
We observed that after updating the git repo in a test, unless we waited
for 1s, we got intermittent cases where a subsequent update of the git
source would not pick up the changes.

We observed this both with the git CLI and the branch using libgit2.
There may be a better solution, but we did not find it.
2014-08-14 17:05:01 -07:00
Erick Tryzelaar 251bc7dfd7 replace "\n\n" with real newlines in test output 2014-08-14 08:15:04 -07:00
Erick Tryzelaar 92e40c435b wip: Add cargo-bench, which runs benchmarks at --opt-level=3 2014-08-14 08:14:34 -07:00
Alex Crichton 22dfc52083 Deprecated [[lib]] in favor of [lib] 2014-08-13 23:10:16 -07:00
Alex Crichton e2720d2bfd Start accepting [lib], allow bin = []
This commit starts to accept `[lib]` as a single library per package. It also
allows opting-out of binaries/tests/examples with a top level `foo = []` rather
than taking an empty array to mean that inference should be enabled.

cc #327
2014-08-13 23:02:08 -07:00
Alex Crichton db3823a83f Fix the --list tests for windows 2014-08-11 21:22:29 -07:00
Alex Crichton 54066546b4 Fix a flaky test (due to hashes changing) 2014-08-10 22:08:57 -07:00
Alex Crichton d8dbe59a56 Merge commit 'xanxys/master' into fix-some-bugs 2014-08-10 22:07:15 -07:00
Alex Crichton cd7878eaad Add a configure option to disable cross-tests
The tests are enabled by default and must be opted out of.

Closes #346
2014-08-10 22:04:15 -07:00
Alex Crichton 6cbe947553 Don't always print an error on test failures
Only print a failure if the command didn't have an exit status. Also, clarify
the failure message in the case that an exit was detected but it was not a
successful status.

Closes #350
2014-08-10 21:49:46 -07:00
Alex Crichton b97ba98821 Don't pull in dev-deps for cargo build
Also don't pull them in for `cargo doc`, but continue to pull them in for
`cargo run` and `cargo test`.

Closes #351
2014-08-10 21:40:58 -07:00
Alex Crichton f187578d1f 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.

Closes #353
2014-08-10 21:28:19 -07:00
Alex Crichton ced04ffed3 Support --target with cargo test
Closes #356
2014-08-10 21:12:32 -07:00
Alex Crichton bf6400a882 Fix cargo clean when not in the root dir
Closes #361
2014-08-10 21:01:59 -07:00
Alex Crichton 9feca9d922 Fix updating git sources a new lockfile is committed
This is the actual fix for #345
2014-08-10 20:50:33 -07:00
xanxys a3f6a404be Add "--list" option to cargo, that shows lists of installed (sub)commands by searching
directories for executables with name cargo-*.
2014-08-09 14:37:50 +09:00
Alex Crichton a986938bfb Make sure version env vars are always present
They were accidentally left out of the `rustdoc --test` stage which caused
crates not to be able to be compiled.
2014-08-07 20:24:48 -07:00
Alex Crichton bf352dbea8 Verbosely say what's happening during doc tests
Or at least verbosely say when -v is provided.
2014-08-07 08:29:38 -07:00
Alex Crichton b83e939819 Fix --extern for doc tests for the local crate.
Closes #340
2014-08-07 08:29:32 -07:00
Alex Crichton 2b58d83a49 Don't match the output of the submodule test
Apparently really old versions of git ignore --quiet and print things anyway,
causing the test to fail on the linux buildbot.
2014-08-06 18:46:26 -07:00
Alex Crichton ef28cd2d97 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.
2014-08-06 18:46:23 -07:00
Alex Crichton 32e8db2d69 Update rust-url with a contained bugfix 2014-08-06 17:12:30 -07:00
Alex Crichton ac7141e1cd Unconditionally write Cargo.lock
Otherwise `cargo-update` ends up not doing much because all sources are
considered equal regardless of their precision.
2014-08-06 17:09:24 -07:00
Alex Crichton f51a2f9234 Remove the update_remotes flag entirely
This will inadvertently fix #337 as no lockfile will imply that all dependencies
are not precise, and will hence be fetched.
2014-08-06 17:09:24 -07:00
Alex Crichton e219167738 Remove Location, use Url everywhere
Now that rust-url supports windows paths in URLs, this commit jettisons the
janky Location enum in favor of just using Url everywhere.
2014-08-06 17:09:24 -07:00
bors a87c37bd79 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.

Closes #334
2014-08-06 23:57:54 +00:00
Alex Crichton 6a2a2c9580 Ensure env vars are set for cargo-doc
This erroneously used util::process instead of the custom process function in
the cargo_rustc module.
2014-08-06 13:21:16 -07:00
bors eebb219f6b auto merge of #329 : alexcrichton/cargo/fix-git-submodule, r=wycats
The fast path bypassed updating the submodule which wasn't correct if we were
the first checkout.
2014-08-06 19:34:04 +00:00
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
Alex Crichton 4d42cbd716 Fix submodules on the initial checkout
The fast path bypassed updating the submodule which wasn't correct if we were
the first checkout.
2014-08-05 22:26:38 -07:00
Alex Crichton 0484cd880e 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.
2014-08-05 10:46:12 -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
Alex Crichton b30892fc01 Use Path::display().to_string() less often
Unfortunately this cannot yet have a test for it as rustc itself does not work
if it is run on non-utf8 paths.
2014-07-21 19:34:17 -07:00
Alex Crichton 73049b3868 Move git macros to using arg() 2014-07-21 19:34:17 -07:00
Christoph Burgdorf c0d2b79ef1 kill unnecessary lifetime annotations
This commit removes lifetime annotations
that are now automatically inferred by
the compiler.
2014-07-22 00:08:06 +02:00
Yehuda Katz 51432d488a Improve test output 2014-07-21 12:23:01 -07:00
Yehuda Katz 4e6c3bd10a Improve error message on failed compile 2014-07-21 10:38:31 -07:00
bors 3a2a8205da auto merge of #222 : alexcrichton/cargo/no-cargo-toml-in-target, r=wycats
When cargo is building itself, it just ends up getting confused because the test
directory is in this location.
2014-07-21 15:59:39 +00:00
Brian Koropoff 895f541192 Add regression test for running cargo test twice 2014-07-20 17:33:08 -07:00
Alex Crichton 5e1c31d52d Don't look inside target/ for sub-packages
When cargo is building itself, it just ends up getting confused because the test
directory is in this location.
2014-07-19 21:50:53 -07:00
Alex Crichton c2b23512d5 House all native build output in a per-package dir
In order to ensure there are no stale artifacts as part of a build, this commit
houses all output of native build commands in their own directories. Each
directory is on a per-package basis, and the output is preserved if the package
is fresh or discarded if it is not.

This does not remove the DEPS_DIR environment variable, it just wires it to the
same value as OUT_DIR.
2014-07-18 18:04:47 -07:00
Alex Crichton 9f5d9b8166 Blow away all directories/files on each build
And aftewards selectively move them back into place if they're fresh. This
prevents stale files from showing up from old builds.

This currently breaks anyone build `build=` scripts, the fix is coming in the
next commit.

Closes #205
2014-07-18 15:56:16 -07:00
bors 7a2aa75414 auto merge of #212 : fhahn/cargo/version, r=alexcrichton
This PR adds a rustc style version command
2014-07-18 14:53:17 +00:00
Alex Crichton aaaf9dbf1e Update to master 2014-07-18 07:40:15 -07:00
Florian Hahn fc9825318f Add version command, closes #201 2014-07-18 14:42:26 +02:00
Florian Hahn c4710b74e7 Use indexing instead of get() function to access Vec 2014-07-17 22:27:02 +02:00
Alex Crichton 835e5ac1ac Fix inferred name of src/main.rs
The crate name should be the package name, not `main`.

Closes #207
2014-07-16 18:44:30 -07:00
Alex Crichton 3608fd4892 Update toml-rs
TOML recently grew multiline string literals as well as literal strings with no
escaping, which can be used instead of the hokey escape_path() function.
2014-07-16 08:08:55 -07:00
Alex Crichton 12af54e17a Allow configuratin ar/ld for rustc
This adds a new .cargo/config option which allows configuring the ar and linker
tools that rustc invokes. This should aid in any cross-compilation attempts.
2014-07-14 11:28:40 -07:00
bors 811d70d148 auto merge of #190 : alexcrichton/cargo/cargo-run, r=wycats
This currently only supports executing the `src/main.rs` convention, no other.

Close #149
2014-07-14 18:16:57 +00:00
Alex Crichton a64b9073f4 Add a cargo run command
This currently only supports executing the `src/main.rs` convention, no other.

Close #149
2014-07-14 06:40:51 -07:00
Alex Crichton 8defed6160 Pass all formats via --extern for libs
While we support the `crate_type` key in the manifest, we need to pass through
all crate types to the `--extern` flag.

Closes #177
2014-07-13 11:33:11 -07:00
bors ec0895b460 auto merge of #188 : huonw/cargo/remove-src-test, r=wycats
It's not unreasonable to have unittests in a separate submodule of the
crate (being called `test` or `tests`), and having them in their own
file can be very sensible. Thus, the `src/test.rs` implicit default is
likely to trip up some perfectly reasonable use-cases. There's already
the `tests/...` default, so repairing a codebase after this removal is
just moving `src/test.rs` to `tests/whatever_name_you_want.rs`.

Closes #187.
2014-07-13 15:48:50 +00:00
Huon Wilson 22c254af74 Remove the src/test.rs implicit test.
It's not unreasonable to have unittests in a separate submodule of the
crate (being called `test` or `tests`), and having them in their own
file can be very sensible. Thus, the `src/test.rs` implicit default is
likely to trip up some perfectly reasonable use-cases. There's already
the `tests/...` default, so repairing a codebase after this removal is
just moving `src/test.rs` to `tests/whatever_name_you_want.rs`.

Closes #187.
2014-07-13 22:48:45 +10:00
bors 2f60ba328b auto merge of #180 : sfackler/cargo/ndebug, r=wycats
This will disable debug!() and debug_assert!() statements.
2014-07-13 05:44:50 +00:00
Steven Fackler a12a909c04 Pass --cfg ndebug when debug = false
This will disable debug!() and debug_assert!() statements.
2014-07-12 20:46:11 -07:00
Alex Crichton a70be72342 Pass through extra arguments to cargo test
This allows `cargo test` usage to filter test being run, use --nocapture, etc.
2014-07-12 20:29:51 -07:00
bors 9d13d8a184 auto merge of #170 : alexcrichton/cargo/same-name, r=wycats
This allows the dependency queue to properly handle packages with the same
name but from different sources.

A test was added which exercieses this functionality by depending on two
different revs of the same git repo.
2014-07-12 03:59:51 +00:00
Alex Crichton f6d22b64b9 Use PackageId in the DependencyQueue
This allows the dependency queue to properly handle packages with the same
name but from different sources.

A test was added which exercieses this functionality by depending on two
different revs of the same git repo.
2014-07-11 14:20:24 -07:00
Ben Longbons 2e90972004 Do not run examples during 'cargo test' 2014-07-11 13:41:26 -07:00
Ben Longbons b7379e51b4 Add support for external tests 2014-07-11 13:41:26 -07:00
Ben Longbons 246c9e2a55 Add support for examples 2014-07-11 13:41:26 -07:00
Alex Crichton ff19a48290 Finish plugin support
This commit implements full support for plugins by answering the question of
whether any target needed as a plugin or needed as a target dependency. This
commit builds on the previous abstractions to enable parallel compilation
wherever possible.
2014-07-11 12:20:25 -07:00
Alex Crichton 685f2b4ee7 Add some simple tests for cross compilation 2014-07-11 09:08:51 -07:00
Alex Crichton 662b8553d6 Fix some tests 2014-07-10 12:51:13 -07:00
Alex Crichton 16df1ab41e Tighten up some tests 2014-07-10 12:08:13 -07:00
Alex Crichton d29910068c Fix filtering for test deps
This fixes `cargo test` to only test the *local* package
2014-07-10 11:50:03 -07:00
Michael Gehring 139e81ea82 ToStr::to_str -> ToString::to_string
Conflicts:
	src/cargo/core/resolver.rs
	src/cargo/ops/cargo_rustc.rs
2014-07-10 08:37:57 -07:00
Yehuda Katz 215ae2f9a1 Remove hardcoding 2014-07-10 01:26:51 -07:00
Yehuda Katz 7eb5ea543d Fixed a number of bugs related to rustc building
Most notably, `resolve` now takes the root, so it can properly link the
root package with its dependencies (which is required to build the
--externs for the root package).
2014-07-10 00:27:40 -07:00
Yehuda Katz + Carl Lerche e143491356 Resolve more correctly and add --extern
This commit adds support for passing --extern to dependencies. It allows
multiple copies of the same named dependency in the system, as long as
they come from different repos.
2014-07-09 20:17:08 -07:00
Alex Crichton 558e75347e Fix --release not compiling upstream deps with -O3
This touches up the filtering logic to ensure that upstream dependencies as well
as local dependencies are built with optimizations when `cargo build --release`
is used.
2014-07-09 13:55:00 -07:00
Alex Crichton 3550dd5040 Fix testing bins with lib deps
If a package had both bin and lib deps, `cargo test` was not building the `lib`
dependency when building the bins with `--test`. This commit adds an extra
"test" profile (not compiled with --test) for situations such as this which is
filtered out normally but kept around for the `cargo test` case.
2014-07-09 13:08:44 -07:00
Yehuda Katz + Carl Lerche 59bc9adb29 Refactor PackageId.namespace -> source_id 2014-07-08 14:58:56 -07:00
Joshua DeSeno 0025dbde64 cargo clean. resolves #51 2014-07-08 21:54:15 +09:00
bors a6061db0d0 auto merge of #142 : rust-lang/cargo/new-names, r=alexcrichton
This PR moves Cargo over to the new naming based on [RFC 35](https://github.com/rust-lang/rfcs/blob/master/complete/0035-remove-crate-id.md).

* You should no longer use `#[crate_name]` or `#[crate_id]` in any crate managed by Cargo.
* You no longer need a `[[lib]]` section in your `Cargo.toml` if you name your library `src/lib.rs`.
* You no longer need a `[[bin]]` section in your `Cargo.toml` if you name your library `src/main.rs`.
* You can include multiple `[[bins]]` in `src/bin/*.rs` and Cargo will treat them as if they were specified via `[[bin]]`.

This commit does not yet add support for `-C metadata` or `-C extra-file-name`, but that is coming soon.
2014-07-08 06:14:56 +00:00
Yehuda Katz + Carl Lerche ee1a81a801 This updates Cargo for #[crate_name] 2014-07-07 21:42:34 -07:00
Alex Crichton 03ccdd8169 Warn about missing [[lib]] and [[bin]] sections
Closes #120
2014-07-07 20:59:47 -07:00
bors 6248ebe5b2 auto merge of #139 : tomjakubowski/cargo/fix-symlink-blowup, r=alexcrichton
Fingerprinting will fail at an `fs::stat()` call if there is a symlink in
a package's directory pointing to a non-existent file or directory.
This commit recovers from an `fs::stat(`) error on these bogus symlinks by
faking an mtime of 0, which should not affect the overall fingerprint.

Fix #135
2014-07-08 01:46:02 +00:00
Tom Jakubowski 94ba70881d Ignore the broken symlinks test on windows 2014-07-07 18:42:53 -07:00
Tom Jakubowski f488174208 fingerprint: Recover from fs::stat errors
Fingerprinting will fail at an fs::stat() call if there is a broken
symlink in a package's directory.  This commit recovers from fs::stat()
errors on broken symlinks by treating them as having mtime 0, which
should not affect the overall fingerprint.

Fix #135
2014-07-07 15:33:40 -07:00
bors d0ac39d40b auto merge of #140 : rust-lang/cargo/release, r=carllerche 2014-07-07 22:29:56 +00:00
Yehuda Katz + Carl Lerche a1980dc78b Add --release and related refactoring 2014-07-07 15:17:34 -07:00
Tomaka17 c545221c25 Support for multiple and cleaner build commands 2014-07-07 22:12:26 +02:00
Yehuda Katz + Carl Lerche 9cbb91ac06 Fix up dev-dependencies 2014-07-03 12:42:18 -07:00
Yehuda Katz + Carl Lerche 172cbefc3b Added [dev-dependencies] sections to Cargo.toml
If you put a dependency in [dev-dependencies], it will only be
used when building (or testing) your packages, not other packages that
depend on it.
2014-07-03 07:30:11 -07:00
Yehuda Katz ea3cb31cec Meta-packages 2014-06-30 18:36:27 -07:00
Alex Crichton 71e4252a90 Don't infinitely recurse on cyclic path deps
Instead, keep a table of what we've visited and halt recursion whenever we
re-visit a package.

Closes #77
2014-06-30 13:18:14 -07:00
bors aa8986ffc4 auto merge of #87 : alexcrichton/cargo/toml-warnings, r=wycats
Closes #27
2014-06-30 20:00:09 +00:00
Huon Wilson c0865e85e3 Check for the existence of Cargo.toml when reading packages.
Fixes #82.
2014-06-30 10:42:08 +10:00
Alex Crichton a2aa2bf938 Warn about unused TOML keys
Closes #27
2014-06-28 15:18:44 -07:00
Alex Crichton 0ccb2fa2e2 Use a custom rm_rf to paper over windows git funkiness 2014-06-28 12:28:36 -07:00
Arcterus 856f37091c Error out on ssh dependencies (fixes #55) 2014-06-26 21:41:06 -07:00
bors c919f2f646 auto merge of #70 : alexcrichton/cargo/buildbot, r=wycats
* The installation script was modified to recognize when its running on windows,
  as well as tweaking how it downloads and installs snapshots. The goal here was
  to make the script runnable on buildbot for mac/linux/windows with 32/64 bit
  options on mac/linux.

* The installation script now install rustc to `rustc/bin` in the local
  directory to have parallel builds on buildbot.

* The tests now store all their temporary state locally in the build directory
  to enable parallel builds on buildbot.

* A shell test is ignored which assumed the presence of a TTY output.
2014-06-27 03:36:24 +00:00
Alex Crichton ad19a31d9b Prepare for buildbot automation
* The installation script was modified to recognize when its running on windows,
  as well as tweaking how it downloads and installs snapshots. The goal here was
  to make the script runnable on buildbot for mac/linux/windows with 32/64 bit
  options on mac/linux.

* The installation script now install rustc to `rustc/bin` in the local
  directory to have parallel builds on buildbot.

* The tests now store all their temporary state locally in the build directory
  to enable parallel builds on buildbot.

* A shell test is ignored which assumed the presence of a TTY output.
2014-06-26 20:25:30 -07:00
Tim Carey-Smith 13eb123213 Add cargo test 2014-06-26 16:47:27 -07:00
Alex Crichton 8d5acdfc67 Don't recompile nested deps too frequently
When compiling a package with a nested dependency, any modification to the outer
package would trigger a recompilation of the inner package. This commit alters
the fingerprint() method to take a PackageId to query about the location of a
package and only lookup the files relevant to that package.

The dependency structure of a PathSource is now everything rooted at the
original Cargo.toml minus all subdirectories which contain a Cargo.toml
2014-06-25 15:21:43 -07:00
Alex Crichton c3ec9999cb Ignore \r in output matching
Windows occasionally has \r\n while everywhere else has \n. Instead of worrying
about the difference, just replace all instances of \r with nothing and rely on
matching against \n.
2014-06-25 11:15:04 -07:00
Alex Crichton 80a81334f6 Fix lots of windows tests
* Add a convenience method bin() for generating the name of a binary. On windows
  this remembers to append `.exe`.

* Stop executing relative paths to binaries and relying on PATH. This is
  suffering from rust-lang/rust#15149 and failing to spawn processes on windows.
  Additionally, this allows the tests to work with a pre-installed cargo becuase
  the freshly built executables are precisely specified.

* A new function, escape_path(), was added for tests. When generated source
  files with paths, this function needs to be called to properly escape the
  \-character that appears in windows path names. Without this function we would
  be generating invalid TOML and rust.
2014-06-25 11:15:04 -07:00
Alex Crichton 06d19011db Fix rm_rf on windows
Apparently git checkouts have objects in the database with permissions 444 which
need to be changed to something with a write permission before removal.
2014-06-25 11:12:56 -07:00
Alex Crichton 200398ef8f Disable terminal tests on windows
The windows terminal does not use terminfo and is much different, so these tests
will fail on windows or actually write to the console.
2014-06-25 11:12:56 -07:00
Huon Wilson 9514dafd0e Handle misformatted versions with a nicer error message. 2014-06-25 18:05:51 +10:00
Yehuda Katz c08f8f3026 Add support for branch/tag/rev options 2014-06-24 15:23:14 -07:00
Alex Crichton 352efa73b5 Work around \-characters on Windows for now 2014-06-23 22:42:10 -07:00
Yehuda Katz eb6b0d6281 Rename cargo-compile to cargo-build 2014-06-23 19:09:12 -07:00
Yehuda Katz 5919fa0dfc Only force update git if -u is passed
This will become moot once we have a lockfile, because we'll be able to
check whether the last rev we used is still available and skip fetching.
2014-06-23 18:54:13 -07:00
Yehuda Katz 860ca08ad2 Allow absent git version 2014-06-23 17:38:50 -07:00
Yehuda Katz 86b2a2a432 Support [package] or [project]
The plan is to free up [project] for simpler config plus output flags
like -O that don't make sense in packages.
2014-06-23 16:57:27 -07:00
Alex Crichton d4265ef2a0 Move from rust-toml to toml-rs
This commit should greatly improve all error messages related to decoding
Cargo.toml.
2014-06-23 11:38:53 -07:00
Alex Crichton 8901563c0b Fix a red test 2014-06-23 09:44:00 -07:00
Yehuda Katz 19bea0ad0c Thread the shell through more of the system 2014-06-21 22:22:56 -07:00
Yehuda Katz 687035657d Terminal colors 2014-06-21 18:53:07 -07:00
Alex Crichton e05b4dc838 Don't rebuild dependencies if they haven't changed
This commit adds support for recognizing "fingerprints" of upstream
dependencies. When a dependency's fingerprint change, it must be rebuilt.
Currently the fingerprint unconditionally includes the version of the compiler
you're using as well as a specialized version depending on the type of source
you're compiling from:

  - git sources return their fingerprint as the current SHA. This will
    disregard any local changes.
  - path sources return their fingerprint as the maximum mtime of any file found
    at the location. This is a little too coarse and may rebuild packages too
    often (due to sub-packages), but this should get the job done for now.

When executing `cargo compile`, dependencies are not rebuilt if their
fingerprint remained constant.
2014-06-19 21:55:37 -07:00
Alex Crichton bc1dea82c8 Invoke rustc only once for multiple crate types 2014-06-19 19:44:45 -07:00
Alex Crichton 64ff29ff86 Update to rust style guidelines
* 80 char line limit highly recommended
* /// and //! for doc comments
2014-06-19 17:02:21 -07:00
Alex Crichton a9d8d2c62a Run tests in parallel
Give each test is own root inside of the shared root to ensure that the tests
are still isolated from one another.
2014-06-19 11:52:51 -07:00
Alex Crichton fbfa8bdeca Make CARGO_BIN_PATH optional for tests
This allows easier use of running tests by hand.
2014-06-19 11:52:51 -07:00
Alex Crichton 3433a01eba Allow custom precompile commands
This commit enables support for custom precompilation commands to be triggered
before a package builds via rustc. The current interface is to have
`build = "foo"` in the `[project]` section of Cargo.toml and cargo will just
execute the exact command given.
2014-06-19 11:52:51 -07:00
Yehuda Katz 8c72add4f5 Squelch warnings and minor cleanup 2014-06-19 01:21:24 -07:00
Yehuda Katz 3e09f70259 Initial pass at boxed errors
The next step is to clean up the error handling in general so that
failure cases produce good errors.
2014-06-19 00:57:12 -07:00
Yehuda Katz + Carl Lerche bcf9028749 Support nested paths in git and path sources 2014-06-17 17:40:22 -07:00
Yehuda Katz + Carl Lerche 9224a5ae61 Paths nested in paths 2014-06-17 17:05:29 -07:00
Carl Lerche + Yehuda Katz 512ec4b794 Fix tests 2014-06-13 14:19:06 -07:00
Carl Lerche + Yehuda Katz 35e21c7600 Smoke test for git support 2014-06-12 15:51:16 -07:00
Yehuda Katz + Carl Lerche 51c9cf0f87 Sources are now an array 2014-06-11 15:59:18 -07:00
Yehuda Katz + Carl Lerche c57fef459a Add namespace to PackageId 2014-06-11 14:51:13 -07:00
Yehuda Katz + Carl Lerche 1124727c96 Update to Rust master and eliminate warnings 2014-06-10 12:32:23 -07:00
Yehuda Katz + Carl Lerche 92602f6db0 Add support for detailed manifest dependencies
This commit supports the following format:

```toml
[dependencies.hamcrest]

version = "1.0"
git = "http://github.com/carllerche/hamcrest-rust"
```
2014-06-09 17:51:53 -07:00
Yehuda Katz + Carl Lerche 9a1c63ea17 Track master for tests 2014-06-09 13:08:09 -07:00
Yehuda Katz 41b6f52681 Tests passing again 2014-05-29 14:31:09 -07:00
Yehuda Katz e42203f7f6 Up to date with master 2014-05-29 14:06:43 -07:00
Yehuda Katz edbe491003 Up to date with master 2014-05-29 13:57:31 -07:00
Carl Lerche a06fd2e7fa Compile all deps into the root projects target dir 2014-05-28 17:31:23 -07:00
Yehuda Katz d5a7bc33d2 Improve shell and add tests 2014-05-27 18:53:37 -07:00
Yehuda Katz 574829e9f7 Initial pass at a Shell 2014-05-27 18:53:37 -07:00
Carl Lerche 7e6433feda Track rust master 2014-05-27 16:14:34 -07:00
Yehuda Katz 21322f07b4 Wrote more integration tests for cargo compile
At the moment, the rustc exec for the root project inherits the stdout
and stderr FDs (so that warnings and errors flow through), but
output from dependencies is only emitted if the compilation fails to
avoid warning noise from dependencies.
2014-05-12 17:33:13 -07:00
Yehuda Katz b8621c5042 More tests for error cases in compile
Also some refactoring of the error structure. More cleanup work around
human-readable and CLI errors is still required.
2014-05-09 16:57:13 -07:00
Yehuda Katz 7983a5fd16 Clean up process DSL in tests 2014-05-08 17:50:58 -07:00
Yehuda Katz 48dc081419 Get nested dependencies working 2014-05-08 16:50:53 -07:00
Yehuda Katz 23d78ddfb0 Support any bytes container 2014-05-08 16:50:52 -07:00
Yehuda Katz 682d4e94c8 Get compile test passing 2014-05-08 13:33:04 -07:00
Carl Lerche bafa5f2b5a Track Rust master changes 2014-05-08 13:10:08 -07:00
Carl Lerche 1ce7641593 Core struct refactor 2014-05-05 21:54:49 -07:00
Carl Lerche 8842b02cfd Cleanup ProcessBuilder, work towards getting tests passing 2014-05-05 16:28:01 -07:00
Yehuda Katz 85e4dccef2 Everything's compiling again 2014-04-29 11:05:01 -07:00
Carl Lerche f4d6d02135 Beginnings of a dependency resolver 2014-04-11 15:11:10 -07:00
Carl Lerche db92e67c87 Track rust master 2014-04-09 13:28:10 -07:00
Carl Lerche 79fe64158c Implement process hamcrest matcher 2014-04-02 16:34:19 -07:00
Carl Lerche 6899567bc3 Update tests against Rust master 2014-04-02 13:22:45 -07:00
Carl Lerche aec45be721 Cleanup integration test 2014-03-20 15:17:19 -07:00
Carl Lerche d1ec90b3d8 Initial stab at integration tests
At the same time, we started adding a generic error handling concept to
Cargo.

The idea is that every Result gets converted to a CargoError, which
includes all the information that Cargo needs to print out a friendly
human error message and exit gracefully.
2014-03-20 12:12:47 -07:00
Carlhuda 227d4e83ef Initial commit 2014-03-04 15:22:44 -08:00