From 2153c25be3c32310916a3787f9a6f50eb60fba89 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 31 Jan 2022 13:16:09 +0800 Subject: [PATCH] it is so damn hard to get Rust to inject a relevant build time into a build Still not there....to get it reporting in a user-visible fashion I'm realizing I'm going to have to build a dedicated facility in Xous to track this because otherwise I have to trigger the automatic rebuild of a "heavy" program that would naturally encapsulate such information. Maybe for now, though, at least over the serial port I can get a somewhat relevant string??? --- services/shellchat/src/cmds/ver.rs | 8 ++++++-- xtask/Cargo.toml | 1 + xtask/build.rs | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/services/shellchat/src/cmds/ver.rs b/services/shellchat/src/cmds/ver.rs index 71e7d7fed..4c2ad15e5 100644 --- a/services/shellchat/src/cmds/ver.rs +++ b/services/shellchat/src/cmds/ver.rs @@ -36,8 +36,12 @@ impl<'a> ShellCmdApi<'a> for Ver { "dna" => { write!(ret, "SoC silicon DNA: 0x{:x}", env.llio.soc_dna().unwrap()).unwrap(); } - "xous" => { - write!(ret, "{}\n{}\n{}\n{}", + "shellchat" => { + // note that this only picks up new build info when shellchat is rebuilt + // we don't retrigger a shellchat rebuild every time we rebuild xous because it + // would make small builds take much longer. A fix to this would be to create + // a "version server" that is tiny, fast to re-link, and rebuilt on every build pass. + write!(ret, "Shellchat version info:\n{}\n{}\n{}\n{}", env!("VERGEN_SEMVER"), env!("VERGEN_BRANCH"), env!("VERGEN_SHA_SHORT"), diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index b11b2c3a1..6a2cabc65 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -15,3 +15,4 @@ zip = "0.5.13" [build-dependencies] vergen = "3.2.0" +filetime = "0.2.14" diff --git a/xtask/build.rs b/xtask/build.rs index 5431fe4c6..2bf9e25ed 100644 --- a/xtask/build.rs +++ b/xtask/build.rs @@ -6,4 +6,10 @@ fn main() { // Generate the 'cargo:' key output generate_cargo_keys(flags).expect("Unable to generate the cargo keys!"); + + // touch the log server to force it to pick up the version + let ts = filetime::FileTime::from_system_time(std::time::SystemTime::now()); + filetime::set_file_mtime("../services/log-server/src/main.rs", ts).unwrap(); + + // note that shellchat won't pick up the vesion, but because it's a big crate to rebuild we aren't re-triggering it }