Skip to content

Commit

Permalink
[dev] doco and plugin updates
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangamble committed Aug 29, 2017
1 parent 6ddb838 commit fd9cd17
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target
commitlevelcoveragereport.iml
.idea/
NOTES.md
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Then run this:

# Result File Location

target/site/jacoco-ut/coverage-per-commit.txt
target/site/coverage-per-commit.txt



Expand Down
117 changes: 104 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,65 +1,62 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.juliangamble</groupId>
<artifactId>commit-level-coverage-report</artifactId>
<version>1.0</version>
<packaging>maven-plugin</packaging>

<name>commit-level-coverage-report</name>
<description>This project enables coverage reporting at a commit level</description>
<url>https://github.com/juliangamble/commit-level-coverage-report</url>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>Julian Gamble</name>
<email>mail@juliangamble.com</email>
<organization>Julian Gamble Inc</organization>
<organizationUrl>http://www.juliangamble.com</organizationUrl>
</developer>
</developers>
<scm>
<url>https://github.com/juliangamble/commit-level-coverage-report</url>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<prerequisites>
<maven>2.2.1</maven>
</prerequisites>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<!-- annotations are needed only to build the plugin: -->
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.java7</artifactId>
<version>3.7.1.201504261725-r</version>
</dependency>

<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.10-SNAPSHOT</version>
<!-- version for Java 7 -->
<!-- <version>0.6.5.201403032054</version> -->

</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -71,8 +68,17 @@
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>

</dependencies>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<resources>
<resource>
Expand All @@ -81,7 +87,7 @@
</resource>
</resources>
<plugins>
<plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5</version>
Expand All @@ -96,6 +102,31 @@
<phase>process-classes</phase>
</execution>
</executions>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5</version>
<configuration>
<goalPrefix>plugin</goalPrefix>
<outputDirectory>target/dir</outputDirectory>
</configuration>
<executions>
<execution>
<id>default-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
<phase>process-classes</phase>
</execution>
<execution>
<id>help-descriptor</id>
<goals>
<goal>helpmojo</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
<!-- explicitly make this work with a JDK 7 compiler -->
<plugin>
Expand All @@ -107,6 +138,66 @@
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
20 changes: 10 additions & 10 deletions src/main/java/com/github/juliangamble/util/JGitUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public class JGitUtils {
* Returns a list of commits since the minimum date starting from the
* specified object id.
*
* @param repository
* @param repository The Git repository to scan
* @param objectId
* if unspecified, HEAD is assumed.
* @param minimumDate
* @param minimumDate The date to scan back through the git log
* @return list of commits
*/
public static List<RevCommit> getRevLog(Repository repository, String objectId, Date minimumDate) {
Expand Down Expand Up @@ -71,7 +71,7 @@ public static List<RevCommit> getRevLog(Repository repository, String objectId,
* Determine if a repository has any commits. This is determined by checking
* the for loose and packed objects.
*
* @param repository
* @param repository The Git repository to scan
* @return true if the repository has commits
*/
public static boolean hasCommits(Repository repository) {
Expand All @@ -87,9 +87,9 @@ public static boolean hasCommits(Repository repository) {
* whatever branch HEAD points to, but if HEAD points to nothing it returns
* the most recently updated branch.
*
* @param repository
* @param repository The Git repository to scan
* @return the objectid of a branch
* @throws Exception
* @throws Exception If there is a file issue
*/
public static ObjectId getDefaultBranch(Repository repository) throws Exception {
ObjectId object = repository.resolve(Constants.HEAD);
Expand Down Expand Up @@ -117,12 +117,12 @@ public static ObjectId getDefaultBranch(Repository repository) throws Exception
* Returns the list of local branches in the repository. If repository does
* not exist or is empty, an empty list is returned.
*
* @param repository
* @param repository The Git repository to scan
* @param fullName
* if true, /refs/heads/yadayadayada is returned. If false,
* yadayadayada is returned.
* @param maxCount
* if < 0, all local branches are returned
* if &lt; 0, all local branches are returned
* @return list of local branches
*/
public static List<RefModel> getLocalBranches(Repository repository, boolean fullName,
Expand All @@ -133,7 +133,7 @@ public static List<RefModel> getLocalBranches(Repository repository, boolean ful
/**
* Retrieves a Java Date from a Git commit.
*
* @param commit
* @param commit The commit to examine
* @return date of the commit or Date(0) if the commit is null
*/
public static Date getAuthorDate(RevCommit commit) {
Expand All @@ -147,7 +147,7 @@ public static Date getAuthorDate(RevCommit commit) {
* Returns a list of references in the repository matching "refs". If the
* repository is null or empty, an empty list is returned.
*
* @param repository
* @param repository The Git repository to scan
* @param refs
* if unspecified, all refs are returned
* @param fullName
Expand Down Expand Up @@ -193,7 +193,7 @@ private static List<RefModel> getRefs(Repository repository, String refs, boolea
/**
* Log an error message and exception.
*
* @param t
* @param t The error reference
* @param repository
* if repository is not null it MUST be the {0} parameter in the
* pattern.
Expand Down

0 comments on commit fd9cd17

Please sign in to comment.