Skip to content

BCV Gradle Plugin should not depend on kotlin-compiler-embeddable #208

@aSemy

Description

@aSemy

Currently, BCV has a compileOnly dependency on kotlin-compiler-embeddable, and (I presume) expects that KGP will provide it at runtime.

compileOnly(libs.kotlin.compiler.embeddable)

kotlin-compiler-embeddable is not supposed to be exposed in the Gradle plugin classpath. It will create problems for .gradle.kts buildscripts compilation once it starts to contain classes compiled with language version 2.1 (limiting the supported Gradle versions range).

In the scope of KT-61706, kotlin-compiler-embeddable will be removed from the runtime dependencies of KGP.

Proposed fix

  1. Split the BCV generator and validator code into a separate subproject, which (just for quick reference) I'll call bcv-core.
  2. bcv-core has an implementation dependency on kotlin-compiler-embeddable.
  3. bcv-gradle (the current project has a whole) has a compileOnly dependency on bcv-core.
  4. bcv-gradle uses the Worker API to invoke bcv-core using an isolated classpath.
  5. BCV Gradle Plugin creates a Configuration for fetching bcv-core at runtime, and passing it into the Worker.
└── binary-compatibility-validator/
    ├── buildSrc/
    │
    ├── binary-compatibility-validator-core/
    │   └── build.gradle.kts
    │
    ├── binary-compatibility-validator-gradle/
    │   └── build.gradle.kts
    │
    ├── build.gradle.kts
    └── settings.gradle.kts

The end result is BCV Gradle Plugin becomes a 0-dependency wrapper over the bcv-core. This is how BCV-MU has been architected.

As well as making BCV better, what is also interesting is that this set up opens the door to a Maven Plugin, or a CLI, or whatever else.

See also

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions