Skip to content

Workspaces: Cargo profiles should be shared among all workspace members. #3206

@matklad

Description

@matklad

Split off from #3194.

Currently workspaces do not work really well with profiles. Suppose you have two crates, foo and bar, both of them have a profile section and bar depends on foo. If you invoke cargo build inside foo package and inside bar package, then the bar package will be build twice with different profiles!

The property we want here is this "a package of the workspace is always build with the same profile, regardless of place where cargo build was invoked".

This can be achieved in one of the two ways:

  1. Use the single profile configuration for the whole workspace.

  2. When building a workspace package, always use its own profile.

I think it's simpler and better to implement 1), and perhaps add per package overrides in the future.

To implement 1), we should:

  • add a profile section to the virtual manifest,
  • start to produce a warning if the non-root member of the workspace specifies profiles,
  • switch the behavior to always use the profiles from the root of the workspace.

Does this sound reasonable? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions