Kover only has an API for getting a binary report in artifact org.jetbrains.kotlinx:kover-offline-runtime, a suitable method kotlinx.kover.offline.runtime.api.KoverRuntime#getReport()
Implementation plan
Create published Kover artifact org.jetbrains.kotlinx:kover-features-jvm
Add Java API for offline instrumentation of single class
package kotlinx.kover.features.jvm
public class KoverFeatures {
public static OfflineInstrumentator createOfflineInstrumenter() { ... }
}
public interface OfflineInstrumenter {
public byte[] instrument(InputStream originalClass, String debugName)
}
3. Create `kotlinx.kover.features.jvm.KoverLegacyFeatures` and put the methods used by the Kover CLI there
4. Remove the dependency on `intellij-coverage-reporter` from the Kover CLI and add the dependency on `org.jetbrains.kotlinx:kover-features-jvm`, use the methods added in `kotlinx.kover.features.jvm.KoverFeaturesUtils`. Now, `kover-features-jvm` will be the only artifact distributing the Kover Tooling API via Java API.
5. (for the future) Develop an API for generating reports. Analyzing the JaCoCo API, it is obvious that the API for generating reports is not trivial.
It is required to develop an API that implements all the needs of external users (such as AGP), optimized, but as easy to use and non-redundant.
Motivation
Need to add Kover coverage library support to the Android Gradle Plugin (AGP).
Current status
AGP only supports working with JaCoCo, it uses the Java calls of JaCoCo methods.
The following JaCoCo API are used:
Kover only has an API for getting a binary report in artifact
org.jetbrains.kotlinx:kover-offline-runtime
, a suitable methodkotlinx.kover.offline.runtime.api.KoverRuntime#getReport()
Implementation plan
org.jetbrains.kotlinx:kover-features-jvm
public class KoverFeatures { public static OfflineInstrumentator createOfflineInstrumenter() { ... } }
public interface OfflineInstrumenter { public byte[] instrument(InputStream originalClass, String debugName) }