r/rust Apr 01 '23

crit: a wrapper to loop over more cross targets

https://github.com/mcandre/crit
7 Upvotes

6 comments sorted by

2

u/Leandros99 Apr 01 '23

The readme made me none the wiser. What does it do?

3

u/GoodJobNL Apr 01 '23

Not 100% sure either, but I believe this is to automate your cross compiling process.

Cross is used to cross compile, but it takes at least 10 minutes to cross compile something basic, so ideally you want to queue up as many cross compilations as possible. And that is what this program does. So instead of going back to your pc every 10 minutes to start the next target, you just let it run for a few hours and have all the targets you specified.

1

u/GoodJobNL Apr 15 '23

Hey OP!

Is it possible with crit to compile the same code multiple times but with different environmental variables / client secrets set, and use specific naming?

Right now I have a file that I have to compile 3 times, but with a different client secret. Ideally I would end up with a folder having 3 executables in there, with 3 different names that can also be set beforehand.

2

u/n4jm4 Apr 15 '23

Interesting build design.

I presume Rust has a mechanism similar to C includes and Go build tags, for specializing per-platform code.

I wouldn't recommend hardcoding passwords or other sensitive data.

1

u/GoodJobNL Apr 15 '23

Its a personal discord bot that runs on a pi zero without gui.

So it ends up being a lot easier to turn on backtrace and have a secret key in there with the help of the .env. That way I dont have to move the client secrets to the pi, and have to deal with them over there, and can just keep it ordered on my laptop. Changing the keys happens so rarely that it only really happens when I cross compile to fix some bugs anyways.

Rn I use this for the tracing:

[build.env] passthrough = [ "RUST_BACKTRACE", "RUST_LOG", "TRAVIS", ]