Skip to content

Commit

Permalink
Allow writing Cargo.toml in project directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Nov 15, 2019
1 parent 4535b6b commit 83778cb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,6 @@ $ QEMU_STRACE=1 cross run --target aarch64-unknown-linux-gnu
work because `cross` use docker containers only mounts the Cargo project so
the container doesn't have access to the rest of the filesystem.

- `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.

## License

Licensed under either of
Expand Down
12 changes: 1 addition & 11 deletions src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,8 @@ pub fn run(target: &Target,
};
cmd.args(args);

// We create/regenerate the lockfile on the host system because the Docker
// container doesn't have write access to the root of the Cargo project
let cargo_toml = root.join("Cargo.toml");

let runner = None;

Command::new("cargo").args(&["fetch",
"--manifest-path",
&cargo_toml.display().to_string()])
.run(verbose)
.chain_err(|| "couldn't generate Cargo.lock")?;

let mut docker = docker_command("run")?;

if let Some(toml) = toml {
Expand Down Expand Up @@ -144,7 +134,7 @@ pub fn run(target: &Target,
.args(&["-v", &format!("{}:/cargo:Z", cargo_dir.display())])
// Prevent `bin` from being mounted inside the Docker container.
.args(&["-v", "/cargo/bin"])
.args(&["-v", &format!("{}:/project:Z,ro", root.display())])
.args(&["-v", &format!("{}:/project:Z", root.display())])
.args(&["-v", &format!("{}:/rust:Z,ro", sysroot.display())])
.args(&["-v", &format!("{}:/target:Z", target_dir.display())])
.args(&["-w", "/project"]);
Expand Down

0 comments on commit 83778cb

Please sign in to comment.