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

Add feature selection via CLI arguments #512

Merged
merged 13 commits into from
Oct 30, 2023

Conversation

Shnatsel
Copy link
Contributor

@Shnatsel Shnatsel commented Oct 27, 2023

Supports --no-default-features, --all-features, --features=... CLI arguments. They are fully compatible with Cargo itself, which is verified by the added tests.

This allows selecting the feature configuration that matches the way you build your binaries, so that the dependency list in the SBOM can actually correspond to the binary.

Fixes #508

@Shnatsel Shnatsel requested a review from a team as a code owner October 27, 2023 20:35
@Shnatsel Shnatsel changed the title Add feature selection via CLI options Add feature selection via CLI arguments Oct 27, 2023
…thing yet.

Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
…y working now

Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
@lfrancke
Copy link
Contributor

I believe this will also fix #226

@lfrancke lfrancke mentioned this pull request Oct 28, 2023
Copy link
Contributor

@lfrancke lfrancke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As usual: Only minor comments :)
Thanks for this PR!

// so we keep the same behavior here too.
/// Activate all available features
#[clap(long = "all-features")]
pub all_features: bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes need to be reflected in the README and it should probably also mention (even though it can be inferred) that by default all default features are enabled (at least I assume that's the case)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've copied the help messages from Cargo itself here.

I'll update the README before release, because otherwise I'll run into lots of merge conflicts. That text is not neatly split into lines, unlike code.

cargo-cyclonedx/src/cli.rs Outdated Show resolved Hide resolved
cargo-cyclonedx/src/cli.rs Outdated Show resolved Hide resolved
cargo-cyclonedx/src/cli.rs Outdated Show resolved Hide resolved
cargo-cyclonedx/src/cli.rs Show resolved Hide resolved
Shnatsel and others added 3 commits October 30, 2023 01:05
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Co-authored-by: Lars Francke <lars.francke@stackable.tech>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow selecting Cargo features: --no-default-features, --all-features, --features=...
2 participants