-
Notifications
You must be signed in to change notification settings - Fork 108
fix: correctly deduce crate target directory #554
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
base: main
Are you sure you want to change the base?
fix: correctly deduce crate target directory #554
Conversation
|
@microsoft-github-policy-service agree |
e81001d to
1bee319
Compare
|
Thanks for the PR @yuvald-sweet-security. We will look into it soon. |
|
@gurry no problem, also note that I ended up falling back to |
wmmc88
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting a PR! What is desired behaviour you're looking for here @yuvald-sweet-security?
This change wouldn't affect that fact that custom target directories for the actual builds are not supported and will probably not be supported for quite some time. See #252 (especailly the 2nd point).
CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY doesn't necessarily point to the root of the cargo workspace, since cargo make has a feature called "emulated workspaces" where you build a workspace-like structure with cargo make that's built out of ordinary cargo crates (where each has it's own root and target directory), and then that variable points to the cargo make workspace (which is not a cargo workspace, and therefore has no target directory)
In this emulated workspace scenario, the existing behavior is desirable since it means that the makefile only needs to be copied to one place shared by all members of the emulated workspace.
Maybe I'm missing it, but I don't see the point of the change proposed here. Could you mock up some examples of something failing beforehand, and then passing after this change?
|
@wmmc88 maybe I wasn't clear; the current behavior with regards to emulated workspaces is simply broken - it doesn't build because it cannot deduce the correct target directory. For example, with this directory structure:
[env]
# this tells cargo-make that this directory acts as a workspace root
CARGO_MAKE_WORKSPACE_EMULATION = true
# a list of crate members. since we do not have a Cargo.toml, we will need to specify this in here.
CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = ["um", "km"]
extend = "target/rust-driver-makefile.toml"
[config]
load_script = '''
#!@rust
//! ```cargo
//! [dependencies]
//! wdk-build = "0.4.0"
//! ```
#![allow(unused_doc_comments)]
wdk_build::cargo_make::load_rust_driver_makefile()?
'''Running This is because This is because wdk-build placed the auto-generated makefile into I don't think that sharing |
thanks for the thorough explanation. So this PR is not about support custom target directories, its about fixing loading the driver makefile for emulated cargo-make workspaces. Could you update PR title and description as such.
I'd like to understand in what situations |
Assuming that the target directory is in
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}\targetis incorrect for multiple reasons; first of all, because the target directory can be customized with cargo configuration, but also becauseCARGO_MAKE_WORKSPACE_WORKING_DIRECTORYdoesn't necessarily point to the root of the cargo workspace, sincecargo makehas a feature called "emulated workspaces" where you build a workspace-like structure withcargo makethat's built out of ordinary cargo crates (where each has it's own root and target directory), and then that variable points to the cargo make workspace (which is not a cargo workspace, and therefore has no target directory). Using theCARGO_MAKE_CRATE_TARGET_DIRECTORYvariable is a better way to locate the current build's target directory.