Skip to content

Commit

Permalink
bump libs version (#10)
Browse files Browse the repository at this point in the history
* bump libs version
  • Loading branch information
SurpSG authored Jun 16, 2021
1 parent 63cde41 commit 065b35c
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 51 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The plugin does the next steps:
<plugin>
<groupId>com.github.surpsg</groupId>
<artifactId>diff-coverage-maven-plugin</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>
<configuration>
<!-- Required. diff content source. only one of file, URL or Git is allowed -->
<diffSource>
Expand Down
25 changes: 11 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>diff-coverage-maven-plugin</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
<packaging>maven-plugin</packaging>
<version>0.1.0</version>
<version>0.1.1</version>
<description>
Diff coverage maven plugin builds code coverage report of new and modified code based on a provided diff
</description>
Expand Down Expand Up @@ -55,10 +55,10 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>1.3.72</kotlin.version>
<kotlin.version>1.4.32</kotlin.version>
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
<kotlin.code.style>official</kotlin.code.style>
<junit.version>4.12</junit.version>
<junit.version>4.13.1</junit.version>
<maven.version>3.6.3</maven.version>

<diff.source>HEAD</diff.source>
Expand Down Expand Up @@ -92,7 +92,7 @@

<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
Expand All @@ -105,12 +105,12 @@
<dependency>
<groupId>com.github.form-com.diff-coverage-gradle</groupId>
<artifactId>jacoco-filtering-extension</artifactId>
<version>0.7.0</version>
<version>0.7.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>5.7.0.202003110725-r</version>
<version>5.12.0.202106070339-r</version>
</dependency>

<dependency>
Expand All @@ -122,9 +122,8 @@
</dependencies>

<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>

<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
Expand All @@ -133,14 +132,12 @@
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
Expand All @@ -157,7 +154,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<version>0.8.7</version>
<executions>
<execution>
<id>pre-unit-test</id>
Expand Down Expand Up @@ -213,7 +210,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
<configuration>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<postBuildHookScript>verify</postBuildHookScript>
Expand All @@ -238,7 +235,7 @@
<plugin>
<groupId>com.github.surpsg</groupId>
<artifactId>diff-coverage-maven-plugin</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>
<configuration>
<dataFile>${project.build.directory}/fullCoverage.exec</dataFile>
<diffSource>
Expand Down
8 changes: 1 addition & 7 deletions settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>${env.USERNAME}</username>
<password>${env.PASS}</password>
</server>
</servers>

<profiles>
<profile>
<id>ossrh</id>
Expand Down
11 changes: 8 additions & 3 deletions src/it/git-diff-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
<artifactId>it-check-passes</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -21,7 +26,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<version>0.8.7</version>
<executions>
<execution>
<goals>
Expand All @@ -33,7 +38,7 @@
<plugin>
<groupId>com.github.surpsg</groupId>
<artifactId>diff-coverage-maven-plugin</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>
<configuration>
<diffSource>
<git>HEAD</git>
Expand Down
11 changes: 8 additions & 3 deletions src/it/reports-generation-check/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
<artifactId>it-check-passes</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -21,7 +26,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<version>0.8.7</version>
<executions>
<execution>
<goals>
Expand All @@ -33,7 +38,7 @@
<plugin>
<groupId>com.github.surpsg</groupId>
<artifactId>diff-coverage-maven-plugin</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>
<configuration>
<diffSource>
<file>diffFile.patch</file>
Expand Down
11 changes: 8 additions & 3 deletions src/it/url-source-check/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
<artifactId>it-check-passes</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -21,7 +26,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<version>0.8.7</version>
<executions>
<execution>
<goals>
Expand All @@ -33,7 +38,7 @@
<plugin>
<groupId>com.github.surpsg</groupId>
<artifactId>diff-coverage-maven-plugin</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>
<configuration>
<diffSource>
<url>${project.baseUri}diffFile.patch</url>
Expand Down
11 changes: 8 additions & 3 deletions src/it/violation-rules-check/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
<artifactId>it-check-passes</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -21,7 +26,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<version>0.8.7</version>
<executions>
<execution>
<goals>
Expand All @@ -33,7 +38,7 @@
<plugin>
<groupId>com.github.surpsg</groupId>
<artifactId>diff-coverage-maven-plugin</artifactId>
<version>0.0.1</version>
<version>0.1.1</version>
<configuration>
<diffSource>
<file>diffFile.patch</file>
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.github.surpsg

import com.form.coverage.*
import com.form.coverage.DiffReport
import com.form.coverage.Report
import com.form.coverage.ReportType
import com.form.coverage.Violation
import com.form.coverage.report.ReportGenerator
import com.form.coverage.report.analyzable.AnalyzableReport
import com.form.coverage.report.analyzable.AnalyzableReportFactory
Expand Down
23 changes: 9 additions & 14 deletions src/main/kotlin/com/github/surpsg/diffsource/JgitDiff.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ package com.github.surpsg.diffsource
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.diff.DiffFormatter
import org.eclipse.jgit.lib.ConfigConstants
import org.eclipse.jgit.lib.CoreConfig
import org.eclipse.jgit.lib.ObjectId
import org.eclipse.jgit.lib.Repository
import org.eclipse.jgit.revwalk.RevTree
import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
import org.eclipse.jgit.treewalk.AbstractTreeIterator
import org.eclipse.jgit.treewalk.CanonicalTreeParser
import org.eclipse.jgit.treewalk.FileTreeIterator
import org.eclipse.jgit.treewalk.filter.TreeFilter
import org.slf4j.LoggerFactory
import java.io.ByteArrayOutputStream
import java.io.File
import java.lang.IllegalArgumentException
import java.util.logging.Logger

class JgitDiff(workingDir: File) {

Expand All @@ -31,8 +26,8 @@ class JgitDiff(workingDir: File) {
}.build()
} catch (e: IllegalArgumentException) {
throw IllegalArgumentException(
"Git directory not found in the project root ${workingDir.absolutePath}",
e
"Git directory not found in the project root ${workingDir.absolutePath}",
e
)
}

Expand All @@ -43,8 +38,8 @@ class JgitDiff(workingDir: File) {
initialize()

scan(
getTreeIterator(repository, commit),
FileTreeIterator(repository)
getTreeIterator(repository, commit),
FileTreeIterator(repository)
).forEach {
format(it)
}
Expand All @@ -59,16 +54,16 @@ class JgitDiff(workingDir: File) {
private fun DiffFormatter.initialize() {
setRepository(repository)
repository.config.setEnum(
ConfigConstants.CONFIG_CORE_SECTION,
null,
ConfigConstants.CONFIG_KEY_AUTOCRLF,
getCrlf()
ConfigConstants.CONFIG_CORE_SECTION,
null,
ConfigConstants.CONFIG_KEY_AUTOCRLF,
getCrlf()
)
pathFilter = TreeFilter.ALL
}

private fun getTreeIterator(repo: Repository, name: String): AbstractTreeIterator {
val id: ObjectId = repo.resolve(name)
val id: ObjectId = repo.resolve(name) ?: throw IllegalArgumentException("No such commit $name")
val parser = CanonicalTreeParser()
repo.newObjectReader().use { objectReader ->
RevWalk(repo).use { revWalk ->
Expand Down
5 changes: 3 additions & 2 deletions src/test/kotlin/com/github/surpsg/diffsource/JgitDiffTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class JgitDiffTest {
JgitDiff(File("unknown/file/location"))
}

@Test(expected = IllegalStateException::class)
@Test(expected = IllegalArgumentException::class)
fun `jgit should throw when no such commit`() {
JgitDiff(File(".")).obtain("UNKNOWN_COMMIT")
val jgitDiff = JgitDiff(File("."))
jgitDiff.obtain("UNKNOWN_COMMIT")
}
}

0 comments on commit 065b35c

Please sign in to comment.