Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Pre/post build script via cargo
So a bit of googling basic questions has lead me to believe this is not possible with cargo.
I need to - as part of the cargo build process execute a command line before a build and/or after a build.
I really do not want to wrap Cargo with a shell script because IDEs that are "cargo friendly" - they won't execute my extra commands.
Examples include:
A) I am cross compiling to a arm64 linux target, I have to push the image to my test board via SSH and execute a command via SSH.
B) I have to create a "package" - ie: The executable needs to be digitally signed, and extra data files, etc - need to be package up.
C) My build process transforms large data files into binary data used by the application. If the source of those data files change - my script is smart enough to rebuild or skip generating the binary data files. But - I need those files updated as part of the build
D) In the embedded world part of the build process is creating a BINARY with extra features required by the boot loader on my board - I do this today with python
I coud list many other things - but doing this inside of 'build.rs' - seems very wrong headed.
To me, it would be as simple as:
[package]
pre_build= "some command line in a quoted string"
build = "build.rs"
post_build="another command line in a quoted string"
The rules would be very simple:
All CARGO build environment variables should available to the command
I am interested the "TARGET" and "HOST" variables so myself script can do the right thing.
Maybe this already exists - but RUST lacks the ability to google search for solutions that exist I say that because I can only find things where people learned: "Nope not supported"
Examples of others wanting this:
https://internals.rust-lang.org/t/a-list-of-commands-to-pre-configure-the-project/17492/11
https://stackoverflow.com/questions/66284221/can-i-perform-a-task-after-compilation-is-complete
https://www.reddit.com/r/rust/comments/zwttsl/run_python_scripts_before_compilation_using_cargo/
2 posts - 2 participants
🏷️ Rust_feed