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 f29f612 commit 181419d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,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
11 changes: 1 addition & 10 deletions src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,6 @@ 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");
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");

docker
Expand Down Expand Up @@ -155,7 +146,7 @@ pub fn run(target: &Target,
.args(&["-v", &format!("{}:/xargo:Z", xargo_dir.display())])
.args(&["-v", &format!("{}:/cargo:Z", cargo_dir.display())])
.args(&["-v", "/cargo/bin"]) // Prevent `bin` from being mounted inside the Docker container.
.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 181419d

Please sign in to comment.