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 new packages to [workspace.members] automatically #12779

Merged
merged 3 commits into from
Oct 29, 2023

Commits on Oct 28, 2023

  1. Move is_sorted to a shared package.

    This function can be used by other commands to figure out whether a list is sorted or not.
    
    Signed-off-by: David Calavera <david.calavera@gmail.com>
    calavera committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    fa76b63 View commit details
    Browse the repository at this point in the history
  2. Update toml_edit dependency to version 0.20.7.

    This new version incorporates utilities to sort Array elements.
    
    Signed-off-by: David Calavera <david.calavera@gmail.com>
    calavera committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    c2167e2 View commit details
    Browse the repository at this point in the history
  3. Update workspace manifest with new members.

    When a user runs `cargo new` or `cargo init` within a workspace, Cargo will automatically add the new package to the members list in the workspace if necessary. The heuristic to add the new package is as follows:
    
    - If there is no `members` list in the workspace yet, a new `members` list is created.
    - If there is an `exclude` statement, Cargo checks if the new package should be excluded. If it doesn't match the `exclude` list, the package is added to the `members` list.
    - If there is a glob expression in the `members` list that matches the new package, the package is not added to the `members` list.
    - If the existent `members` list is sorted, Cargo tries to preserve the ordering when it adds the new package.
    
    This change doesn't try to format the resulting `members` list in any way, leaving the formatting decissions to the user.
    
    Signed-off-by: David Calavera <david.calavera@gmail.com>
    calavera committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    1a8bfdf View commit details
    Browse the repository at this point in the history