How to execute a task in all members + workspace root? #521
-
So my project structure is the following.
so my root [package]
name = "binary-name"
version = "0.1.0"
edition = "2018"
[workspace]
members = [
'member1',
'member2'
]
[dependencies]
member1 = {path = "./member1"}
member2 = {path = "./member2"} On my [env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
[tasks.lint]
script = '''
cargo fmt -- --emit=files
cargo clippy -- -D warnings
''' When I run |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
I came up with the following that works, but I'm 100% unsatisfied with... It is too verbose. [env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
[tasks.lint]
dependencies = ["lint-root", "lint-members"]
workspace = false
[tasks.lint-base]
script = '''
cargo fmt -- --emit=files
cargo clippy -- -D warnings
'''
[tasks.lint-members]
run_task = { name = "lint-base", fork = true }
[tasks.lint-root]
run_task = { name = "lint-base" }
workspace = false If there's a better way to do it please share. Otherwise I suggest to open an issue to make it easier to express this in a simpler way. It is interesting that the "default" tasks behaves as expected without any change: [tasks.test]
command = "cargo"
args = ["test", "--", "${@}"] When I run this on my setup it executes the tests in all members and then in the root directory. |
Beta Was this translation helpful? Give feedback.
I came up with the following that works, but I'm 100% unsatisfied with... It is too verbose.
If there's a better way to do it please share. Otherwise I suggest to open an issue to make it easier to express this in a simpler way.
It is interesting that the "default" tasks behaves as expected without any change: