Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create kover-features artifact to invoke the capabilities of Kover via the Java API #534

Closed
shanshin opened this issue Feb 7, 2024 · 2 comments · Fixed by #536
Closed
Assignees
Labels
Feature Feature request issue type S: in progress Status: implementing or design in process

Comments

@shanshin
Copy link
Collaborator

shanshin commented Feb 7, 2024

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 method kotlinx.kover.offline.runtime.api.KoverRuntime#getReport()

Implementation plan

  1. Create published Kover artifact org.jetbrains.kotlinx:kover-features-jvm
  2. 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)
}
  1. Create kotlinx.kover.features.jvm.KoverLegacyFeatures and put the methods used by the Kover CLI there
  2. 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.
  3. (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.
@shanshin shanshin added Feature Feature request issue type S: in progress Status: implementing or design in process labels Feb 7, 2024
@shanshin shanshin self-assigned this Feb 7, 2024
@shanshin
Copy link
Collaborator Author

shanshin commented Feb 7, 2024

Relates #96

@shanshin shanshin changed the title Create kover-utils artifact to invoke the capabilities of Kover via the Java API Create kover-features artifact to invoke the capabilities of Kover via the Java API Feb 12, 2024
shanshin added a commit that referenced this issue Feb 12, 2024
…e Plugin

1. Created published Kover artifact kover-features-java
2. Added Java API for offline instrumentation of single class
3. Created kotlinx.kover.features.java.KoverLegacyFeatures and put the methods used by the Kover CLI there
4. Removed the dependency on intellij-coverage-reporter from the Kover CLI and add the dependency on kover-features-java

Resolves #534
shanshin added a commit that referenced this issue Feb 12, 2024
…e Plugin

1. Created published Kover artifact kover-features-java
2. Added Java API for offline instrumentation of single class
3. Created kotlinx.kover.features.java.KoverLegacyFeatures and put the methods used by the Kover CLI there
4. Removed the dependency on intellij-coverage-reporter from the Kover CLI and add the dependency on kover-features-java

Resolves #534
shanshin added a commit that referenced this issue Feb 15, 2024
…e Plugin

1. Created published Kover artifact kover-features-java
2. Added Java API for offline instrumentation of single class
3. Created kotlinx.kover.features.java.KoverLegacyFeatures and put the methods used by the Kover CLI there
4. Removed the dependency on intellij-coverage-reporter from the Kover CLI and add the dependency on kover-features-java

Resolves #534
shanshin added a commit that referenced this issue Feb 15, 2024
…e Plugin

1. Created published Kover artifact kover-features-jvm
2. Added Java API for offline instrumentation of single class
3. Created kotlinx.kover.features.jvm.KoverLegacyFeatures and put the methods used by the Kover CLI there
4. Removed the dependency on intellij-coverage-reporter from the Kover CLI and add the dependency on kover-features-jvm

Resolves #534
PR #536

Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
@shanshin shanshin reopened this Feb 15, 2024
@shanshin
Copy link
Collaborator Author

Implemented in 0.7.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Feature request issue type S: in progress Status: implementing or design in process
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant