buildfoundation / mainframer

Tool for remote builds. Sync project to remote machine, execute command, sync back.
Apache License 2.0
1.73k stars 162 forks source link

Moving config parsing to `serde` #272

Open ChristopherJMiller opened 2 years ago

ChristopherJMiller commented 2 years ago

I believe a lot of complexity could be removed by swapping config parsing from a manually process with yaml-rust to object deserialization with serde with it's derive feature and a supporting yaml deserializer.

The Intermediate types could be removed as the deserializer understands optional parameters. To handle defaults, the attributes on config can be made private and getters can be implemented that access self and unwrap to a default if they were not set. The mode "serial" or "parallel" can be mapped properly via the derive attribute macros on enums.

This could also ease the work involved with #265

Thoughts?

artem-zinnatullin commented 2 years ago

Sounds good, I'd like to get rid of intermediate_config stuff https://github.com/buildfoundation/mainframer/blob/dc6e11db04b4e14e72cc406aaafc874a1c24ba91/src/intermediate_config.rs#L16

Just make sure to keep config validation :)

artem-zinnatullin commented 2 years ago

Heads up: @ChristopherJMiller pls make sure you're on updated 3.x branch when you start working on this, I've merged quite a few infrastructure updates in last few days 😬

ChristopherJMiller commented 2 years ago

PR is up at #282 !