Commit graph

245 commits

Author SHA1 Message Date
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 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