Skip to content

Commit

Permalink
Gradle update
Browse files Browse the repository at this point in the history
  • Loading branch information
osiegmar committed Jul 23, 2023
1 parent 2d72ac5 commit 06b8b6d
Show file tree
Hide file tree
Showing 11 changed files with 177 additions and 157 deletions.
143 changes: 0 additions & 143 deletions build.gradle

This file was deleted.

145 changes: 145 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
plugins {
`java-library`
`maven-publish`
signing
checkstyle
pmd
jacoco
id("com.github.spotbugs") version "5.0.14"
id("me.champeau.jmh") version "0.7.1"
id("info.solidsoft.pitest") version "1.9.11"
id("ru.vyarus.animalsniffer") version "1.7.0"
}

group = "de.siegmar"
version = "2.2.2"

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
withJavadocJar()
withSourcesJar()
}

repositories {
mavenCentral()
}

sourceSets {
create("example") {
java.srcDir("src/example/java")
}
}

dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.3"))
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("org.junit.jupiter:junit-jupiter")

"exampleImplementation"(sourceSets.main.get().output)

signature("net.sf.androidscents.signature:android-api-level-26:8.0.0_r2@signature")
}

tasks.withType<com.github.spotbugs.snom.SpotBugsTask>().configureEach {
excludeFilter = file("config/spotbugs/config.xml")
reports.maybeCreate("xml").required = false
reports.maybeCreate("html").required = true
}

tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
}

pitest {
junit5PluginVersion = "1.1.2"
targetClasses = setOf("blackbox.*", "de.siegmar.*")
timestampedReports = false
}

pmd {
isConsoleOutput = true
ruleSets = emptyList()
ruleSetFiles = files("config/pmd/config.xml")
}

tasks.jacocoTestReport {
reports {
xml.required.set(true)
}
}

tasks.jacocoTestCoverageVerification {
violationRules {
rule {
limit {
counter = "BRANCH"
value = "COVEREDRATIO"
minimum = "1.0".toBigDecimal()
}
}
}
}

tasks.jmh {
warmupIterations = 2
iterations = 5
benchmarkMode = listOf("thrpt")
fork = 2
operationsPerInvocation = 1
}

tasks.jar {
manifest {
attributes("Automatic-Module-Name" to "de.siegmar.fastcsv")
}
}

publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "fastcsv"
from(components["java"])

pom {
name = "FastCSV"
description = "Ultra fast and simple RFC 4180 compliant CSV library."
url = "https://github.com/osiegmar/FastCSV"
licenses {
license {
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
scm {
url = "https://github.com/osiegmar/FastCSV"
connection = "scm:git:https://github.com/osiegmar/FastCSV.git"
}
developers {
developer {
id = "osiegmar"
name = "Oliver Siegmar"
email = "oliver@siegmar.de"
}
}
}
}
}
repositories {
maven {
name = "ossrh"
credentials(PasswordCredentials::class)
url = if (version.toString().endsWith("SNAPSHOT")) {
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
} else {
uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
}
}
}
}

signing {
sign(publishing.publications["maven"])
}
3 changes: 1 addition & 2 deletions config/pmd/config.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Custom Rules"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -13,7 +13,6 @@
<exclude name="JUnitTestContainsTooManyAsserts"/>
</rule>
<rule ref="category/java/errorprone.xml">
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="DataflowAnomalyAnalysis"/>
</rule>
<rule ref="category/java/performance.xml" />
Expand Down
15 changes: 15 additions & 0 deletions config/spotbugs/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>

<!-- false-positive bug https://github.com/spotbugs/spotbugs/issues/2083 -->
<Match>
<Bug pattern="EI_EXPOSE_REP"/>
<Or>
<And>
<Class name="de.siegmar.fastcsv.reader.NamedCsvReader"/>
<Field name="header"/>
</And>
</Or>
</Match>

</FindBugsFilter>
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "FastCSV"
14 changes: 7 additions & 7 deletions src/test/java/blackbox/reader/DataProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ private DataProvider() {
}

@SuppressWarnings({"PMD.AvoidInstantiatingObjectsInLoops", "PMD.AssignmentInOperand"})
static List<TestData> loadTestData(final String name) throws IOException {
final List<TestData> data = new ArrayList<>();
static List<GenericTestData> loadTestData(final String name) throws IOException {
final List<GenericTestData> data = new ArrayList<>();
try (BufferedReader r = resource(name)) {
String line;
int lineNo = 0;
Expand All @@ -36,7 +36,7 @@ static List<TestData> loadTestData(final String name) throws IOException {
final String input = matcher.group("input");
final String expected = matcher.group("expected");
final String flags = matcher.group("flags");
data.add(new TestData(lineNo, line, input, expected, flags));
data.add(new GenericTestData(lineNo, line, input, expected, flags));
}
}
}
Expand All @@ -49,7 +49,7 @@ private static BufferedReader resource(final String name) {
Objects.requireNonNull(DataProvider.class.getResourceAsStream(name)), StandardCharsets.UTF_8));
}

public static class TestData {
public static class GenericTestData {

private final int lineNo;
private final String line;
Expand All @@ -59,8 +59,8 @@ public static class TestData {
private final boolean readComments;
private final boolean skipComments;

TestData(final int lineNo, final String line, final String input, final String expected,
final String flags) {
GenericTestData(final int lineNo, final String line, final String input, final String expected,
final String flags) {
this.lineNo = lineNo;
this.line = line;
this.input = input;
Expand Down Expand Up @@ -100,7 +100,7 @@ public boolean isSkipComments() {

@Override
public String toString() {
return new StringJoiner(", ", DataProvider.TestData.class.getSimpleName() + "[", "]")
return new StringJoiner(", ", GenericTestData.class.getSimpleName() + "[", "]")
.add("lineNo=" + lineNo)
.add("line='" + line + "'")
.add("input='" + input + "'")
Expand Down
Loading

0 comments on commit 06b8b6d

Please sign in to comment.