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.
Alex Crichton [Tue, 22 Jul 2014 05:19:31 +0000 (22:19 -0700)]
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.
auto merge of #245 : alexcrichton/cargo/fix-fresh, r=wycats
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.
Alex Crichton [Tue, 22 Jul 2014 15:33:47 +0000 (08:33 -0700)]
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.
Alex Crichton [Tue, 22 Jul 2014 02:06:52 +0000 (19:06 -0700)]
Simplify the ProcessBuilder struct
This changes many bounds to ToCStr to stay in line with the since-introduced
Command structure. The builder remains separate of command to have control over
executing and Show.
Path-related methods have been removed and env-initialization/management are
left to Command, ProcessBuilder only keeps track of the delta.
auto merge of #224 : alexcrichton/cargo/canonical-hash, r=wycats
This should prevent some weird bugs where if you have slightly different sources that you occasionally have to recompile them when cargo switches between one or the other (thinking they're different)
auto merge of #216 : alexcrichton/cargo/issue-205, r=wycats
As discovered in #205, cargo wasn't properly ensuring a fresh build state for new builds. As commented in #205, this is an easy way to have a non deterministic build which is one of cargo's major goals to avoid. These commits rectify the situation.
All build output is now "obliterated" by moving to a location unknown to the compiler as soon as a build starts. All fresh output is moved back into place automatically, and all dirty output will only have known artifacts available to it.
The major consequence of this strategy is that the location of the output of the `build` command must also change. Instead of spraying into a shared directory, build commands are now contained to their own build directory which is entirely removed on rebuild or entirely preserved on a fresh build. There's more documentation in the new `layout.rs` about the build directory structure.
In general this should not have much impact as a user-facing change.
Alex Crichton [Fri, 18 Jul 2014 03:50:16 +0000 (20:50 -0700)]
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.
auto merge of #217 : gchp/cargo/docs, r=alexcrichton
There were inconsistencies in the manifest file between using `[[bin]]` and `[[executable]]`. I've changed the examples to use `[[bin]]` for consistency.
auto merge of #206 : alexcrichton/cargo/update-toml, r=wycats
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.
Alex Crichton [Wed, 16 Jul 2014 15:08:55 +0000 (08:08 -0700)]
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.
auto merge of #202 : fhahn/cargo/master, r=alexcrichton
Currently it seems like the `DESTDIR` option is ignored during the build process. This poses problems when packaging `rustc`, because it always tries to use `/` as a base path of the prefix. When packaging cargo for Arch Linux, everything should be installed into a separate directory, which content is used to create the package archive. At the moment this step requires `sudo`, which is discouraged in PKGBUILDs. Now, `make install DESTDIR=foo` prepends `DESTDIR` to all relevant paths during installation.
This probably could be archived using `install --prefix=foo/usr/` as well, but the convention to separate prefix and destdir is rather common
Alex Crichton [Mon, 14 Jul 2014 17:57:04 +0000 (10:57 -0700)]
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.
auto merge of #195 : alexcrichton/cargo/install, r=wycats
This updates the `make install` target and adds a new `make dist` target which
will prepare a distributable tarball with an install script. All work is based
off the equivalent rust nightly tarball and nightly installation scripts.
Alex Crichton [Mon, 14 Jul 2014 15:06:14 +0000 (08:06 -0700)]
Add an installation script to the repo
This updates the `make install` target and adds a new `make dist` target which
will prepare a distributable tarball with an install script. All work is based
off the equivalent rust nightly tarball and nightly installation scripts.
auto merge of #176 : cburgdorf/cargo/docs_1, r=alexcrichton
I was chasing the `cargo clean` command it's way down to get a better understanding of the inner workings of cargo. Those minor documentation changes and variable renaming are the outcome which I think make the code base just a tiny bit more welcoming :)
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`.
Huon Wilson [Sun, 13 Jul 2014 12:45:26 +0000 (22:45 +1000)]
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`.
auto merge of #163 : o11c/cargo/examples, r=wycats
This add support for `examples/*.rs` being built (as normal bin crates) during `cargo test`,
and `src/test.rs` and `tests/*.rs` being built and run (as test crates) during `cargo test`.
auto merge of #169 : cburgdorf/cargo/name_clean, r=alexcrichton
There are other unnamed commands like `verify-project` but I'm unsure if they are **not** listed on purpose because they should be used directly by the user less frequently. However, the clean command seems like a command that should be listed here.
Not sure about the wording though. It could be more abstract like *remove build artifacts* but given it's current behavior I think *remove target directory* is somehow straight forward, too.
Alex Crichton [Fri, 11 Jul 2014 18:22:07 +0000 (11:22 -0700)]
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.
Alex Crichton [Fri, 11 Jul 2014 14:50:24 +0000 (07:50 -0700)]
Improve intra-target parallelism
With cross compilation soon on the horizon, it may be required to build a
library for both the host and target architectures. These two copies can
certainly be built in parallel. Additionally, all binaries produced by a package
can also be built in parallel, but are currently forced to be built
sequentially.
This commit improves this parallelism by allowing each job to create more work
before the package is considered built. Only after all targets have been built
is the new fingerprint written.