Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: trautonen/coveralls-maven-plugin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.2.1
Choose a base ref
...
head repository: trautonen/coveralls-maven-plugin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.0.0
Choose a head ref
  • 20 commits
  • 49 files changed
  • 2 contributors

Commits on Aug 19, 2015

  1. Verified

    This commit was signed with the committer’s verified signature.
    renovate-bot Mend Renovate
    Copy the full SHA
    c125435 View commit details
  2. Reordered changelog.

    trautonen committed Aug 19, 2015
    Copy the full SHA
    8c2afa3 View commit details
  3. Changelog for 3.2.0.

    trautonen committed Aug 19, 2015
    Copy the full SHA
    00344ea View commit details

Commits on Aug 20, 2015

  1. Cache all sources in json writer and write only at the end of the run…

    …. Enables mergeing coverage data from several reports
    psiniemi authored and trautonen committed Aug 20, 2015
    Copy the full SHA
    6140868 View commit details
  2. Switch source to source digest

    psiniemi authored and trautonen committed Aug 20, 2015
    Copy the full SHA
    0c95069 View commit details
  3. Cover one more line

    psiniemi authored and trautonen committed Aug 20, 2015
    Copy the full SHA
    b828141 View commit details
  4. Copy the full SHA
    f976f40 View commit details
  5. Copy the full SHA
    c41ff8a View commit details
  6. Copy the full SHA
    a1f0c79 View commit details
  7. Style fix.

    trautonen committed Aug 20, 2015
    Copy the full SHA
    47c9a77 View commit details
  8. Style fix.

    trautonen committed Aug 20, 2015
    Copy the full SHA
    1539efa View commit details

Commits on Aug 21, 2015

  1. #85: Reintroduce UniqueSourceCallback with more complete SourceCallba…

    …ck interface to fix coverage traces.
    trautonen committed Aug 21, 2015
    Copy the full SHA
    abf890d View commit details
  2. Code style fixes.

    trautonen committed Aug 21, 2015
    Copy the full SHA
    e7109b0 View commit details

Commits on Aug 22, 2015

  1. Copy the full SHA
    d907dc8 View commit details

Commits on Aug 23, 2015

  1. Copy the full SHA
    6d30374 View commit details
  2. #77: Support configurable timestamp format but honor maven.build.time…

    …stamp.format if available.
    trautonen committed Aug 23, 2015
    Copy the full SHA
    ecb0e5f View commit details

Commits on Aug 24, 2015

  1. Treat sources with classifier as non unique with merged coverages to …

    …provide more accurate results on Coveralls.
    trautonen committed Aug 24, 2015
    Copy the full SHA
    69fe590 View commit details
  2. Copy the full SHA
    0351d01 View commit details

Commits on Aug 26, 2015

  1. Copy the full SHA
    1b1d640 View commit details
  2. Updated to version 4.0.0.

    trautonen committed Aug 26, 2015
    Copy the full SHA
    eedf04f View commit details
Showing with 826 additions and 296 deletions.
  1. +9 −2 CHANGELOG.md
  2. +1 −1 README.md
  3. +3 −2 pom.xml
  4. +1 −1 sample/README.md
  5. +12 −0 sample/module2/src/test/java/org/eluder/coverage/sample/PartialCoverageIT.java
  6. +36 −6 sample/pom.xml
  7. +22 −12 src/main/java/org/eluder/coveralls/maven/plugin/CoverallsReportMojo.java
  8. +7 −10 src/main/java/org/eluder/coveralls/maven/plugin/domain/GitRepository.java
  9. +52 −15 src/main/java/org/eluder/coveralls/maven/plugin/domain/Source.java
  10. +22 −21 src/main/java/org/eluder/coveralls/maven/plugin/json/JsonWriter.java
  11. +7 −9 src/main/java/org/eluder/coveralls/maven/plugin/logging/CoverageTracingLogger.java
  12. +1 −1 src/main/java/org/eluder/coveralls/maven/plugin/logging/Logger.java
  13. +9 −9 src/main/java/org/eluder/coveralls/maven/plugin/parser/AbstractXmlEventParser.java
  14. +10 −8 src/main/java/org/eluder/coveralls/maven/plugin/source/AbstractSourceLoader.java
  15. +40 −4 src/main/java/org/eluder/coveralls/maven/plugin/source/ChainingSourceCallback.java
  16. +3 −3 src/main/java/org/eluder/coveralls/maven/plugin/source/MultiSourceLoader.java
  17. +5 −5 src/main/java/org/eluder/coveralls/maven/plugin/source/ScanSourceLoader.java
  18. +18 −2 src/main/java/org/eluder/coveralls/maven/plugin/source/SourceCallback.java
  19. +20 −25 src/main/java/org/eluder/coveralls/maven/plugin/source/UniqueSourceCallback.java
  20. +3 −1 src/main/java/org/eluder/coveralls/maven/plugin/util/CoverageParsersFactory.java
  21. +1 −1 src/main/java/org/eluder/coveralls/maven/plugin/util/ExistingFiles.java
  22. +3 −3 src/main/java/org/eluder/coveralls/maven/plugin/util/MavenProjectCollector.java
  23. +44 −0 src/main/java/org/eluder/coveralls/maven/plugin/util/Md5DigestInputStream.java
  24. +5 −5 src/main/java/org/eluder/coveralls/maven/plugin/util/SourceLoaderFactory.java
  25. +66 −0 src/main/java/org/eluder/coveralls/maven/plugin/util/TimestampParser.java
  26. +5 −6 src/main/java/org/eluder/coveralls/maven/plugin/validation/JobValidator.java
  27. +2 −2 src/main/java/org/eluder/coveralls/maven/plugin/validation/ValidationError.java
  28. +4 −4 src/main/java/org/eluder/coveralls/maven/plugin/validation/ValidationErrors.java
  29. +7 −6 src/test/java/org/eluder/coveralls/maven/plugin/CoverageFixture.java
  30. +1 −1 src/test/java/org/eluder/coveralls/maven/plugin/CoverallsReportMojoTest.java
  31. +3 −2 src/test/java/org/eluder/coveralls/maven/plugin/domain/JobTest.java
  32. +60 −5 src/test/java/org/eluder/coveralls/maven/plugin/domain/SourceTest.java
  33. +8 −4 src/test/java/org/eluder/coveralls/maven/plugin/json/JsonWriterTest.java
  34. +20 −18 src/test/java/org/eluder/coveralls/maven/plugin/logging/CoverageTracingLoggerTest.java
  35. +63 −38 src/test/java/org/eluder/coveralls/maven/plugin/parser/AbstractCoverageParserTest.java
  36. +6 −6 src/test/java/org/eluder/coveralls/maven/plugin/parser/JaCoCoParserTest.java
  37. +6 −5 src/test/java/org/eluder/coveralls/maven/plugin/source/DirectorySourceLoaderTest.java
  38. +7 −7 src/test/java/org/eluder/coveralls/maven/plugin/source/MultiSourceLoaderTest.java
  39. +8 −7 src/test/java/org/eluder/coveralls/maven/plugin/source/ScanSourceLoaderTest.java
  40. +23 −9 src/test/java/org/eluder/coveralls/maven/plugin/source/UniqueSourceCallbackTest.java
  41. +7 −6 src/test/java/org/eluder/coveralls/maven/plugin/source/UrlSourceLoaderTest.java
  42. +63 −0 src/test/java/org/eluder/coveralls/maven/plugin/util/Md5DigestInputStreamTest.java
  43. +12 −3 src/test/java/org/eluder/coveralls/maven/plugin/util/TestIoUtil.java
  44. +74 −0 src/test/java/org/eluder/coveralls/maven/plugin/util/TimestampParserTest.java
  45. +16 −17 src/test/resources/cobertura.xml
  46. +1 −1 src/test/resources/jacoco1.xml
  47. +27 −0 src/test/resources/jacoco2-it.xml
  48. +1 −1 src/test/resources/jacoco2.xml
  49. +2 −2 src/test/resources/saga.xml
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Changelog

## 3.2.0

- #82: Improved error message for duplicate classes in different modules
- #76: Property to allow Coveralls service fail without build failure
- #74: Handle transitive logging dependencies better


## 3.1.0

- #63: Directory scanning source loader
- #65, #66, #68: Support for Shippable CI
- #67: Configurable project basedir
- #65, #66, #68: Support for Shippable CI
- #63: Directory scanning source loader


## 3.0.1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ Set up the Coveralls maven plugin in the build section of the project pom.xml:
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>3.2.0</version>
<version>4.0.0</version>
<configuration>
<repoToken>yourcoverallsprojectrepositorytoken</repoToken>
</configuration>
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>3.2.0</version>
<version>4.0.0</version>
<packaging>maven-plugin</packaging>

<name>coveralls-maven-plugin</name>
@@ -47,11 +47,12 @@
</scm>

<properties>
<java.version>1.7</java.version>
<httpclient.version>4.5</httpclient.version>
<jackson.version>2.6.1</jackson.version>
<jgit.version>4.0.1.201506240215-r</jgit.version>
<maven.version>3.0</maven.version>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ssa</maven.build.timestamp.format>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
<timestamp>${maven.build.timestamp}</timestamp>
</properties>

2 changes: 1 addition & 1 deletion sample/README.md
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ mvn -Pcobertura clean cobertura:cobertura
### JaCoCo

```
mvn -Pjacoco clean test jacoco:report
mvn -Pjacoco clean verify jacoco:report
```


Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.eluder.coverage.sample;

import org.junit.Test;

public class PartialCoverageIT {

@Test
public void testSum() {
new PartialCoverage().partial(false);
}

}
42 changes: 36 additions & 6 deletions sample/pom.xml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
<parent>
<groupId>org.eluder</groupId>
<artifactId>eluder-parent</artifactId>
<version>6</version>
<version>7</version>
<relativePath></relativePath>
</parent>

@@ -17,10 +17,12 @@
<packaging>pom</packaging>

<properties>
<maven.jacoco.version>0.7.2.201409121644</maven.jacoco.version>
<maven.cobertura.version>2.6</maven.cobertura.version>
<maven.jacoco.version>0.7.5.201505241946</maven.jacoco.version>
<maven.cobertura.version>2.7</maven.cobertura.version>
<maven.jasmine.version>2.0</maven.jasmine.version>
<maven.saga.version>1.5.4</maven.saga.version>
</properties>

<modules>
<module>module1</module>
<module>module2</module>
@@ -38,6 +40,12 @@
</sourceDirectories>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>

@@ -74,10 +82,29 @@
<version>${maven.jacoco.version}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-prepare-agent-integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-report-integration</id>
<goals>
<goal>report-integration</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
@@ -90,7 +117,7 @@
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.5</version>
<version>${maven.jasmine.version}</version>
<executions>
<execution>
<goals>
@@ -102,12 +129,13 @@
<jsSrcDir>${project.basedir}/src/main/resources/</jsSrcDir>
<jsTestSrcDir>${project.basedir}/src/test/specs</jsTestSrcDir>
<keepServerAlive>true</keepServerAlive>
<webDriverClassName>org.openqa.selenium.htmlunit.HtmlUnitDriver</webDriverClassName>
</configuration>
</plugin>
<plugin>
<groupId>com.github.timurstrekalov</groupId>
<artifactId>saga-maven-plugin</artifactId>
<version>1.5.3</version>
<version>${maven.saga.version}</version>
<executions>
<execution>
<goals>
@@ -120,6 +148,8 @@
<outputDir>${project.build.directory}/saga-coverage</outputDir>
<noInstrumentPatterns>
<pattern>.*/spec/.*</pattern>
<pattern>.*/classpath/.*</pattern>
<pattern>.*/webjars/.*</pattern>
</noInstrumentPatterns>
</configuration>
</plugin>
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@
import org.eluder.coveralls.maven.plugin.source.UniqueSourceCallback;
import org.eluder.coveralls.maven.plugin.util.CoverageParsersFactory;
import org.eluder.coveralls.maven.plugin.util.SourceLoaderFactory;
import org.eluder.coveralls.maven.plugin.util.TimestampParser;

import java.io.File;
import java.io.IOException;
@@ -163,12 +164,19 @@ public class CoverallsReportMojo extends AbstractMojo {
*/
@Parameter(property = "pullRequest")
protected String pullRequest;


/**
* Build timestamp format. Must be in format supported by SimpleDateFormat.
*/
@Parameter(property = "timestampFormat", defaultValue = "${maven.build.timestamp.format}")
protected String timestampFormat;

/**
* Build timestamp. Must be in 'yyyy-MM-dd HH:mm:ssa' format.
* Build timestamp. Must be in format defined by 'timestampFormat' if it's available or in
* default timestamp format yyyy-MM-dd'T'HH:mm:ss'Z'.
*/
@Parameter(property = "timestamp", defaultValue = "${timestamp}")
protected Date timestamp;
@Parameter(property = "timestamp", defaultValue = "${maven.build.timestamp}")
protected String timestamp;

/**
* Dry run Coveralls report without actually sending it.
@@ -222,13 +230,13 @@ public final void execute() throws MojoExecutionException, MojoFailureException
List<CoverageParser> parsers = createCoverageParsers(sourceLoader);
JsonWriter writer = createJsonWriter(job);
CoverallsClient client = createCoverallsClient();
List<Logger> reporters = new ArrayList<Logger>();
List<Logger> reporters = new ArrayList<>();
reporters.add(new JobLogger(job));
SourceCallback sourceCallback = createSourceCallbackChain(writer, reporters);
reporters.add(new DryRunLogger(job.isDryRun(), writer.getCoverallsFile()));

report(reporters, Position.BEFORE);
writeCoveralls(writer, sourceLoader, sourceCallback, parsers);
writeCoveralls(writer, sourceCallback, parsers);
report(reporters, Position.AFTER);

if (!job.isDryRun()) {
@@ -282,7 +290,7 @@ protected Environment createEnvironment() {
*/
protected List<ServiceSetup> getServices() {
Map<String, String> env = System.getenv();
List<ServiceSetup> services = new ArrayList<ServiceSetup>();
List<ServiceSetup> services = new ArrayList<>();
services.add(new Shippable(env));
services.add(new Travis(env));
services.add(new Circle(env));
@@ -294,21 +302,23 @@ protected List<ServiceSetup> getServices() {

/**
* @return job that describes the coveralls report
* @throws ProcessingException if processing of timestamp fails
* @throws IOException if an I/O error occurs
*/
protected Job createJob() throws IOException {
protected Job createJob() throws ProcessingException, IOException {
Git git = new GitRepository(basedir).load();
Date time = new TimestampParser(timestampFormat).parse(timestamp);
return new Job()
.withRepoToken(repoToken)
.withServiceName(serviceName)
.withServiceJobId(serviceJobId)
.withServiceBuildNumber(serviceBuildNumber)
.withServiceBuildUrl(serviceBuildUrl)
.withServiceEnvironment(serviceEnvironment)
.withTimestamp(timestamp)
.withDryRun(dryRun)
.withBranch(branch)
.withPullRequest(pullRequest)
.withTimestamp(time)
.withGit(git);
}

@@ -344,16 +354,16 @@ protected SourceCallback createSourceCallbackChain(final JsonWriter writer, fina
return chain;
}

protected void writeCoveralls(final JsonWriter writer, final SourceLoader sourceLoader, final SourceCallback sourceCallback, final List<CoverageParser> parsers) throws ProcessingException, IOException {
protected void writeCoveralls(final JsonWriter writer, final SourceCallback sourceCallback, final List<CoverageParser> parsers) throws ProcessingException, IOException {
try {
getLog().info("Writing Coveralls data to " + writer.getCoverallsFile().getAbsolutePath() + "...");
long now = System.currentTimeMillis();
writer.writeStart();
sourceCallback.onBegin();
for (CoverageParser parser : parsers) {
getLog().info("Processing coverage report from " + parser.getCoverageFile().getAbsolutePath());
parser.parse(sourceCallback);
}
writer.writeEnd();
sourceCallback.onComplete();
long duration = System.currentTimeMillis() - now;
getLog().info("Successfully wrote Coveralls data in " + duration + "ms");
} finally {
Original file line number Diff line number Diff line change
@@ -26,11 +26,6 @@
* %[license]
*/

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -39,6 +34,11 @@
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class GitRepository {

private final File sourceDirectory;
@@ -48,14 +48,11 @@ public GitRepository(final File sourceDirectory) {
}

public Git load() throws IOException {
Repository repository = new RepositoryBuilder().findGitDir(this.sourceDirectory).build();
try {
try (Repository repository = new RepositoryBuilder().findGitDir(this.sourceDirectory).build()) {
Git.Head head = getHead(repository);
String branch = getBranch(repository);
List<Git.Remote> remotes = getRemotes(repository);
return new Git(repository.getWorkTree(), head, branch, remotes);
} finally {
repository.close();
}
}

@@ -79,7 +76,7 @@ private String getBranch(final Repository repository) throws IOException {

private List<Git.Remote> getRemotes(final Repository repository) {
Config config = repository.getConfig();
List<Git.Remote> remotes = new ArrayList<Git.Remote>();
List<Git.Remote> remotes = new ArrayList<>();
for (String remote : config.getSubsections("remote")) {
String url = config.getString("remote", remote, "url");
remotes.add(new Git.Remote(remote, url));
Loading