rustyscreeps / cargo-screeps

Build tool for deploying Rust WASM code to Screeps game servers
MIT License
25 stars 13 forks source link

"cargo screeps deploy" triggers two builds if project has a library #19

Closed daboross closed 1 year ago

daboross commented 5 years ago

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.

shanemadden commented 1 year ago

Resolved by #24 since we're no longer using cargo-web ;)