Skip to content

[2.x] Auto aggregate#8290

Merged
eed3si9n merged 1 commit intosbt:developfrom
eed3si9n:wip/aggregate
Sep 21, 2025
Merged

[2.x] Auto aggregate#8290
eed3si9n merged 1 commit intosbt:developfrom
eed3si9n:wip/aggregate

Conversation

@eed3si9n
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n commented Sep 21, 2025

Fixes #4510

Problem

For sbt 1.x, the user is forced to pick between having a stable ID for the root project, or having the automatic aggregation of all subprojects. The problem becomes more pronounced for large build that frequent add/remove subprojects.

Solution

This implements .autoAggregate method on Project, which is implemented as this.aggregate(LocalAggregate).
At the loading time, we can automatically expand LocalAggregate to a list of subproject references, after we discover all subprojects.
The autoAggregate will use the base directory of the subproject to pick the parent-child relationship. For example, a root project would aggregate all subprojects, but bar might aggregate only bar/bar1 and bar/bar2.

lazy val root = (project in file("."))
  .autoAggregate
  .settings(
    name := "foo-root",
    publish / skip := true,
  )

**Problem**
For sbt 1.x, the user is forced to pick between having a stable ID for the root project,
or having the automatic aggregation of all subprojects.
The problem becomes more pronounced for large build that frequent add/remove subprojects.

**Solution**
This implements `.autoAggregate` method on `Project`, which is implemented as
`this.aggregate(LocalAggregate)`.
At the loading time, we can automatically expand `LocalAggregate` to a list of subproject references,
after we discover all subprojects.
The `autoAggregate` will use the base directory of the subproject to pick the parent-child
relationship. For example, a root project would aggregate all subprojects,
but `bar` might aggregate only `bar/bar1` and `bar/bar2`.
@eed3si9n eed3si9n merged commit a615ff3 into sbt:develop Sep 21, 2025
14 checks passed
@eed3si9n eed3si9n deleted the wip/aggregate branch September 21, 2025 20:50
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.

Root project: auto-aggregation vs stable id

1 participant