Skip to content

Commit 809db4e

Browse files
committed
Updated aggregator to skip if no files found
1 parent a06beac commit 809db4e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

scalac-scoverage-plugin/src/main/scala/scoverage/IOUtils.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,15 @@ object IOUtils {
6262
/**
6363
* Aggregates all subproject reports, returning the location of the aggregated file.
6464
*/
65-
val aggregator: (File, File) => File = (baseDir, targetDir) => {
65+
val aggregator: (File, File) => Unit = (baseDir, targetDir) => {
6666
val files = IOUtils.reportFileSearch(baseDir)
6767
println(s"[info] Found ${files.size} subproject report files [${files.mkString(",")}]")
68-
val nodes = files.map(xml.XML.loadFile)
69-
val aggregated = ScoverageXmlMerger.merge(nodes)
70-
val outFile = new File(targetDir, Constants.XMLReportFilename)
71-
writeToFile(outFile, aggregated.toString)
72-
outFile
68+
if (files.size > 0) {
69+
val nodes = files.map(xml.XML.loadFile)
70+
val aggregated = ScoverageXmlMerger.merge(nodes)
71+
val outFile = new File(targetDir, Constants.XMLReportFilename)
72+
writeToFile(outFile, aggregated.toString)
73+
}
7374
}
7475

7576
val isMeasurementFile = (file: File) => file.getName.startsWith(Constants.MeasurementsPrefix)

0 commit comments

Comments
 (0)