Skip to content

Gradle: Replace legacy buildSrc mechanism with included build#1524

Merged
bioball merged 2 commits intoapple:mainfrom
odenix:build-logic-2
Apr 16, 2026
Merged

Gradle: Replace legacy buildSrc mechanism with included build#1524
bioball merged 2 commits intoapple:mainfrom
odenix:build-logic-2

Conversation

@odenix
Copy link
Copy Markdown
Contributor

@odenix odenix commented Apr 15, 2026

Motivation:
buildSrc is a special-case legacy mechanism.
Gradle recommends using an included build named build-logic instead:
https://docs.gradle.org/current/userguide/best_practices_structuring_builds.html#favor_composite_builds

Changes:

  • Rename buildSrc/ to build-logic/
    • triggers reformatting
  • Replace occurrences of "buildSrc" with "build-logic"
  • Include the build-logic build in the main build (via settings.gradle.kts)
  • Apply convention plugins via plugin IDs instead of type-safe accessors
    • small tradeoff compared to buildSrc

Result:

  • Faster and more isolated builds
  • Build logic behaves like a normal build, making it easier to evolve and reason about

Motivation:
buildSrc is a special-case legacy mechanism.
Gradle recommends using an included build named build-logic instead:
https://docs.gradle.org/current/userguide/best_practices_structuring_builds.html#favor_composite_builds

Changes:
- Rename buildSrc/ to build-logic/
  - triggers reformatting
- Replace occurrences of "buildSrc" with "build-logic"
- Include the build-logic build in the main build (via settings.gradle.kts)
- Apply convention plugins via plugin IDs instead of type-safe accessors
  - small tradeoff compared to buildSrc

Result:
- Faster and more isolated builds
- Build logic behaves like a normal build, making it easier to evolve and reason about
Copy link
Copy Markdown
Contributor

@HT154 HT154 left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, but the rest of the team may have input.

Copy link
Copy Markdown
Member

@bioball bioball left a comment

Choose a reason for hiding this comment

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

TIL! Thanks! This looks good to me too.

Comment thread build-logic/src/main/kotlin/pklAllProjects.gradle.kts Outdated
@bioball bioball merged commit 4faf35a into apple:main Apr 16, 2026
17 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.

3 participants