Commit graph

47 commits

Author SHA1 Message Date
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
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
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
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
Alex Crichton 22dfc52083 Deprecated [[lib]] in favor of [lib] 2014-08-13 23:10:16 -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
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 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
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
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 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 b7849f5457 Ensure update updates all shared deps 2014-08-01 10:39:11 -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
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
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 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
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 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 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
Yehuda Katz + Carl Lerche 59bc9adb29 Refactor PackageId.namespace -> source_id 2014-07-08 14:58:56 -07:00
Yehuda Katz + Carl Lerche a1980dc78b Add --release and related refactoring 2014-07-07 15:17:34 -07:00
Yehuda Katz ea3cb31cec Meta-packages 2014-06-30 18:36:27 -07:00
Arcterus 856f37091c Error out on ssh dependencies (fixes #55) 2014-06-26 21:41:06 -07:00
Tim Carey-Smith 13eb123213 Add cargo test 2014-06-26 16:47:27 -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
Yehuda Katz c08f8f3026 Add support for branch/tag/rev options 2014-06-24 15:23:14 -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
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
Yehuda Katz 19bea0ad0c Thread the shell through more of the system 2014-06-21 22:22:56 -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 64ff29ff86 Update to rust style guidelines
* 80 char line limit highly recommended
* /// and //! for doc comments
2014-06-19 17:02:21 -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
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