Skip to content

[2.x] feat: Add rootProject macro (fixes #4511)#8671

Merged
eed3si9n merged 2 commits intosbt:developfrom
bitloi:feat/4511-root-project-macro
Feb 1, 2026
Merged

[2.x] feat: Add rootProject macro (fixes #4511)#8671
eed3si9n merged 2 commits intosbt:developfrom
bitloi:feat/4511-root-project-macro

Conversation

@bitloi
Copy link
Copy Markdown
Contributor

@bitloi bitloi commented Feb 1, 2026

Adds a rootProject macro so the root project can be defined as:
val root = rootProject
instead of:
val root = (project in file(".")).

  • KeyMacro.scala: rootProjectImpl macro implementation
  • Defaults.scala: inline def rootProject in BuildExtra
  • ProjectMacro.scala: unit test for rootProject

Fixes #4511

bitloi and others added 2 commits February 1, 2026 05:27
Add a rootProject convenience macro that expands to a Project with base "."
and the enclosing val name as id. Allows writing `val root = rootProject`
instead of `val root = (project in file("."))` for a stable root project id.

- KeyMacro: add rootProjectImpl (same as projectImpl with base new File("."))
- BuildExtra: add inline def rootProject
- ProjectMacro: add unit test for rootProject
@bitloi
Copy link
Copy Markdown
Contributor Author

bitloi commented Feb 1, 2026

@eed3si9n Give me your feedback when you are free.

@eed3si9n
Copy link
Copy Markdown
Member

eed3si9n commented Feb 1, 2026

This good, but please ping me on the issue for anything that I've labeled "needs discussion", because that usually means we haven't decided if it's a good idea to have the feature.

Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@eed3si9n eed3si9n changed the title feat: Add rootProject macro (fixes #4511) [2.x] feat: Add rootProject macro (fixes #4511) Feb 1, 2026
@bitloi
Copy link
Copy Markdown
Contributor Author

bitloi commented Feb 1, 2026

This good, but please ping me on the issue for anything that I've labeled "needs discussion", because that usually means we haven't decided if it's a good idea to have the feature.

I will keep it in mind 👍

@eed3si9n eed3si9n merged commit 4430d4c into sbt:develop Feb 1, 2026
15 checks passed
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.

Add a rootProject convenience method (macro)

2 participants