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

Obtaining the workspace root #382

Closed
KaiserKarel opened this issue Mar 12, 2020 · 11 comments
Closed

Obtaining the workspace root #382

KaiserKarel opened this issue Mar 12, 2020 · 11 comments
Assignees

Comments

@KaiserKarel
Copy link

I'm using a bunch of workspaces, sharing target directories. I'd like to refer to the root (the directory containing the Cargo.toml with the workspace.members key) from one of the nested workspaces. How can I accomplish this?

@sagiegurari
Copy link
Owner

you mean you have a bunch of crates which are in the same workspace, right?
if so, when running from the workspace level, you have access to a ** CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY** env var.
however, if you go to a specific crate and run from there, cargo-make is unaware you are in a workspace.

@sagiegurari sagiegurari self-assigned this Mar 12, 2020
@KaiserKarel
Copy link
Author

CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY does the trick when running from the root; however I'd like the scripts to also work when ran from other directories.

Basically I need to access the root target directory to load some wasm files; where I specify their location through my programs command line.

@sagiegurari
Copy link
Owner

so currently i don't have that. but could try to add it if you run it from the root of some member crate.

@KaiserKarel
Copy link
Author

There should be a way to access it through Cargo I reckon; since it is able to figure out where to place all artifacts, even when I'm running cargo make from different directories.

@sagiegurari
Copy link
Owner

ya, didn't say its not possible :)
just that, its not implemented at the moment and going to try to add it soon.

@KaiserKarel
Copy link
Author

That'd be great. Let me know if I can help out.

sagiegurari added a commit that referenced this issue Mar 12, 2020
@sagiegurari
Copy link
Owner

@KaiserKarel I just pushed a commit to the dev branch to setup CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY correctly even when starting the build in the member crate directly and not in the workspace level.
can you please install it and check if it resolves your issues?

@KaiserKarel
Copy link
Author

Sorry, bit hectic last couple of days; but it seems to work perfectly!

@sagiegurari
Copy link
Owner

great. will probably release a new official version today/tomorrow.

@sagiegurari
Copy link
Owner

@KaiserKarel just release an official version with this fix.
thanks for the feedback

@KaiserKarel
Copy link
Author

Perfect, thanks for the quick feature addition!

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

No branches or pull requests

2 participants