nacardin / cargo-build-deps Goto Github PK
View Code? Open in Web Editor NEWA cargo subcommand to build dependencies, helps speed up docker builds by allowing dependencies to be built earlier and cached.
License: Apache License 2.0
A cargo subcommand to build dependencies, helps speed up docker builds by allowing dependencies to be built earlier and cached.
License: Apache License 2.0
error: Found argument '+nightly' which wasn't expected, or isn't valid in this context
USAGE:
cargo-build-deps [FLAGS] [build-deps]
If I do cargo new cargo-build-deps-fail-example
and then change the Cargo.toml
to:
[package]
name = "cargo-build-deps-fail-example"
version = "0.1.0"
edition = "2021"
[target.'cfg(target_env = "musl")'.dependencies]
tikv-jemallocator = "0.4.1"
these all work:
cargo run
cargo run --target=x86_64-unknown-linux-gnu
cargo run --target=x86_64-unknown-linux-musl
but these all fail:
cargo build-deps
cargo build-deps --target=x86_64-unknown-linux-gnu
cargo build-deps --target=x86_64-unknown-linux-musl
Adding --release
has no effect.
Changing [target.'cfg(target_env = "musl")'.dependencies]
to [target.'cfg(target_env = "gnu")'.dependencies]
causes all commands above to work. I'm executing this from Ubuntu (target_env = "gnu"
) so it seems to be affected not by the target but by the environment you're running it from.
Error with RUST_BACKTRACE=1
:
Updating crates.io index
building packages: ["tikv-jemallocator:0.4.1"]
building package: "tikv-jemallocator:0.4.1"
thread 'main' panicked at 'activated_features for invalid package: features did not find PackageId { name: "tikv-jemallocator", version: "0.4.1", source: "registry `crates-io`" } false
Stack backtrace:
0: <anyhow::Error>::msg::<alloc::string::String>
1: <cargo::core::resolver::features::ResolvedFeatures>::activated_features_int
2: cargo::ops::cargo_compile::generate_targets
3: cargo::ops::cargo_compile::create_bcx
4: cargo::ops::cargo_compile::compile_ws
5: cargo::ops::cargo_compile::compile
6: cargo::commands::build::exec
7: cargo::cli::execute_subcommand
8: cargo::cli::main
9: cargo::main
10: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
11: std::rt::lang_start::<()>::{closure#0}
12: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/core/src/ops/function.rs:259:13
13: std::panicking::try::do_call
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/std/src/panicking.rs:485:40
14: std::panicking::try
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/std/src/panicking.rs:449:19
15: std::panic::catch_unwind
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/std/src/panic.rs:136:14
16: std::rt::lang_start_internal::{{closure}}
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/std/src/rt.rs:128:48
17: std::panicking::try::do_call
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/std/src/panicking.rs:485:40
18: std::panicking::try
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/std/src/panicking.rs:449:19
19: std::panic::catch_unwind
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/std/src/panic.rs:136:14
20: std::rt::lang_start_internal
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/std/src/rt.rs:128:20
21: main
22: __libc_start_main
23: <unknown>', src/tools/cargo/src/cargo/core/resolver/features.rs:266:14
stack backtrace:
0: rust_begin_unwind
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/std/src/panicking.rs:577:5
1: core::panicking::panic_fmt
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/core/src/panicking.rs:135:14
2: core::result::unwrap_failed
at /rustc/08df8b81d6e723c66fee579d57d61dc60bc21fc1/library/core/src/result.rs:1737:5
3: cargo::ops::cargo_compile::generate_targets
4: cargo::ops::cargo_compile::create_bcx
5: cargo::ops::cargo_compile::compile_ws
6: cargo::ops::cargo_compile::compile
7: cargo::commands::build::exec
8: cargo::cli::execute_subcommand
9: cargo::cli::main
10: cargo::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Error: "Exited with status code: 101"
error: Found argument '--features' which wasn't expected, or isn't valid in this context
USAGE:
cargo-build-deps --release
For more information try --help
Running
cargo build-deps
cargo test
downloads and compiles the dependencies twice.
Hello,
I tried to use build-deps on a project I just cloned, and encountered the following error:
Updating webpki v0.21.3 -> v0.21.4
Removing webpki-roots v0.18.0
Removing webpki-roots v0.19.0
Adding webpki-roots v0.20.0
Adding webpki-roots v0.21.0
Updating wfd v0.1.4 -> v0.1.7
Adding which v3.1.1
Updating window_clipboard v0.1.2 -> v0.1.3
Updating xcursor v0.3.2 -> v0.3.3
Updating xkbcommon-sys v0.7.4 -> v0.7.5
thread 'main' panicked at 'failed to parse package', /home/noe/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-build-deps-0.1.5/src/main.rs:59:22
1.23.1 (3df2264a9 2020-11-30)
rustc 1.51.0-nightly (44e3daf5e 2020-12-31)
cargo 1.50.0-nightly (75d5d8cff 2020-12-22)
cargo-build-deps-0.1.5
git clone [email protected]:veloren/veloren.git
cd veloren && cargo build-deps
Is there something I'm doing wrong? Running a cargo build will work just fine.
Have a good day!
In main.rs
, there is a line
execute_command(Command::new("cargo").arg("update"))?;
this line forces a dependency update. The update may cause a lot of compilation and the user have no option to opt out if a reproducible build is desire. In a docker build process, this may invalidate cache.
This is the backtrace I got after running RUST_BACKTRACE=1 cargo-build-deps --release
Updating crates.io index
thread 'main' panicked at 'failed to parse version from depencency string', src/libcore/option.rs:1188:5
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:84
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:61
4: core::fmt::write
at src/libcore/fmt/mod.rs:1025
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1426
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:65
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:50
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:193
9: std::panicking::default_hook
at src/libstd/panicking.rs:210
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:471
11: rust_begin_unwind
at src/libstd/panicking.rs:375
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:84
13: core::option::expect_failed
at src/libcore/option.rs:1188
14: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
15: cargo_build_deps::main
16: std::rt::lang_start::{{closure}}
17: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:52
18: std::panicking::try::do_call
at src/libstd/panicking.rs:292
19: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:78
20: std::panicking::try
at src/libstd/panicking.rs:270
21: std::panic::catch_unwind
at src/libstd/panic.rs:394
22: std::rt::lang_start_internal
at src/libstd/rt.rs:51
23: main
24: __libc_start_main
25: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
This is my Cargo.toml
file
[package]
name = "junks"
version = "0.1.0"
authors = ["Palash Nigam <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
num = "0.2.1"
rand = "0.7.3"
regex = "1.3.4"
rustc-serialize = "0.3.24"
serde = "1.0.104"
this is useful for larger projects that have nested crates.
i think this will look something like the following:
i'll try and tackle this soon.
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.