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

Split the project into separate crates to support reuse #68

Closed
13 of 20 tasks
amy-keibler opened this issue Nov 26, 2021 · 3 comments
Closed
13 of 20 tasks

Split the project into separate crates to support reuse #68

amy-keibler opened this issue Nov 26, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@amy-keibler
Copy link
Collaborator

amy-keibler commented Nov 26, 2021

Right now, the project is published under a single crate cyclonedx-sbom. The dependencies required for the full functionality of the CLI result in a very large dependency tree and large compile times (mostly due to the dependency on cargo due to some things not being available via cargo_metadata).

We should split the project into two crates:

  • cyclonedx-sbom: A lightweight library that implements the specification and provides small utilities (e.g. proposed merge algorithm implementations would live here)
  • cargo-cyclonedx: The current functionality, but structured in a way that makes the library easy to integrate with other rust applications and makes the binary as the first-party implementation on top.

Proposed Approach

  • Preparation
    • Reserve the cargo-cyclonedx crate
    • Set up the cdx-automation user with publish access to that crate
  • Restructuring
    • Create a workspace and move the existing code to cargo-cyclonedx/
    • Update CI and publishing to work
  • Library-ification
    • Implement the specification library
      • Create an internal model that will be the public API for use by cargo-cyclonedx and other Rust applications
      • Create a private model of every version of the specification that supports serialization and deserialization (can this be auto-generated?)
      • Create the mapping between the public and private models
      • Create utility functions to deserialize from any version of the specification, serialize as the latest version, and serialize as a specific version
      • Support validation (perhaps via something like Keats/validator
    • Set up CI
      • Ensure the tests run on PRs and pushes
      • Set up the publish GitHub actions to handle releasing the library (this should Just Work with the publish crates action we currently use, but more research needs to be done to determine specifying major / minor / patch versions.
  • Documentation
    • README.md for each crate
    • Top level readme
    • Rustdoc

Concerns

  • This will change the cargo install command and might cause problems with users who have already installed the CLI tool
  • This will break anyone using our code as a library. This is permissible under SemVer (reference) and we have zero public reverse dependencies, but might not be appreciate
    • We should look into ways to mitigate this in general by having a public channel for comments that our users can watch for updates
    • This would definitely be at least a minor version increase, but we could also consider releasing a 1.0.0 version
@amy-keibler amy-keibler added the enhancement New feature or request label Nov 26, 2021
amy-keibler added a commit that referenced this issue Dec 1, 2021
This is a part of the effort mentioned in
#68

Signed-off-by: Amy Keibler <amelia.keibler@gmail.com>
@amy-keibler
Copy link
Collaborator Author

Work on this is underway in the library-ification branch for anyone who would like to follow along

@amy-keibler amy-keibler self-assigned this Dec 1, 2021
amy-keibler added a commit that referenced this issue Dec 5, 2021
This is a part of the effort mentioned in
#68

Signed-off-by: Amy Keibler <amelia.keibler@gmail.com>
amy-keibler added a commit that referenced this issue Dec 9, 2021
This is a part of the effort mentioned in
#68

Signed-off-by: Amy Keibler <amelia.keibler@gmail.com>
@lfrancke
Copy link
Contributor

I know this is an old issue but do you happen to remember what's not available via cargo_metadata?

@lfrancke
Copy link
Contributor

I think this can be closed as it's been done. Any objections?

@Shnatsel opinions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants