Skip to content

Commit

Permalink
~review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shanshin committed Feb 15, 2024
1 parent 0076e99 commit a44eb4d
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/offline-instrumentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ must be passed to Kover CLI as arguments, see [Kover CLI](../cli#offline-instrum
#### Instrumentation by Kover Features
Kover Features is a library that provides capabilities similar to Kover CLI and Kover Gradle plugin.

You can declare a dependency on Kover Features using following coordinates: `org.jetbrains.kotlinx:kover-features-java:0.7.5`.
You can declare a dependency on Kover Features using following coordinates: `org.jetbrains.kotlinx:kover-features-jvm:0.7.5`.

Then you can use the Kover Features classes to instrument the bytecode of each class:
```kotlin
import kotlinx.kover.features.java.KoverFeatures
import kotlinx.kover.features.jvm.KoverFeatures
// ...

val instrumenter = KoverFeatures.createOfflineInstrumenter()
Expand Down
2 changes: 1 addition & 1 deletion kover-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ kotlin {
}

dependencies {
implementation(project(":kover-features-java"))
implementation(project(":kover-features-jvm"))

implementation(libs.args4j)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package kotlinx.kover.cli.commands

import kotlinx.kover.cli.util.asRegex
import kotlinx.kover.features.java.KoverLegacyFeatures
import kotlinx.kover.features.jvm.KoverLegacyFeatures
import org.kohsuke.args4j.Argument
import org.kohsuke.args4j.Option
import java.io.File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ internal class ReportCommand : Command {
var fail = false
if (xmlFile != null) {
try {
KoverLegacyFeatures.xmlReport(xmlFile, binaryReports, outputRoots, sourceRoots, title ?: "Kover XML Report", filters)
KoverLegacyFeatures.generateXmlReport(xmlFile, binaryReports, outputRoots, sourceRoots, title ?: "Kover XML Report", filters)
} catch (e: IOException) {
fail = true
errorWriter.println("XML generation failed: " + e.message)
}
}
if (htmlDir != null) {
try {
KoverLegacyFeatures.htmlReport(htmlDir, binaryReports, outputRoots, sourceRoots, title ?: "Kover HTML Report", filters)
KoverLegacyFeatures.generateHtmlReport(htmlDir, binaryReports, outputRoots, sourceRoots, title ?: "Kover HTML Report", filters)
} catch (e: IOException) {
fail = true
errorWriter.println("HTML generation failed: " + e.message)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kotlinx.kover.features.java;
package kotlinx.kover.features.jvm;

/**
* Internal class to control JVM ConDy settings.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kotlinx.kover.features.java;
package kotlinx.kover.features.jvm;

import java.io.InputStream;
import java.util.Scanner;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kotlinx.kover.features.java;
package kotlinx.kover.features.jvm;

import com.intellij.rt.coverage.instrument.api.OfflineInstrumentationApi;
import com.intellij.rt.coverage.report.api.Filters;
Expand Down Expand Up @@ -34,11 +34,11 @@ public static void instrument(File resultDir,
outputs.add(resultDir);
}

String condySetting = ConDySettings.disableConDy();
String previousConDySetting = ConDySettings.disableConDy();
try {
OfflineInstrumentationApi.instrument(originalDirs, outputs, convertFilters(filters), countHits);
} finally {
ConDySettings.restoreConDy(condySetting);
ConDySettings.restoreConDy(previousConDySetting);
}
}

Expand All @@ -53,7 +53,7 @@ public static void instrument(File resultDir,
* @param filters Filters to limit the classes that will be displayed in the report
* @throws IOException In case of a report generation error
*/
public static void xmlReport(
public static void generateXmlReport(
File xmlFile,
List<File> binaryReports,
List<File> classfileDirs,
Expand All @@ -75,7 +75,7 @@ public static void xmlReport(
* @param filters Filters to limit the classes that will be displayed in the report.
* @throws IOException In case of a report generation error
*/
public static void htmlReport(
public static void generateHtmlReport(
File htmlDir,
List<File> binaryReports,
List<File> classfileDirs,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kotlinx.kover.features.java;
package kotlinx.kover.features.jvm;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kotlinx.kover.features.java;
package kotlinx.kover.features.jvm;

import com.intellij.rt.coverage.instrument.api.OfflineInstrumentationApi;

Expand All @@ -18,7 +18,7 @@ class OfflineInstrumenterImpl implements OfflineInstrumenter {

@Override
public byte[] instrument(InputStream originalClass, String debugName) throws IOException {
String condySetting = ConDySettings.disableConDy();
String previousConDySetting = ConDySettings.disableConDy();

try {
return OfflineInstrumentationApi.instrument(originalClass, countHits);
Expand All @@ -27,7 +27,7 @@ public byte[] instrument(InputStream originalClass, String debugName) throws IOE
String.format("Error while instrumenting '%s' with Kover instrumenter version '%s'",
debugName, KoverFeatures.getVersion()), e);
} finally {
ConDySettings.restoreConDy(condySetting);
ConDySettings.restoreConDy(previousConDySetting);
}
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencyResolutionManagement {
}
}

include(":kover-features-java")
include(":kover-features-jvm")
include(":kover-gradle-plugin")
include(":kover-cli")
include(":kover-offline-runtime")

0 comments on commit a44eb4d

Please sign in to comment.