Skip to content

Build Tools API plan #1481

@agluszak

Description

@agluszak

What BTAPI is: https://kotlinlang.org/docs/build-tools-api.html

"[Build Tools API] should be the preferred way to work with Kotlin compiler when integrating Kotlin builds into different build systems."

BTAPI unlocks:

  • kotlinc-driven sub-target incremental compilation
  • possibility to use any kotlin compiler version within BTAPI compatibility range
  • simplification of the internal plumbing
  • prevent leaking rules_kotlin-related classes into the user compilation classpath (BTAPI uses an isolated classloader)
  • easier KMP integration ([kmp] Outline of a roadmap #1466)
  • general futureproofing

BTAPI is split into two main artifacts. The build-tools-api is the one embedded into the build tool itself. Its version determines the compatibility range. Then there is the build-tools-impl artifact, which wraps around and calls the compiler. The impl artifact can be supplied by the users who want to customize the version being used. There's also the build-tools-compat artifact (see https://github.com/JetBrains/kotlin/tree/master/compiler/build-tools/kotlin-build-tools-compat)

BTAPI-related development will happen in the develop branch. The end result will be something along the lines of #1449.

The monster-PR is being split into smaller chunks, each of them reviewed separately and merged into the develop branch.

Roadmap:

Breaking changes:

TODO:

  • final desired shape of the public API. Should the build-tools-impl jar (+ dependencies) be set as an attribute on the toolchain? Or do we prefer a bzlmod extension? Do we want to completely hide the fact that we're using rules_jvm_external?
  • compiler options DSL. Should we rely on BTAPI directly? Or do we continue having kotlinc-versioned DSLs?

Relevant YouTrack issues:

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