Unifying Task-Runner Discussion - Recommend cargo-make #491
Replies: 9 comments 11 replies
-
Cargo Make in practiceI've included a 1. Predefined tasks in
|
Beta Was this translation helpful? Give feedback.
-
The biggest concern i have here is adding a new dependency (xtask), and the associated learning curve to utilizing it. I can see the benefits of it, but i'm unsure if there are benefits to using it over generic a For the build/testing steps in the stacks-blockchain repo, I imagine a standard Makefile will be more than sufficient (i'm less concerned about watching a filesystem for changes here as well). Looking at the "cons" for using for xtask, again - i see the appeal, but is that the best option for what we need? on the sbtc repo side, it may have a very different answer than the stacks-blockchain side and that may be biasing my opinion. might be time to fork some repos and try these out in practice. I'm also a bit more interested in |
Beta Was this translation helpful? Give feedback.
-
When I get a chance I'll give creating a Makefile for these repos a shot, but I personally may not get to that for some time. If someone would like they could take a crack at it before I do. My final recommendation is Pros for xtask:
Cons for xtask:
|
Beta Was this translation helpful? Give feedback.
-
My 8 satoshis: |
Beta Was this translation helpful? Give feedback.
-
I've personally used cargo-make and enjoy it, and also chose it over XTask. It is more mature and has many useful features for cross-platform. The fact that cargo-make supports workspaces and sub-makefiles helps with larger projects. |
Beta Was this translation helpful? Give feedback.
-
I think this is a great idea. The stacks-blockchain repo could definitely benefit from this, as so many tasks are really defined in github actions or dockerfiles, but would benefit from being defined in a task runner that could be directly used in other contexts. I'd be much more in favor of something more along the lines of Both |
Beta Was this translation helpful? Give feedback.
-
Seconding @kantai. I'd prefer a Makefile. Just don't go overboard -- a task-runner's job is only to run tasks in the right order. It's not meant to be a programming language for said tasks :P |
Beta Was this translation helpful? Give feedback.
-
Have you considered about bazel (or similar build system)? |
Beta Was this translation helpful? Give feedback.
-
Final Decision: "Make"After much discussion, we've settled on using
|
Beta Was this translation helpful? Give feedback.
-
Workspace DevOps Script Choices - Final Choice Make
1. Introduction
1.1 Glossary
1.2 Purpose / Scope
This document compares three different task runners for rust projects and proposes that we utilize cargo-make consistently for each of our repositories. The core repositories to consider:
1.3 Why Add a Task Runner?
Consolidating our commands and scripts with the same task runner will have a few benefits:
By choosing a task runner and using it across all our repositories we will be able to unify the developers and integration pipeline designs across projects.
2. Recommendation - cargo-make
I recommend cargo-make because it's a simple framework designed for rust but can support arbitrary commands if needed. It is available anywhere where rust code can be compiled and is specified with a
toml
file, making it a seemless addition to the project workspace.It’s slightly less extensible than xtask but easier to maintain and faster to iterate on. It has domain specific features that reduce complexity over make.
3. Options
3.1 Cargo-make - github
Cargo-make is a task runner configured in a
toml
file with extra rust specific features.3.1.1 Example
3.1.2 Pros and Cons
3.1.2.1 Pros
3.1.2.2 Cons
3.2 XTask - github
Xtask is an idiomatic task runner design pattern to add free-form automation to a Rust project like make, npm run, or bespoke bash scripts. This is the most extensible option but has more overhead and can become complicated. It's really a program that we write ourselves, but with a recommended format.
3.2.1 Example
Repo with a pre-built Xtask package: https://github.com/jondot/xtaskops
3.2.2 Pros and Cons
3.2.2.1 Pros
3.2.2.2 Cons
3.3 Make - wikipedia
Make is the traditional task runner that comes with unix and unix-like operating systems. It is less integrated into the rust ecosystem than the previous two options but has history and flexibility.
3.3.1 Example
3.3.2 Pros and Cons
3.3.2.1 Pros
3.3.2.2 Cons
.sh
files which can be platform dependent4. Conclusion
I recommend that we use cargo-make as our task runner for all of our Rust projects. It is a simple, efficient, and well-integrated option that is suitable for large projects and can scale as our solutions scale, but there are other good options too. cargo-make won't restrict what we can do while still keeping our scripting simple
I'm happy to discuss different options but am hoping to come to a near consensus on approach by mid to late next week.
Beta Was this translation helpful? Give feedback.
All reactions