Skip to content

Commit 9c896c7

Browse files
committed
🗄 Release 0.1.5 0.1.2
1 parent 3d6d261 commit 9c896c7

6 files changed

Lines changed: 41 additions & 44 deletions

File tree

ReleaseNotes.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Omni Reporter Commons Release Notes
22

3+
#### Release 0.1.6 - Upcoming
34

4-
#### Release 0.1.5 - Upcoming
5+
1. Support for Group Coverage with Branch Coverage (mostly Coveralls)
6+
2. Source encoding gets automatically chosen unless we configure flag `failOnNoEncoding` to `true`
7+
8+
#### Release 0.1.5 - 2022/02/22
59

610
###### Features
711

8-
1. Support for Group Coverage with Branch Coverage (mostly Coveralls)
9-
2. Source encoding gets automatically chosen unless we configure flag `failOnNoEncoding` to `true`
12+
1. Remove possibility to send unknown reports in Omni to Codecov. Unfortunately Codecov crashes with unknown reports. The only way to check the correct format of the report is essentially to provide the implementation to do that. In this way report sending to Codecov becomes restricted to the known formats to Omni.
13+
2. Remove banned file name list - Since the algorithm no longer relies on the filename, it doesn't make sense anymore to keep doing that. Therefore, the banned list is removed.
1014

1115
###### Bugs
1216

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.jesperancinha.plugins</groupId>
88
<artifactId>omni-coveragereporter-commons</artifactId>
9-
<version>0.1.4</version>
9+
<version>0.1.5</version>
1010

1111
<packaging>jar</packaging>
1212

@@ -36,7 +36,7 @@
3636
<connection>scm:git:git://github.com/JEsperancinhaOrg.git</connection>
3737
<developerConnection>scm:git:git://github.com/JEsperancinhaOrg.git</developerConnection>
3838
<url>https://github.com/JEsperancinhaOrg/omni-reporter-commons</url>
39-
<tag>0.1.4</tag>
39+
<tag>0.1.5</tag>
4040
</scm>
4141
<distributionManagement>
4242
<snapshotRepository>
@@ -89,7 +89,7 @@
8989
<coverage-parser_2.12.version>4.4.2</coverage-parser_2.12.version>
9090
<codacy-coverage-reporter.version>7.1.0</codacy-coverage-reporter.version>
9191
<logback-classic.version>1.3.0-alpha13</logback-classic.version>
92-
<omni-coveragereporter-maven-plugin.version>0.1.4</omni-coveragereporter-maven-plugin.version>
92+
<omni-coveragereporter-maven-plugin.version>0.1.5</omni-coveragereporter-maven-plugin.version>
9393
</properties>
9494

9595
<dependencies>

src/main/kotlin/org/jesperancinha/plugins/omni/reporter/domain/reports/OmniFileAdapters.kt

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import org.jesperancinha.plugins.omni.reporter.domain.api.TEMP_DIR_VARIABLE
66
import org.jesperancinha.plugins.omni.reporter.parsers.readXmlValue
77
import org.jesperancinha.plugins.omni.reporter.parsers.snakeCaseJsonObjectMapper
88
import org.jesperancinha.plugins.omni.reporter.parsers.xmlObjectMapper
9+
import org.slf4j.Logger
910
import org.slf4j.LoggerFactory
1011
import java.io.File
1112
import java.nio.file.Path
@@ -92,31 +93,41 @@ class OmniJacocoExecFileAdapter(
9293

9394
private val xmlReport = File(System.getProperty(TEMP_DIR_VARIABLE), "jacoco-${UUID.randomUUID()}.xml")
9495

95-
override fun getParentAdapter(): OmniReportParentFileAdapter {
96+
private val innerParsedReport = OmniJacocoReportParserCommand(
97+
execFiles = listOf(report),
98+
classFiles = jarFile?.run { listOf(jarFile) } ?: emptyList(),
99+
xmlReport = xmlReport
100+
).parse()
96101

97-
return OmniJacocoReportParserCommand(
98-
execFiles = listOf(report),
99-
classFiles = jarFile?.run { listOf(jarFile) } ?: emptyList(),
100-
xmlReport = xmlReport
101-
).parse().let {
102-
OmniJacocoReportParentFileAdapter(
103-
it,
104-
root,
105-
includeBranchCoverage,
106-
)
107-
}
102+
override fun getParentAdapter(): OmniReportParentFileAdapter {
103+
logger.info("- Found jar file ${jarFile?.absolutePath} for jacoco exec file ${report.absolutePath}")
104+
return OmniJacocoReportParentFileAdapter(
105+
innerParsedReport,
106+
root,
107+
includeBranchCoverage,
108+
)
108109
}
109110

110111
override fun generatePayload(failOnUnknown: Boolean, compiledSourcesDirs: List<File>): String {
111112
val reportObject: Report = readXmlValue(xmlReport.inputStream())
112-
val copy = reportObject.copy(
113+
if (reportObject.packages.isEmpty()) {
114+
logger.warn("- Jacoco Report XML generated file ${xmlReport.absolutePath} appears to be empty!")
115+
logger.warn("- Actual file content is: ${xmlReport.readText()}")
116+
}
117+
val reportWithCorrectedPAths = reportObject.copy(
113118
packages = reportObject.packages.mapNotNull { p: Package ->
114119
val newName = findNewPackageName(root, p, compiledSourcesDirs)
115120
newName?.let { p.copy(name = newName) }
116121
?: if (failOnUnknown) throw CodecovPackageNotFoundException(p.name) else null
117122
}
118123
)
119-
return xmlObjectMapper.writeValueAsString(copy)
124+
val generatedReport = xmlObjectMapper.writeValueAsString(reportWithCorrectedPAths)
125+
logger.debug("- Report payload of corrected generated Jacoco File ${xmlReport.absolutePath} is $generatedReport")
126+
return generatedReport
127+
}
128+
129+
companion object {
130+
val logger: Logger = LoggerFactory.getLogger(OmniJacocoExecFileAdapter::class.java)
120131
}
121132
}
122133

src/main/kotlin/org/jesperancinha/plugins/omni/reporter/domain/reports/OmniJacocoExecDomain.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ class OmniJacocoReportParserCommand(
4444
visitor.visitInfo(loader.sessionInfoStore.infos, loader.executionDataStore.contents)
4545
visitor.visitBundle(bundle, MultiSourceFileLocator(4))
4646
visitor.visitEnd()
47-
return this.xmlReport.inputStream().readJacocoReport(failOnXmlParseError)
47+
val readJacocoReport = this.xmlReport.inputStream().readJacocoReport(failOnXmlParseError)
48+
logger.debug("- Generated XML Jacoco report with content ${this.xmlReport.readText()}")
49+
return readJacocoReport
4850
}
4951

5052
companion object {

src/main/kotlin/org/jesperancinha/plugins/omni/reporter/processors/CodacyProcessor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class CodacyProcessor(
5252
token = token,
5353
apiToken = apiToken,
5454
pipeline = currentPipeline,
55-
root = projectBaseDir ?: throw ProjectDirectoryNotFoundException(),
55+
root = projectBaseDir,
5656
failOnUnknown = failOnUnknown,
5757
failOnXmlParseError = failOnXmlParseError,
5858
language = language

src/main/kotlin/org/jesperancinha/plugins/omni/reporter/processors/Processor.kt

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,9 @@ import org.jesperancinha.plugins.omni.reporter.ProjectDirectoryNotFoundException
55
import org.jesperancinha.plugins.omni.reporter.domain.reports.*
66
import java.io.File
77

8-
private val CODECOV_SUPPORTED_REPORTS = arrayOf(
9-
"jacoco" to "xml",
10-
"lcov" to "txt",
11-
"lcov" to "info",
12-
"gcov" to "txt",
13-
"golang" to "txt",
14-
"lcov" to "txt",
15-
"coverage" to "xml",
16-
"coverage" to "json",
17-
"cobertura" to "xml",
18-
"clover" to "xml"
19-
)
20-
21-
228
private val KNOWN_TEST_DIRECTORIES = arrayOf(
239
"test-classes"
2410
)
25-
private val CODECOV_UNSUPPORTED_REPORTS = arrayOf(
26-
"coverage-final" to "json"
27-
)
28-
2911

3012
/**
3113
* Created by jofisaes on 05/01/2022
@@ -192,17 +174,15 @@ internal fun List<OmniProject?>.toAllCodecovSupportedFiles(
192174
.filter { !reportRejectList.contains(it.name) }
193175
.filter { report ->
194176
report.isFile
195-
&& CODECOV_SUPPORTED_REPORTS.any { (name, ext) -> report.name.startsWith(name) && report.extension == ext }
196-
&& !CODECOV_UNSUPPORTED_REPORTS.any { (name, ext) -> report.name.startsWith(name) && report.extension == ext }
197177
&& project.build?.let { build ->
198178
supportedPredicate(
199179
build.testOutputDirectory,
200180
report
201181
)
202182
} ?: false
203183
}
204-
.map { report ->
205-
mapReportFile(report, project, supportedPredicate, false, root) ?: OmniGenericFileAdapter(report)
184+
.mapNotNull { report ->
185+
mapReportFile(report, project, supportedPredicate, false, root)
206186
}
207187
.distinct()
208188
}.distinct()

0 commit comments

Comments
 (0)