Skip to content

Commit

Permalink
fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullinAM committed Oct 14, 2024
1 parent 9ba1122 commit 459dd8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import kotlin.io.path.readBytes
import kotlin.io.path.relativeTo
import kotlin.io.path.writeBytes
import kotlin.io.path.writeText
import kotlin.streams.toList
import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
Expand Down Expand Up @@ -160,7 +159,7 @@ open class CoverageReporter(
is PackageLevel -> Files.walk(jacocoInstrumentedDir)
.filter { it.isClass }
.filter { analysisLevel.pkg.isParent(it.fullyQualifiedName(jacocoInstrumentedDir).asmString) }
.toList()
.collect(Collectors.toList())

is ClassLevel -> {
val targetKlass = analysisLevel.klass.fullName.replace(Package.SEPARATOR, File.separatorChar)
Expand All @@ -172,7 +171,7 @@ open class CoverageReporter(
val additionalFiles = Files.walk(jacocoInstrumentedDir)
.filter { it.isClass }
.filter { additionalValues.any { value -> value.isParent(it.fullyQualifiedName(jacocoInstrumentedDir).asmString) } }
.toList()
.collect(Collectors.toList())

targetFiles + additionalFiles
}
Expand Down Expand Up @@ -251,6 +250,7 @@ open class CoverageReporter(
return coverageBuilder
}

@Suppress("DEPRECATION")
protected fun computeExecutionData(
context: CoverageContext,
testClasses: Set<Path>,
Expand All @@ -264,7 +264,12 @@ open class CoverageReporter(
val classLoader = PathClassLoader(listOf(jacocoInstrumentedDir, compileDir))
for (testPath in testClasses) {
val testClassName = testPath.fullyQualifiedName(compileDir)
val testClass = classLoader.loadClass(testClassName)
val testClass = try {
classLoader.loadClass(testClassName)
} catch (e: Throwable) {
log.warn("Warning: could not load test class $testClassName, exception:\n", e)
continue
}
if (logProgress) log.debug("Running test $testClassName")

val jcClass = classLoader.loadClass("org.junit.runner.JUnitCore")
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<maven.compiler.source>${jvm.version}</maven.compiler.source>
<maven.compiler.target>${jvm.version}</maven.compiler.target>

<kotlin.version>2.0.0</kotlin.version>
<kotlin.version>2.0.20</kotlin.version>
<kotlin.code.style>official</kotlin.code.style>
<serialization.version>1.7.0-RC</serialization.version>
<serialization.version>1.7.3</serialization.version>
<coroutines.version>1.8.1</coroutines.version>
<collections.version>0.3.5</collections.version>
<compiler-plugin.version>3.5.1</compiler-plugin.version>
Expand Down

0 comments on commit 459dd8c

Please sign in to comment.