Skip to content

Workspace Makefile inheritance in members (CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true) not working #1207

Open
@tgrushka

Description

Describe The Bug

I am very confused by the README/docs on how to even achieve this.

Relative to workspace:
/Makefile.toml:

[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true

[tasks.workspacetask]
script = ["echo hello from workspace"]

/Cargo.toml:

[workspace]
resolver = "3"
members = [
    "member1"
]

/member1/Makefile.toml:

[tasks.membertask]
script = ["echo hello from member"]
cd member1
cargo make workspacetask
...
Task "workspacetask" not found
exit code 404

Confusing docs:

This allows you to maintaining a single makefile for the entire workspace but having access to those custom tasks in every member crate.

Right. Exactly what I want.

This is only relevant for workspace builds which are triggered in the workspace root.
Flows that start directly in the member crate, must manually extend the workspace level makefile using the extend keyword.

Huh? You just said I could access the workspace-level tasks inside members, and then said they have to start in the workspace root? "using the extend keyword" -- how??

To Reproduce

Try above example.

Error Stack

Task "workspacetask" not found
exit code 404

What I'm trying to do

I want to have a common task, e.g. coverage (no, couldn't override that one either, I want Tarpaulin with HTML, not XML, and in each member, not in the root, so had to set:

[config]
skip_core_tasks = true

to even get overriding that to work, else I got a Invalid task: coverage, contains multiple actions error -- different issue, but aggravates the frustration:

# [config]
# without: skip_core_tasks = true

[tasks.coverage]
command = "echo"
args = ["hello"]
cargo make coverage
[cargo-make] INFO - cargo make 0.37.23
[cargo-make] INFO - 
[cargo-make] INFO - Project: api
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: coverage
[cargo-make] INFO - Profile: development
[cargo-make] ERROR - Invalid task: coverage, contains multiple actions.
Task {
    clear: None,
    description: Some(
        "Runs coverage (by default using kcov).",
    ),
...

So I want a [tasks.coverage] in my workspace Makefile.toml that will just run the coverage relative to whatever member crate I'm in, only, without having to re-create that task in every Makefile.toml in every member.

CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true (without or with quotes around "true") has no effect.

What am I doing wrong? Can the docs be made more clear on this?

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions