Skip to content

Commit 375e60a

Browse files
authored
Fixed path used to obtain the Kotlin class files. (#3)
1 parent 26232ce commit 375e60a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePlugin.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ class RootCoveragePlugin : Plugin<Project> {
197197
// Hard coded alternative to get class files for Java.
198198
//val classesTree = project.fileTree(mapOf("dir" to "${project.buildDir}/intermediates/classes/${variant.dirName}", "excludes" to getFileFilterPatterns()))
199199

200-
// TODO: No idea how to dynamically get the kotlin class files output folder... so for now this is hardcoded.
201-
val kotlinClassTree = project.fileTree("${project.buildDir}/tmp/kotlin-classes/${variant.dirName}", excludes = getFileFilterPatterns()).excludeNonClassFiles()
200+
// TODO: No idea how to dynamically get the kotlin class files output folder, so for now this is hardcoded.
201+
// TODO: For some reason the tmp/kotlin-classes folder does not use the variant.dirName property, for now we instead use the variant.name.
202+
val kotlinClassFolder = "${project.buildDir}/tmp/kotlin-classes/${variant.name}"
203+
project.logger.info("Kotlin class folder for variant '${variant.name}': $kotlinClassFolder")
204+
205+
val kotlinClassTree = project.fileTree(kotlinClassFolder, excludes = getFileFilterPatterns()).excludeNonClassFiles()
202206

203207
// getSourceFolders returns ConfigurableFileCollections, but we only need the base directory of each ConfigurableFileCollection.
204208
val sourceFiles = variant.getSourceFolders(SourceKind.JAVA).map { file -> file.dir }

0 commit comments

Comments
 (0)