-
Notifications
You must be signed in to change notification settings - Fork 403
cargotest: Use cargo to determine package name #646
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: master
Are you sure you want to change the base?
Conversation
|
Hm. Is adding a dependency to |
Thank you for this! May I suggest trying to install Cargo as part of the |
|
I think I have a solution to testing this where we can mock the system call. Could you provide an example of what is returned by |
cargo metadata --no-deps --offline --format-version 1And it returns something like: {
"packages": [
{
"name": "sim2",
"version": "0.1.0",
"id": "sim2 0.1.0 (path+file:///project-root/pack1)",
"manifest_path": "/project-root/pack1/Cargo.toml",
"..."
},
"..."
],
"workspace_members": [
"sim2 0.1.0 (path+file:///project-root/pack1)",
"..."
],
"target_directory": "/project-root/target",
"version": 1,
"workspace_root": "/project-root"
}Does that help? |
|
Not forgotten about this, will have a look into it soon |
|
I've made a start on trying to mock cargo with an alias though getting some errors, hopefully the answer will reveal itself tomorrow |
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.
Thank you for your patience on this, I've finally got the mock of cargo read-manifest working so that this should work on CI. However I've discovered that even with cargo installed, this PR is lacking a Cargo.toml in the fixture directory. Could you please add one and update the manifest mock accordingly?
Execute nearest fails when using a cargo workspace where the package name does not match the directory name fails.
cargotest.vimuses the directory name, but a different package name can be specified in theCargo.toml.This PR determines the package name using
cargo read-manifest.A minimal example that is fixed by this PR:
Directory structure:
Cargo.tomlpack1/Cargo.tomlpack1/src/main.rs