Skip to content

Commit

Permalink
generate lockfile when necessary
Browse files Browse the repository at this point in the history
closes #37
  • Loading branch information
Jorge Aparicio committed Jan 4, 2017
1 parent e89dae4 commit 5d70947
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).

- Support for the `arm-unknown-linux-gnueabi` target

### Changed

- It's no longer necessary to call `cargo generate-lockfile` before using
`cross` as `cross` will now take care of creating a lockfile when necessary.

## [v0.1.3] - 2017-01-01

### Changed
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ it.
# Start the Docker daemon, if it's not already running
$ sudo systemctl start docker
# (ONCE PER CARGO PROJECT)
# `cross` can't generate .lock files itself (see caveats section)
# if compiling a library, we'll have to use Cargo to generate the lock file
$ cargo generate-lockfile
# MAGIC! This Just Works
$ cross build --target aarch64-unknown-linux-gnu
Expand Down Expand Up @@ -116,8 +111,6 @@ worst, "hang" (never terminate).
- `cross` will mount the Cargo project as READ ONLY. Thus, if any crate attempts
to modify its "source", the build will fail. Well behaved crates should only
ever write to `$OUT_DIR` and never modify `$CARGO_MANIFEST_DIR` though.
- This is the reason why `cross` can't generate .lock files and you have to
manually call `cargo generate-lockfile`.

- Versions `0.7.*` and older of the `openssl` crate are NOT supported. `cross`
supports `openssl` via the `OPENSSL_DIR` "feature", which seems to have been
Expand Down
3 changes: 0 additions & 3 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ main() {
https://github.com/rust-lang-nursery/compiler-builtins $td

pushd $td
cargo generate-lockfile
cross build --features c --target $TARGET
popd

Expand Down Expand Up @@ -73,7 +72,6 @@ main() {
$td

pushd $td
cargo generate-lockfile
cross test \
--no-default-features \
--target $TARGET
Expand All @@ -86,7 +84,6 @@ main() {
cargo init --bin --name hello $td

pushd $td
cargo generate-lockfile
cross run --target $TARGET
popd

Expand Down
10 changes: 10 additions & 0 deletions src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ pub fn run(target: Target,
Cow::from(format!("v{}", version))
};

let cargo_lock = cargo_root.join("Cargo.lock");
if !cargo_lock.exists() {
let cargo_toml = cargo_root.join("Cargo.toml");
Command::new("cargo").args(&["generate-lockfile",
"--manifest-path",
&cargo_toml.display().to_string()])
.run(verbose)
.chain_err(|| "couldn't generate Cargo.lock")?;
}

Command::new("docker")
.arg("run")
.arg("--rm")
Expand Down

0 comments on commit 5d70947

Please sign in to comment.