-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Q/FR: More than one command per job #147
Comments
Regarding running more than one command, a solution, depending on the need, might be to use For example:
With such configuration, hitting There's a problem with I'm not yet sure of what would be the best approach for you there. |
That's very helpful, thanks! I'll experiment a bit more, I'm becoming worried that something like #138 will become a problem if I run BTW, from the department of likely useless technical correction: I've seen |
Even before we get to mutating commands, I ran into the problem that the
I want the Also, a different I ran into as a part of this is that I entered |
It seems to be a subject that has been raised a few times in bacon, and I think that the core problem is that bacon is a single-task runner. Since @Canop re-opened #42, are you looking for a solution? If I may give my 2 cents, there are a few ways to approach the problem:
IMO, 2 is the more powerful option, but it might be a significant rework, and then the project will open itself to all the feature creeps of cargo-make. Where 1 might not be elegant, it is simple enough and might cover needs expressed until now. |
A problem is also that use cases aren't really clear, and I'd like to have clarified needs before looking for a solution. Can you interested people just write as concisely as possible your use case for a sequence of chained tasks in bacon ? |
My current need would be to test two specific features sets that are incompatible with each other. Here is a "wish it would work" toml as example [jobs.check-ssr]
command = [
"cargo",
"clippy",
"--features=ssr",
"--no-default-features",
"--color",
"always",
]
need_stdout = false
on_success = "job:check-hydrate"
[jobs.check-hydrate]
command = [
"cargo",
"clippy",
"--features=hydrate",
"--no-default-features",
"--color",
"always",
]
need_stdout = false
on_success = "job:previous"
The above loops endlessly This is my imagined solution [jobs.check-hydrate]
command = [
# args,*
]
need_stdout = false
on_change = "job:previous" essentially I am aware there are other build tools to do this, hundreds even. I find bacon to be an easier mental model to develop with. A split tmux pane is my current solution. Works, but would be nice if it could be condensed to one. Other build tools don't always produce in a format that bacon can parse and summarize. maybe I can look into a solution if pointed in the right direction within the repo? |
Your need could be seen as to have the warnings & errors of two different cargo executions merged into only one report, right ? |
Concisely yes, Just 1+ cargo commands in one report, redo on change Sorry to keep editing, I just realize there is a lot of nuance to the issue |
I know. That's why I don't rush to a "solution" but try to grasp the whole problem before. |
Let's have a look at the "depends of" logic and how it could be applied to bacon. Considering "C depends of A and B", I don't think we can support a pure make-like approach with C being run only when A and B are verified to be error or warning free. Because that would imply running A, B and C on every file change even if A and B were previously OK. This isn't going to be practical given that compilation times are already a common problem in Rust. For the same reason, I don't think it's a good idea to run several commands, wait for their results, and then display the combined result. This would be too slow in big projects. What I think would be best would be the ability to launch not just jobs but job sets (externally, they would be called jobs, no need to make the job set concept visible). Such a job set would be defined as a list of jobs [A, B, C]: [jobs.check-all-the-things]
jobs = ["chek", "clippy", "windows-check", "ssr-feature"] The execution of this job set would be like this:
It think this is the right approach:
Do you see use cases which wouldn't fit well with this approach. |
I think it is indeed the right solution; bacon is by design simple, and supporting a complete DAG like cargo-make seems overkill. This would fit all the usecases I currently see for myself, but attention must be taken for jobs that modify the src themselves ([cargo-fmt + autofix -> check -> clippy -> test -> run]) |
Unable to think of anything that wouldn't work with this idea (for myself at least). I would imagine anything beyond a set of jobs would be crossing over into a much more complex build system. I appreciate Bacon being open to a feature like this, it would certainly be a convenience more than a necessity. |
Thanks for
bacon
, it is very nice!I don't want to forget running
cargo fmt
, so I'd like my test job to be the equivalent ofcargo fmt && cargo nextest run
.(The actual command I want is
cargo fmt && cargo insta run --accept
, so both of these can mutate files in the repo).What's the best way to configure that? It seems like
commands
can currently only take one command.Currently, the first workaround that comes to my mind is to create a
cargo-run-fmt-and-nextest
shell script somewhere in my PATH and use it in my custom job. That's nice, but I think it'd be even nicer if I didn't need to.For example, the
commands
option could take either a list of strings or a list of lists of strings. There could be another option that determines whether the command chain is aborted if one of them fails.The text was updated successfully, but these errors were encountered: