You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project where we use xtask to handle building and publishing,
Now I want to create a different repository for a different project where my xtask logic will be almost one to one to the other project (modulo few features)
I wondered about best practices ideas on sharing xtask between repositories
(extracting logic to library and sharing that between the xtasks, moving the xtask to a third repository, duplicating all the logic, something more creative?)
The text was updated successfully, but these errors were encountered:
Good question! "extracting logic to library" is something I tried a while ago to share the common logic for building a crate and publishing it to crates.io: https://github.com/matklad/xaction.
However, I consider that to be a failed experiment and switched to "duplicating all logic" instead.
The main thing you loose when extracting a library is the ability to just look at the source code of xtask and understand what's going on, to see see the sequence of steps that constitute an xtask.
So my current advice would probably be:
duplicate the orchestrating parts of xtask. Things like CLI flags parsing should be duplciated across the repos. Similarly, if an xtask needs to run a command like cargo build, you probably want that invocation to be present verbatim in every repo, so that you can see "here we are doing cargo build".
for "meatier" parts of the task, do extract them to a reusable library. A litmus test here would probably be "can this be used outside of an xtask?". So, if, e.g., you are using an xtask to cook up a debian package, you probably want to have a debian packaging library or some such.
Coming back to that xaction example, the thing I wanted to duplicate there was essentially "run cargo test, run git tag, run cargo publish". But that is orchestration! The actual logic for doing all those things was already shared by virtue of being a part of git and cargo! It doesn't by you much to try to abstract just the sequence of commands.
I have a project where we use xtask to handle building and publishing,
Now I want to create a different repository for a different project where my xtask logic will be almost one to one to the other project (modulo few features)
I wondered about best practices ideas on sharing xtask between repositories
(extracting logic to library and sharing that between the xtasks, moving the xtask to a third repository, duplicating all the logic, something more creative?)
The text was updated successfully, but these errors were encountered: