-
Notifications
You must be signed in to change notification settings - Fork 75
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
Support Cargo Non-Flat Dependency Graph Using cargo tree #1377
base: master
Are you sure you want to change the base?
Changes from 1 commit
7a31429
3587046
b049656
284818b
4fb2d5c
fe96f1d
02f7866
6311a33
575a8ed
dee1a20
34009b3
02b7353
67631e7
bb4528e
f88f33a
7d7a0cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,9 @@ | |
### New features | ||
|
||
* Support for Conda has been extended to 25.1.1. | ||
Here’s the revised line, following your requested format: | ||
* A new detector leveraging `cargo tree` to extract direct and transitive dependencies, improving accuracy over the previous flat-list detection. This build-based detector is triggered for Cargo projects with a `Cargo.toml` file and requires Cargo version **1.44.0+**. Falls back to the existing build-less approach if `cargo tree` is unavailable. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion for a few tweaks to add links to further documentation:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay @cpottsbd, I'll update accordingly. Thanks for the nice suggestion. |
||
* Added property `detect.cargo.path` to allow users to specify a custom Cargo executable path. | ||
|
||
### Resolved issues | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,32 @@ | ||
# Cargo support | ||
|
||
## Overview | ||
## Overview | ||
|
||
[detect_product_short] runs the Cargo detector if it finds either of the following files in your project: | ||
[detect_product_short] now includes two Cargo detectors: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove the "now's" and "new's" from this information and leave that type of info for the release notes. (Since this part of the documentation lives on past the point where this detector is new.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it seems quite logical. |
||
|
||
* Cargo.toml | ||
* Cargo.lock | ||
* **Cargo CLI Detector** (New) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* **Cargo Lockfile Detector** | ||
|
||
The Cargo detector parses the Cargo.lock file for information on your project's dependencies. If the detector discovers a Cargo.toml file but not a Cargo.lock file, it will prompt the user to generate a Cargo.lock by running `cargo generate-lockfile` and then run [detect_product_short] again. | ||
The Cargo detector extracts the project's name and version from the Cargo.toml file. If it does not find a Cargo.toml file, it will defer to values derived by Git, from the project's directory, or defaults. | ||
## Cargo CLI Detector | ||
|
||
A new cli detector for Cargo projects, which extracts **direct and transitive dependencies** using the `cargo tree` command. This improves the accuracy of dependency detection over the previous flat-list detection. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: |
||
|
||
**Requirements:** | ||
* Cargo version **1.44.0+** is required (as `cargo tree` was introduced in this version). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion:
|
||
* A `Cargo.toml` file must be present in the project. | ||
* A valid `cargo` executable must be available on the system. | ||
|
||
**Behavior:** | ||
* Executes `cargo tree` to analyze dependencies. | ||
* Parses the output to construct a hierarchical **dependency graph**. | ||
* Falls back to the Cargo Lockfile Detector if `cargo tree` is unavailable. | ||
|
||
To specify a custom Cargo executable path, use the `detect.cargo.path` property. | ||
|
||
## Cargo Lockfile Detector | ||
|
||
If `cargo tree` is unavailable, [detect_product_short] will default to the Cargo Lockfile Detector, which extracts dependencies by parsing the `Cargo.lock` file. | ||
|
||
* If both `Cargo.toml` and `Cargo.lock` are present, the detector uses `Cargo.lock` for dependency information. | ||
* If `Cargo.lock` is missing, the detector prompts the user to generate it using `cargo generate-lockfile`. | ||
* Extracts the project’s name and version from `Cargo.toml`. If missing, it derives values from Git or the project directory. |
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.
This feels like a comment that came over from a cut and paste?
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.
Oh, I see. I'll refactor. Thanks for pointing this out.