cargo-screeps
cargo-screeps copied to clipboard
"cargo screeps deploy" triggers two builds if project has a library
This usually isn't a problem, but can be annoying if you're editing files in the middle of deploying a build. Even if it's just editing comments, the second "build" triggered will rebuild everything.
I believe this is due to us running cargo web build, which in turn builds all library and binary targets. It first builds the library defined in lib.rs, then the binary in main.rs - while we only really actually care about the binary, because that's what we're going to deploy.
An example of the output showing the two builds if I make changes during the first one:
$ cargo screeps build
cargo_screeps::run: compiling...
Compiling magnesium v0.1.0 (/home/daboross/Projects/Rust/magnesium)
Finished release [optimized + debuginfo] target(s) in 14.03s
Compiling magnesium v0.1.0 (/home/daboross/Projects/Rust/magnesium)
Finished release [optimized + debuginfo] target(s) in 20.94s
Processing "magnesium.wasm"...
Finished processing of "magnesium.wasm"!
cargo_screeps::run: compiled.
I believe changes are needed in cargo-web to fix this best. If they add a --bins flag, and we implement #14, then it would be possible to have cargo screeps deploy run the equivalent of cargo screeps build --bins, rather than cargo screeps build.