-
Notifications
You must be signed in to change notification settings - Fork 33
More precise dependency list #210
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
Draft
Shnatsel
wants to merge
16
commits into
master
Choose a base branch
from
precise-dep-list
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
22bcbae
Refactor the way we assemble the command to cargo-metadata to share c…
Shnatsel 69500d8
Proper cargo tree command
Shnatsel 363b78d
Explicitly specify cargo-metadata format version, just in case
Shnatsel a5552db
Less ugly formatting
Shnatsel 237b7a1
Set LC_ALL=C to guard against Cargo possibly adding localization in t…
Shnatsel a46dc41
Actually call cargo-tree
Shnatsel 14f64c4
Implement parsing of cargo-tree output
Shnatsel 23f9b52
Wire up parsing of cargo-tree output
Shnatsel 0015e27
Add test fixture for dev-dependency unification
Shnatsel 22cbea3
Add a currently-failing test for dependency unification
Shnatsel 1d32cf6
Better test comments
Shnatsel 17ac4f8
WIP integration of cargo-tree data
Shnatsel 3d9a866
Now make it actually work, hopefully. Test passes!
Shnatsel d12fd95
Add comment
Shnatsel eb028c9
clippy
Shnatsel 6100f2b
reinstate commented-out test as an end-to-end test
Shnatsel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
cargo-auditable/tests/fixtures/runtime_and_dev_dep_with_different_features/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[workspace] | ||
|
||
resolver = "2" | ||
members = [ | ||
"top_level_crate", | ||
"dev_dep", | ||
"runtime_dep", | ||
"optional_transitive_dep", | ||
] |
9 changes: 9 additions & 0 deletions
9
...o-auditable/tests/fixtures/runtime_and_dev_dep_with_different_features/dev_dep/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "dev_dep" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
runtime_dep = {path = "../runtime_dep", features = ["optional_dep"]} |
8 changes: 8 additions & 0 deletions
8
...o-auditable/tests/fixtures/runtime_and_dev_dep_with_different_features/dev_dep/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#[cfg(test)] | ||
mod tests { | ||
#[test] | ||
fn it_works() { | ||
let result = 2 + 2; | ||
assert_eq!(result, 4); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...s/fixtures/runtime_and_dev_dep_with_different_features/optional_transitive_dep/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "optional_transitive_dep" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
14 changes: 14 additions & 0 deletions
14
...s/fixtures/runtime_and_dev_dep_with_different_features/optional_transitive_dep/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
left + right | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn it_works() { | ||
let result = add(2, 2); | ||
assert_eq!(result, 4); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ditable/tests/fixtures/runtime_and_dev_dep_with_different_features/runtime_dep/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "runtime_dep" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[features] | ||
optional_dep = ["optional_transitive_dep"] | ||
|
||
[dependencies] | ||
optional_transitive_dep = { path = "../optional_transitive_dep", optional = true } |
14 changes: 14 additions & 0 deletions
14
...ditable/tests/fixtures/runtime_and_dev_dep_with_different_features/runtime_dep/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
left + right | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn it_works() { | ||
let result = add(2, 2); | ||
assert_eq!(result, 4); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
To better prepare for a LTS Linux distribution having an old
cargo-auditable
(which is mentioned in another fn docstring in this PR), it might be worthwhile adding a few ways to avoid problems ifcargo tree ..
output changes in a way that could breakcargo-auditable
.cargo tree
for binaries that are not in a workspace, as I assume that is the only time whencargo tree
is beneficial.cargo tree
.parts[1]
) in aResult
, and have a command line flag or envvar flag to allow the user to choose whether to fail or emit warnings when this parser fails.2 & 3 could be the same config item, like
CARGO_AUDITABLE_USE_CARGO_TREE=off,on,warn
I personally dont mind if these protections are not done. Just ideas to help get this feature across the line.
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.
It actually helps with more than just workspaces.
cargo metadata
also does somewhat incorrect platform resolution, e.g. withrustix
depending onerrno
on Linux according tocargo metadata
but notcargo tree
unless you usecargo tree --platforms=all
, so it needs to be enabled unconditionally.