Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Conversation

ChaitanyaPramod
Copy link
Contributor

@ChaitanyaPramod ChaitanyaPramod commented Jun 19, 2016

Fixes #99

@ChaitanyaPramod
Copy link
Contributor Author

Will reopen after fixing test

@kageiit
Copy link
Contributor

kageiit commented Oct 27, 2016

@ChaitanyaPramod what happened to this PR?

@ChaitanyaPramod ChaitanyaPramod force-pushed the add_jacoco_support branch 2 times, most recently from 68ca588 to 81b84aa Compare March 30, 2018 22:52
@coveralls
Copy link

coveralls commented Mar 30, 2018

Coverage Status

Coverage decreased (-0.2%) to 90.464% when pulling 6277313 on ChaitanyaPramod:add_jacoco_support into 6a1010c on uber:master.

@kageiit
Copy link
Contributor

kageiit commented Mar 30, 2018

Thanks for reviving this PR!

<orderEntry type="library" name="Maven: net.sourceforge.nekohtml:nekohtml:1.9.13" level="project" />
<orderEntry type="library" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.plugins:jacoco:1.0.19" level="project" />
<orderEntry type="library" name="Maven: org.jacoco:org.jacoco.report:0.7.4.201502262128" level="project" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind using jacoco 0.8.1 which is the latest stable

<orderEntry type="library" name="Maven: org.jacoco:org.jacoco.core:0.7.4.201502262128" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-debug-all:5.0.1" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.kohsuke:asm5:5.0.1" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm:5.0.1" level="project" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest jacoco requires asm 6 for java 9/10 support

Copy link
Contributor

@kageiit kageiit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please address comments

build.gradle Outdated
optionalJenkinsPlugins 'org.jenkins-ci.plugins:junit:1.6@jar'
optionalJenkinsPlugins 'org.jenkins-ci.plugins:cobertura:1.9.6@jar'
optionalJenkinsPlugins 'org.jenkins-ci.plugins:jacoco:2.0.1@jar'
providedCompile 'org.jacoco:org.jacoco.report:0.7.5.201505241946'
Copy link
Contributor Author

@ChaitanyaPramod ChaitanyaPramod Mar 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kageiit

Do you mind using jacoco 0.8.1 which is the latest stable

latest jacoco requires asm 6 for java 9/10 support

Jacoco is on the compile classpath only so compiler can find its symbols for compilation. Jacoco, at runtime, comes from Jacoco Jenkins plugin. Updating Jacoco, therefore, would be out of this PR's scope and would belong in the Jacoco plugin. Jacoco plugin 3.0.1 uses Jacoco 0.8.0 and ASM 6.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

fakeHitCount = 1;
break;
case ICounter.PARTLY_COVERED:
fakeHitCount = 1; // Harbormaster format doesn't allow for partially covered lines
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider partially covered lines as uncovered instead

}

@Test
@Ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finish this test

@kageiit
Copy link
Contributor

kageiit commented Jun 12, 2018

@ChaitanyaPramod plans to finish the test in the PR? Planning to cut a release soon and would be good to get this merged before that

@ChaitanyaPramod
Copy link
Contributor Author

Finally in working state.
jacoco

I'd like the test finished before merging, would give me lot more peace of mind. Will not be able to spend more time on this until the next weekend. Contributions to tests are welcome. (I'd use uncovered lines as guide)

Would encourage community to try this out and report bugs, if any before merging.

return null;
}

CoverageProvider coverage = Objects.firstNonNull(coberturaCoverage, jacocoCoverage);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure this logic is sound. Cobertura plugin could be available but only jacoco report could have been generated. We want to select the provider based on which one has coverage available.

Ideally we would support a hybrid coverage provider that can aggregate coverage results from all available providers. This can be a follow up/enhancement however

CoverageProvider jacocoCoverage = jacocoProvider.getInstance();

if (coverage == null) {
if (coberturaCoverage == null && jacocoCoverage == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets pick the first non null coverage provider that satisfies

coverage.hasCoverage() == true

HashMap<String, List<Integer>> lineCoverage = new HashMap<String, List<Integer>>();

try {
ExecutionFileLoader executionFileLoader = jacocoAction.getJacocoReport().parse(null, null);
Copy link
Contributor

@kageiit kageiit Jun 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we only need the getJacocoReport(), we should not be gating this feature on the presence of a jacoco build step. All we need is for the plugin to be available in jenkins so we have the runtime components to parse a coverage result. We should be able to use it to parse the result and provide coverage. The cobertura provider does not need the cobertura plugin to be applied to the job either, so we should mirror the same behavior by adding a config option to the phab jenkins plugint to accept the path to the jacoco xml report.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We pick a few things from the JacocoPublisher attached to the current build, so we can't do that.
That said, I prefer we take advantage of Jenkins ecosystem and not recreate the coverage plugin's function here. It's trivial to add a coverage plugin to a job and we get to maintain minimal code here.

Copy link
Contributor

@kageiit kageiit Jun 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. Feel free to leave it this way. We will add a way to not have the jacoco plugin added to the job and still use the functionality in a separate change.

@ChaitanyaPramod ChaitanyaPramod force-pushed the add_jacoco_support branch 2 times, most recently from 68f5d87 to b6b328f Compare June 24, 2018 17:05
@ChaitanyaPramod
Copy link
Contributor Author

The Java 7 test fails on CI, but works locally. The CI uses older version of Java (1.7.0_121) which doesn't have TLS 1.2 enabled by default, and hence is not able to connect to now TLS 1.2 only maven repositories.
The trusty images have newer Java but that seems to be a problem for us (#237) as well.

Copy link
Contributor

@kageiit kageiit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor nits to address. LGTM after that

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please avoid star imports?

You may want to configure your IDE to not do this

i.remove();
}
}
if (!coverageProviders.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a logger.info statement here about which coverage we picked if its a non empty list?

It will help with debugging issues

@ChaitanyaPramod
Copy link
Contributor Author

@kageiit's earlier concerns have been addressed and the PR is ready for review.

PS: I think we should close #266 before merging the other PRs

@kageiit
Copy link
Contributor

kageiit commented Sep 10, 2018

@ChaitanyaPramod ci issues should be fixed. Can you please rebase?

@ChaitanyaPramod
Copy link
Contributor Author

@kageiit Rebased, and the CI build has succeeded.

@kageiit kageiit merged commit b8c9c1e into uber-archive:master Sep 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants