Skip to content
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

"CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY" does not behave as described in emulated workspace #434

Closed
connorkuehl opened this issue Jun 23, 2020 · 4 comments
Assignees
Labels
Milestone

Comments

@connorkuehl
Copy link

Describe the bug

The documentation describes this environment variable as the working directory of the workspace root:

CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY - The original working directory of the workspace. Enables workspace members access to the workspace level CARGO_MAKE_WORKING_DIRECTORY.

However, in an emulated workspace, this environment variable becomes the directory of the member crate.

In a non-emulated workspace, the environment variable is correct.

To Reproduce
Steps to reproduce the behavior:

  1. Create a directory to serve as the workspace (mkdir workspace-wd)
  2. Create member crates (cargo new --bin member1; cargo new --lib member2)
  3. Create a Makefile.toml in the workspace root:
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "true"
CARGO_MAKE_WORKSPACE_EMULATION = true
CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = ["member1", "member2"]

[tasks.root]
command = "echo"
args = ["${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}"]
  1. From the example above, run the root task.

Actual result:

$ cargo make root
[cargo-make] INFO - cargo make 0.31.0
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: root
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: workspace
[cargo-make][1] INFO - External file not found or is not a file, skipping.
[cargo-make][1] INFO - Project: member1
[cargo-make][1] INFO - Build File: Makefile.toml
[cargo-make][1] INFO - Task: root
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Running Task: root
[cargo-make][1] INFO - Execute Command: "echo" "/tmp/workspace-wd/member1"
/tmp/workspace-wd/member1
[cargo-make][1] INFO - Build Done in 0 seconds.
/tmp/workspace-wd
[cargo-make][1] INFO - External file not found or is not a file, skipping.
[cargo-make][1] INFO - Project: member2
[cargo-make][1] INFO - Build File: Makefile.toml
[cargo-make][1] INFO - Task: root
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Running Task: root
[cargo-make][1] INFO - Execute Command: "echo" "/tmp/workspace-wd/member2"
/tmp/workspace-wd/member2
[cargo-make][1] INFO - Build Done in 0 seconds.
/tmp/workspace-wd
[cargo-make] INFO - Build Done in 0 seconds.

Expected result:

$ cargo make root
[cargo-make] INFO - cargo make 0.31.0
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: root
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: workspace
[cargo-make][1] INFO - External file not found or is not a file, skipping.
[cargo-make][1] INFO - Project: member1
[cargo-make][1] INFO - Build File: Makefile.toml
[cargo-make][1] INFO - Task: root
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Running Task: root
[cargo-make][1] INFO - Execute Command: "echo" "/tmp/workspace-wd"
/tmp/workspace-wd
[cargo-make][1] INFO - Build Done in 0 seconds.
/tmp/workspace-wd
[cargo-make][1] INFO - External file not found or is not a file, skipping.
[cargo-make][1] INFO - Project: member2
[cargo-make][1] INFO - Build File: Makefile.toml
[cargo-make][1] INFO - Task: root
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Running Task: root
[cargo-make][1] INFO - Execute Command: "echo" "/tmp/workspace-wd"
/tmp/workspace-wd
[cargo-make][1] INFO - Build Done in 0 seconds.
/tmp/workspace-wd
[cargo-make] INFO - Build Done in 0 seconds.
@sagiegurari
Copy link
Owner

thanks a lot for the detailed explanation.
I'll take a look at it.

@sagiegurari
Copy link
Owner

@connorkuehl can you try the 0.31.1 branch version and see if it solves your issues?

@connorkuehl
Copy link
Author

@connorkuehl can you try the 0.31.1 branch version and see if it solves your issues?

Works great! Thank you 😄

@sagiegurari sagiegurari modified the milestones: 0.30.9, 0.31.1 Jun 26, 2020
@sagiegurari
Copy link
Owner

I published an official release so i think we can close this one.
thanks a lot for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants