From a5c9ac2e95ef23fd82cdca6e9bc2398fd6a00256 Mon Sep 17 00:00:00 2001 From: chrysn Date: Wed, 20 Mar 2024 19:40:20 +1000 Subject: [PATCH] rust: Make dependencies visible The Cargo.lock of rust_riotmodules_standalone should explicitly list all versions of software that would ever be pulled in by enabling RIOT modules backed by a Rust crate. That way, the Cargo.lock file will not spontaneously change because the software is being built with a different set of modules enabled. This did not happen before, because while the optional dependencies could all be selected on the command line, they were not visible as possible features to `cargo update`, and were thus not encoded in the Cargo.lock file. --- sys/rust_riotmodules/Cargo.toml | 5 ++++ sys/rust_riotmodules_standalone/Cargo.lock | 30 ++++++++++++++++++++++ sys/rust_riotmodules_standalone/Cargo.toml | 8 ++++++ 3 files changed, 43 insertions(+) diff --git a/sys/rust_riotmodules/Cargo.toml b/sys/rust_riotmodules/Cargo.toml index 45fe52acbee1..b8de794176de 100644 --- a/sys/rust_riotmodules/Cargo.toml +++ b/sys/rust_riotmodules/Cargo.toml @@ -12,3 +12,8 @@ publish = false riot-module-lsm303agr = { path = "../../drivers/lsm303agr", optional = true } riot-module-shell-democommands = { path = "../../sys/shell/democommands", optional = true } + +[features] +# This feature is just there so that rust_riotmodules_standalone can use its +# _all; see documentation there. +_all = [ "riot-module-lsm303agr", "riot-module-shell-democommands"] diff --git a/sys/rust_riotmodules_standalone/Cargo.lock b/sys/rust_riotmodules_standalone/Cargo.lock index de525237718f..17d47da24b22 100644 --- a/sys/rust_riotmodules_standalone/Cargo.lock +++ b/sys/rust_riotmodules_standalone/Cargo.lock @@ -413,6 +413,17 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "lsm303agr" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a03acd01d27c9ca96ba8205760673a23ba1914d85cc00e92a6a05963d5fe9b" +dependencies = [ + "bitflags 2.5.0", + "embedded-hal 1.0.0", + "nb 1.1.0", +] + [[package]] name = "memchr" version = "2.7.1" @@ -556,6 +567,21 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +[[package]] +name = "riot-module-lsm303agr" +version = "0.1.0" +dependencies = [ + "lsm303agr", + "riot-wrappers", +] + +[[package]] +name = "riot-module-shell-democommands" +version = "0.1.0" +dependencies = [ + "riot-wrappers", +] + [[package]] name = "riot-sys" version = "0.7.11" @@ -603,6 +629,10 @@ dependencies = [ [[package]] name = "rust_riotmodules" version = "0.1.0" +dependencies = [ + "riot-module-lsm303agr", + "riot-module-shell-democommands", +] [[package]] name = "rust_riotmodules_standalone" diff --git a/sys/rust_riotmodules_standalone/Cargo.toml b/sys/rust_riotmodules_standalone/Cargo.toml index b5077eb24d7a..61d31398738f 100644 --- a/sys/rust_riotmodules_standalone/Cargo.toml +++ b/sys/rust_riotmodules_standalone/Cargo.toml @@ -19,3 +19,11 @@ codegen-units = 1 riot-wrappers = { version = "0.8", features = [ "set_panic_handler" ] } rust_riotmodules = { path = "../rust_riotmodules" } + +[features] +# By having this explicit feature (comapred to what is enabled by the build +# system as `--features rust_riotmodules/foo`), all possible dependencies are +# visible to `cargo update` and in `Cargo.lock. This should not be enabled for +# compilation, as the modules behind it likely have their own RIOT modules they +# need enabled. +_all = [ "rust_riotmodules/_all" ]