auxoncorp / cargo-5730 Goto Github PK
View Code? Open in Web Editor NEWA workaround for rust-lang/cargo#5730
License: MIT License
A workaround for rust-lang/cargo#5730
License: MIT License
To avoid having random build failures, I pin all my dependencies with Cargo.lock. In the old versions of cargo-5730 (before 38b0405) I could simply run cargo update
in the folder containing the build script crate, and it would generate a Cargo.lock that would get used when building/running the build script. But with the new strategy, there isn't a separate Cargo.toml
, and so we can't have a lockfile pinning the build dependencies.
This recently bit me when a build-dependency accidentally published a breaking change, making my builds fail. IMO, cargo-5730 should have an utility to generate a Cargo.workaround.lock
or something along those lines.
Attempting to cargo publish a library crate that uses this workaround fails:
$ cargo build warning: unused manifest key: workaround-build-dependencies
Finished dev [unoptimized + debuginfo] target(s) in 0.57s
$ cargo publish
Updating crates.io index
Packaging my-lib-crate v0.1.7 (/c/Users/User/Documents/my-lib-crate)
Verifying my-lib-crate v0.1.7 (/c/Users/User/Documents/my-lib-crate)
Compiling cargo-5730 v0.2.1
Compiling my-lib-crate v0.1.7 (/c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7)
error: failed to verify package tarball
Caused by:
failed to run custom build command for `my-lib-crate v0.1.7 (/c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7)`
Caused by:
process didn't exit successfully: `/c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7/target/debug/build/my-lib-crate-a7d79ce11b1f43d2/build-script-build` (exit code: 101)
--- stdout
Removing build crate staging dir: /tmp/build-script-599a12d2d076132272c3cd239122d9
--- stderr
Compiling workaround-build-script v0.1.0 (/tmp/build-script-599a12d2d076132272c3cd239122d9)
Running `CARGO_PKG_VERSION_PATCH=0 CARGO=/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo CARGO_PKG_VERSION=0.1.0 CARGO_PKG_HOMEPAGE= CARGO_PKG_NAME=workaround-build-script CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_AUTHORS='The cargo-5730 crate' CARGO_PKG_VERSION_PRE= LD_LIBRARY_PATH='/c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7/build-script-target/debug/deps:/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib' CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_DESCRIPTION= CARGO_MANIFEST_DIR=/tmp/build-script-599a12d2d076132272c3cd239122d9 CARGO_PKG_REPOSITORY= rustc --edition=2018 --crate-name workaround_build_script src/main.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=ed61adb261da6fa8 -C extra-filename=-ed61adb261da6fa8 --out-dir /c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7/build-script-target/debug/deps -C incremental=/c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7/build-script-target/debug/incremental -L dependency=/c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7/build-script-target/debug/deps --cfg workaround_build`
error[E0433]: failed to resolve: use of undeclared type or module `bindgen`
--> src/main.rs:21:20
|
21 | let bindings = bindgen::Builder::default()
| ^^^^^^^ use of undeclared type or module `bindgen`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.
error: Could not compile `workaround-build-script`.
Caused by:
process didn't exit successfully: `CARGO_PKG_VERSION_PATCH=0 CARGO=/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo CARGO_PKG_VERSION=0.1.0 CARGO_PKG_HOMEPAGE= CARGO_PKG_NAME=workaround-build-script CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_AUTHORS='The cargo-5730 crate' CARGO_PKG_VERSION_PRE= LD_LIBRARY_PATH='/c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7/build-script-target/debug/deps:/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib' CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_DESCRIPTION= CARGO_MANIFEST_DIR=/tmp/build-script-599a12d2d076132272c3cd239122d9 CARGO_PKG_REPOSITORY= rustc --edition=2018 --crate-name workaround_build_script src/main.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=ed61adb261da6fa8 -C extra-filename=-ed61adb261da6fa8 --out-dir /c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7/build-script-target/debug/deps -C incremental=/c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7/build-script-target/debug/incremental -L dependency=/c/Users/User/Documents/my-lib-crate/target/package/my-lib-crate-0.1.7/build-script-target/debug/deps --cfg workaround_build` (exit code: 1)
thread 'main' panicked at 'Failed to run compile build crate at /tmp/build-script-599a12d2d076132272c3cd239122d9 with Output {
status: ExitStatus(
ExitStatus(
25856,
),
),
stdout: "",
stderr: "",
}', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-5730-0.2.1/src/lib.rs:102:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.