Suggested setup/toolchain to build and deploy Rust project with additional resources

#1

Hello.

I use Rust quite a bit for small tools, often requiering me to put together a set of files and bundle them together.

Some examples:
A service that needs a local configuration file.

A Rust backend service tightly coupled to a web app developed with node/npm.

A cli tool that I want to ship with a folder with some sql scripts to run on the server to deploy to.

Now, what I do is that I write a Readme to remind me of what steps to do and what folders to include and copy to different folders after a build. There must be a better way :grinning:

Any best practices or suggestions?

One simple requirement:
I develop on mac and on windows, so I need something that will work on both systems (AFAIK that excludes PowerShell and shell scripts wothout having a lot af caveats).

#2

Cargo doesn’t have any capability for this.

There are some 3rd party tools that try to be portable task runners: cargo-make, cargo-script, cargo-release.

#3

OK, I’ve seen some pople use Make too, but I not too familiar with it. Any of the tools you listed that you would recommend?

#4

I found this solution that looks interesting: https://matklad.github.io/2018/01/03/make-your-own-make.html

#5

I realize I’m mainly talking to myself here, but inspired but the blog post I made this example: https://github.com/cfsamson/rust_buildscript

Maybe not ideal but it was fun and it works!

2 Likes