LukeMathWalker / cargo-chef

A cargo-subcommand to speed up Rust Docker builds using Docker layer caching.
Apache License 2.0
1.72k stars 113 forks source link

Fails when package.version not set (Cargo 1.75+) #265

Closed markdingram closed 5 months ago

markdingram commented 5 months ago

Since Cargo 1.75 package.version is optional:

package.version field in Cargo.toml is now optional and defaults to 0.0.0. Packages without the package.version field cannot be published. https://github.com/rust-lang/cargo/pull/12786

https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-175-2023-12-28

Cargo Chef currently doesn't support this, failing with error:

#21 [clippy chef_prepare 3/6] RUN cargo chef prepare --recipe-path recipe.json
#21 0.273 Error: Failed to compute recipe
#21 0.273 
#21 0.273 Caused by:
#21 0.273     0: TOML parse error at line 1, column 1
#21 0.273          |
#21 0.273        1 | [package]
#21 0.273          | ^^^^^^^^^
#21 0.273        missing field `version`
#21 0.273        
#21 ERROR: process "/bin/sh -c cargo chef prepare --recipe-path recipe.json" did not complete successfully: exit code: 1

Looks like an update to https://github.com/LukeMathWalker/cargo-manifest will be required. Will raise a supporting PR there first.

LukeMathWalker commented 5 months ago

Fixed in https://github.com/LukeMathWalker/cargo-chef/commit/7d6adb0ca72174f4b5577ec45ba0d54467107eaf Thanks for the PR!

bouzuya commented 3 months ago

@LukeMathWalker When will this change be released to crates.io?

LukeMathWalker commented 3 months ago

Done now with 0.1.67!