Commit graph

652 commits

Author SHA1 Message Date
Alex Crichton c9e0863137 Revert "Use libgit2 for driving git instead of the CLI"
This reverts commit 3cd82ed7a1.

Conflicts:
	src/cargo/sources/git/utils.rs
2014-08-19 09:10:14 -07:00
bors cbb9207d75 auto merge of #384 : alexcrichton/cargo/issue-379, r=wycats
Mainly targeted at incremental build times.
2014-08-19 06:49:09 +00: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
bors 35c1975e8b auto merge of #401 : alexcrichton/cargo/issue-348, r=wycats
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-19 06:32:54 +00: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
bors 9697847935 auto merge of #375 : wycats/cargo/doc-fewer-things, r=alexcrichton 2014-08-19 05:14:53 +00:00
bors 4c7fe13262 auto merge of #402 : alexcrichton/cargo/import-rename, r=alexcrichton 2014-08-19 05:02:35 +00:00
Alex Crichton 9886f1cb74 More import renaming fallout 2014-08-18 22:00:50 -07:00
bors cdaef90e4d auto merge of #399 : lucidd/cargo/master, r=alexcrichton 2014-08-19 00:14:11 +00:00
Kevin Walter c4d44eca50 Change all uses of use foo = bar to use bar as foo 2014-08-19 01:54:41 +02:00
bors bdf7a3e73e auto merge of #394 : colindean/cargo/fix-readme, r=alexcrichton
When a $ is present, it prevents someone from easily copying and pasting the whole block.
2014-08-18 16:14:13 +00:00
bors a30ebb3cfb auto merge of #395 : bkoropoff/cargo/import-shadow, r=alexcrichton
- Update toml-rs to version without import shadowing errors
- Fix some import shadowing errors in the tests
2014-08-18 04:44:14 +00:00
Brian Koropoff c6f0d28323 Fix import shadowing errors in tests 2014-08-17 18:34:50 -07:00
Brian Koropoff 15fbc117cf Upgrade to latest toml-rs
This version has a fix for an import shadowing error
2014-08-17 18:33:51 -07:00
Colin Dean a39a331a38 Remove $ from lines in readme to improve copyability
When a $ is present, it prevents someone from easily copying and
pasting the whole block.
2014-08-17 19:02:04 -04: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
bors 4b9ca39778 auto merge of #388 : alexcrichton/cargo/fix-cross-builds, r=burningtree
0c834d7b accidentally broke this by favoring rustc's target triple over the
actual target triple.
2014-08-17 05:19:23 +00: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
bors 8a28cb3e39 auto merge of #367 : alexcrichton/cargo/git2-rs, r=wycats
In general relying on external programs is dicey and tricky as they're very
different across systems in both how they're used as well as what versions
you'll find. Instead of binding to the least common denominator of CLI, we can
code against an exact version of libgit2.

This introduces a build-time dependency on cmake which libgit2 requires to build
itself, which is unfortunate, but thankfully it's only a build time dep. The
build process for libgit2 also automatically detects as many system libraries as
possible to use (if available), falling back to bundled versions if not
available. I have currently not figured how to control this, so the link-config
package is used to build libgit2 which requires that pkg-config be installed to
build cargo as well.

Closes #138
2014-08-16 23:18:45 +00: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 ea3d601fe1 Register new snapshots 2014-08-16 15:54:07 -07:00
Alex Crichton 793134c2c4 Add submodule test from #381 2014-08-16 15:54:07 -07:00
Alex Crichton 230dbf6a59 Use libgit2 for driving git instead of the CLI
In general relying on external programs is dicey and tricky as they're very
different across systems in both how they're used as well as what versions
you'll find. Instead of binding to the least common denominator of CLI, we can
code against an exact version of libgit2.

This introduces a build-time dependency on cmake which libgit2 requires to build
itself, which is unfortunate, but thankfully it's only a build time dep. The
build process for libgit2 also automatically detects as many system libraries as
possible to use (if available), falling back to bundled versions if not
available. I have currently not figured how to control this, so the link-config
package is used to build libgit2 which requires that pkg-config be installed to
build cargo as well.

Closes #138
2014-08-16 15:54:07 -07:00
bors 3db8a3b1df auto merge of #386 : alexcrichton/cargo/target-always-present, r=wycats 2014-08-16 19:44:14 +00:00
Alex Crichton 1a985a5b73 Ensure TARGET is always present for build commands 2014-08-16 12:41:17 -07:00
bors 56d97718b6 auto merge of #372 : jauhien/cargo/master, r=alexcrichton
- splitn arguments order
- hasmap indexing

Closes #371
2014-08-16 18:01:25 +00:00
Alex Crichton c06f6fac94 static.rust-lang.org may be stale again? 2014-08-16 10:59:52 -07:00
Jauhien Piatlicki c6a9cc8d35 Fix code to be compilable with latest rustc:
- splitn arguments order

Closes #371
2014-08-15 16:33:31 +02:00
Alex Crichton 225ef027ce Move back to static.rust-lang.org
The mac bots have been fixed
2014-08-14 23:16:25 -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
bors a02a200f4f auto merge of #307 : erickt/cargo/bench, r=wycats
This adds initial support for benchmarking at `--opt-level=3` for cargo. It's run just like `cargo-test`, and can actually run tests at the higher optimization level with `cargo bench -- --test`.

One question I had though is if we should include the `-Zlto` for link time optimizations. I'm not sure how well supported that is. What do you all think?
2014-08-15 04:00:13 +00:00
bors 18dea51d41 auto merge of #366 : steveklabnik/cargo/get_to_subscript, r=alexcrichton
This fixes the build, which was broken due to the warnings.
2014-08-15 03:46:34 +00:00
Alex Crichton 775fe7fbfb Mac builder DNS is still stale, use S3 urls 2014-08-14 20:36:53 -07: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
Tim Carey-Smith d8450848fa Remove docs that shouldn't be built 2014-08-14 14:54:56 -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
Erick Tryzelaar 2052e5b70d replace .get() with .[] 2014-08-13 20:51:51 -07:00
Steve Klabnik 8dad784e34 .get() -> []
This fixes the build, which was broken due to the warnings.
2014-08-12 10:02:01 -04:00
bors 1b17bb0167 auto merge of #365 : alexcrichton/cargo/new-snapshots, r=alexcrichton 2014-08-12 06:54:26 +00:00
Alex Crichton bb96dd3f09 Register new snapshots 2014-08-11 23:53:02 -07:00
bors 29bf9ef00a auto merge of #363 : alexcrichton/cargo/fix-some-bugs, r=wycats
This also pulls in #316 to land everything at the same time. The major fix is "Fix updating git sources when a new lockfile is committed", and everything else was just issues that had accumulated over time. Once this has landed (may take some finesse), I'll make a new snapshot so cargo can actually start properly updating itself.
2014-08-12 04:31:21 +00:00