Skip to content

To/#637 groovy spotless #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Create JavaDoc with java 17 instead of java 8
- Let JavDoc pass, if there are warnings **ATTENTION:** Should be removed, when JavaDoc is fixed! (cf. Issue [#494](https://github.com/ie3-institute/PowerSystemDataModel/issues/494))
- `BufferedCsvWriter` writes columns in the order, that the headline elements are defined [#434](https://github.com/ie3-institute/PowerSystemDataModel/issues/393)
- Cleaned up `IndividualTimeSeriesMetaInformation`-related methods in `CsvFileConnector` [#544](https://github.com/ie3-institute/PowerSystemDataModel/issues/544)
- Cleaned up `IndividualTimeSeriesMetaInformation`-related methods in `CsvFileConnector` [#544](https://github.com/ie3-institute/PowerSystemDataModel/issues/544)
- Fixed spotlessApply handling for `.groovy` files [#637](https://github.com/ie3-institute/PowerSystemDataModel/issues/637)

### Changed
- BREAKING: PvInput Model parameter name height changed to elevationAngle [#393](https://github.com/ie3-institute/PowerSystemDataModel/issues/393) :warning:
Expand Down
130 changes: 65 additions & 65 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
plugins {
id 'java' //java support
id 'groovy' // groovy support
id 'maven-publish'
id 'signing'
id 'pmd' // code check, working on source code
id 'com.diffplug.spotless' version '6.9.0'//code format
id 'com.github.spotbugs' version '5.0.9' // code check, working on byte code
id 'de.undercouch.download' version '5.1.0'
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
id 'jacoco' // java code coverage plugin
id "org.sonarqube" version "3.4.0.2513" // sonarqube
id 'net.thauvin.erik.gradle.semver' version '1.0.4' // semantic versioning
id 'java' //java support
id 'groovy' // groovy support
id 'maven-publish'
id 'signing'
id 'pmd' // code check, working on source code
id 'com.diffplug.spotless' version '6.9.0'//code format
id 'com.github.spotbugs' version '5.0.9' // code check, working on byte code
id 'de.undercouch.download' version '5.1.0'
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
id 'jacoco' // java code coverage plugin
id "org.sonarqube" version "3.4.0.2513" // sonarqube
id 'net.thauvin.erik.gradle.semver' version '1.0.4' // semantic versioning
}

ext {
//version (changing these should be considered thoroughly!)
javaVersion = JavaVersion.VERSION_17
tscfgVersion = '0.9.9'
testcontainersVersion = '1.17.3'
//version (changing these should be considered thoroughly!)
javaVersion = JavaVersion.VERSION_17
tscfgVersion = '0.9.9'
testcontainersVersion = '1.17.3'

scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator //location of script plugins
scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator //location of script plugins
}

group = 'com.github.ie3-institute'
Expand All @@ -40,78 +40,78 @@ apply from: scriptsLocation + 'vcs.gradle'
apply from: scriptsLocation + 'semVer.gradle'

repositories {
mavenCentral() // searches in Sonatype's repository 'Maven Central'
maven { url 'https://www.jitpack.io' } // allows github repos as dependencies
mavenCentral() // searches in Sonatype's repository 'Maven Central'
maven { url 'https://www.jitpack.io' } // allows github repos as dependencies

// sonatype snapshot repo
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
// sonatype snapshot repo
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }

}

dependencies {
constraints {
implementation( 'junit:junit:4.13.2+'){
because "CVE-2020-15250 - Temporary folder vulnerability - https://github.com/advisories/GHSA-269g-pwp5-87pp"
}
}
constraints {
implementation( 'junit:junit:4.13.2+'){
because "CVE-2020-15250 - Temporary folder vulnerability - https://github.com/advisories/GHSA-269g-pwp5-87pp"
}
}

// ie³ power system utils
implementation 'com.github.ie3-institute:PowerSystemUtils:2.0-SNAPSHOT'
// ie³ power system utils
implementation 'com.github.ie3-institute:PowerSystemUtils:2.0-SNAPSHOT'

implementation 'tech.units:indriya:2.1.3'
implementation 'tech.units:indriya:2.1.3'

implementation 'com.github.johanneshiry:OSMonaut:v1.1.1' // tmp pbf parse
implementation 'com.github.johanneshiry:OSMonaut:v1.1.1' // tmp pbf parse

// JTS Topology Suite for GeoPositions, License: EPL 1.0 / EDL 1.0
implementation ('org.locationtech.jts:jts-core:1.19.0'){
exclude group: 'junit', module: 'junit'
}
// JTS Topology Suite for GeoPositions, License: EPL 1.0 / EDL 1.0
implementation ('org.locationtech.jts:jts-core:1.19.0'){
exclude group: 'junit', module: 'junit'
}

implementation 'org.locationtech.jts.io:jts-io-common:1.19.0'
implementation 'org.locationtech.jts.io:jts-io-common:1.19.0'

// Graphs
implementation 'org.jgrapht:jgrapht-core:1.5.1'
// Graphs
implementation 'org.jgrapht:jgrapht-core:1.5.1'

// testing
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
testImplementation 'org.spockframework:spock-core:2.1-groovy-3.0'
testImplementation 'org.objenesis:objenesis:3.3' // Mock creation with constructor parameters
// testing
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
testImplementation 'org.spockframework:spock-core:2.1-groovy-3.0'
testImplementation 'org.objenesis:objenesis:3.3' // Mock creation with constructor parameters

// testcontainers (docker framework for testing)
testImplementation "org.testcontainers:testcontainers:$testcontainersVersion"
testImplementation "org.testcontainers:spock:$testcontainersVersion"
testImplementation "org.testcontainers:influxdb:$testcontainersVersion"
testImplementation "org.testcontainers:postgresql:$testcontainersVersion"
testImplementation "org.testcontainers:couchbase:$testcontainersVersion"
// testcontainers (docker framework for testing)
testImplementation "org.testcontainers:testcontainers:$testcontainersVersion"
testImplementation "org.testcontainers:spock:$testcontainersVersion"
testImplementation "org.testcontainers:influxdb:$testcontainersVersion"
testImplementation "org.testcontainers:postgresql:$testcontainersVersion"
testImplementation "org.testcontainers:couchbase:$testcontainersVersion"

// logging
implementation platform('org.apache.logging.log4j:log4j-bom:2.18.0')
implementation 'org.apache.logging.log4j:log4j-api' // log4j
implementation 'org.apache.logging.log4j:log4j-core' // log4j
implementation 'org.apache.logging.log4j:log4j-slf4j-impl' // log4j -> slf4j
// logging
implementation platform('org.apache.logging.log4j:log4j-bom:2.18.0')
implementation 'org.apache.logging.log4j:log4j-api' // log4j
implementation 'org.apache.logging.log4j:log4j-core' // log4j
implementation 'org.apache.logging.log4j:log4j-slf4j-impl' // log4j -> slf4j

// Databases
implementation 'org.influxdb:influxdb-java:2.23'
implementation 'com.couchbase.client:java-client:3.3.3'
runtimeOnly 'org.postgresql:postgresql:42.4.1' // postgresql jdbc driver required during runtime
// Databases
implementation 'org.influxdb:influxdb-java:2.23'
implementation 'com.couchbase.client:java-client:3.3.3'
runtimeOnly 'org.postgresql:postgresql:42.4.1' // postgresql jdbc driver required during runtime

implementation 'commons-io:commons-io:2.11.0' // I/O functionalities
implementation 'org.apache.commons:commons-compress:1.21' // I/O functionalities
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'commons-io:commons-io:2.11.0' // I/O functionalities
implementation 'org.apache.commons:commons-compress:1.21' // I/O functionalities
implementation 'org.apache.commons:commons-lang3:3.12.0'

}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.encoding = 'UTF-8'
}

tasks.withType(Javadoc){
options.encoding = 'UTF-8'
failOnError = false // TODO: Temp until JavaDoc issues are resolved
options.encoding = 'UTF-8'
failOnError = false // TODO: Temp until JavaDoc issues are resolved
}

task printVersion {
doLast {
println project.version
}
doLast {
println project.version
}
}
16 changes: 8 additions & 8 deletions gradle/scripts/checkJavaVersion.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Enforces the correct Java version, as some parts of the project may malfunction under a wrong version
// If this task fails, try changing your JAVA_HOME to the required version
tasks.register("checkJavaVersion") {
group = 'Verification'
description = 'Enforces correct Java version'
group = 'Verification'
description = 'Enforces correct Java version'

doLast {
def foundVersion = JavaVersion.current()
if (foundVersion != javaVersion)
throw new IllegalStateException("Wrong Java version: required is "
+ javaVersion + ", but found " + foundVersion)
}
doLast {
def foundVersion = JavaVersion.current()
if (foundVersion != javaVersion)
throw new IllegalStateException("Wrong Java version: required is "
+ javaVersion + ", but found " + foundVersion)
}
}
compileJava.dependsOn(checkJavaVersion)
66 changes: 33 additions & 33 deletions gradle/scripts/documentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ def docBaseDirPath = project.projectDir.toString() + File.separator + project.do
* Configuring the sphinx plugin
*/
sphinx {
description 'Generate high level HTML documentation output.'
group 'Documentation'
description 'Generate high level HTML documentation output.'
group 'Documentation'

sourceDirectory = "${docBaseDirPath}/readthedocs"
outputDirectory = "${project.buildDir}/docs/readthedocs"
sourceDirectory = "${docBaseDirPath}/readthedocs"
outputDirectory = "${project.buildDir}/docs/readthedocs"
}

/**
* Task to generate the JavaDoc incl. build failure on warning (build always fails on JavaDoc error by default)
*/
javadoc() {
description 'Generates java API doc at the correct place.'
group 'Documentation'
description 'Generates java API doc at the correct place.'
group 'Documentation'

source = sourceSets.main.allJava
classpath = project.sourceSets.main.compileClasspath
source = sourceSets.main.allJava
classpath = project.sourceSets.main.compileClasspath

// sanity check, break on warnings
options.addStringOption('Xwerror', '-quiet')
// sanity check, break on warnings
options.addStringOption('Xwerror', '-quiet')
}

/**
Expand All @@ -36,27 +36,27 @@ javadoc() {
* Important note: you have to install GraphViz Manually before being able to execute this task! -> https://graphviz.org
*/
task puml2png() {
description 'Converts plantUML diagrams to png files.'
group 'Documentation'

doLast {
/* Get the PlantUML-jar or download it, if it is not available */
def pumlJarFile = project.file("${project.buildDir}/plantuml.jar")
if (!pumlJarFile.exists() || !pumlJarFile.isFile()) {
download {
src 'https://downloads.sourceforge.net/project/plantuml/plantuml.jar'
dest buildDir
}
}
javaexec {
main = "-jar"
args = [
"build/plantuml.jar",
"-psvg",
"-o",
"${docBaseDirPath}readthedocs/_static/figures/uml/",
"${docBaseDirPath}uml/**/*.puml"
]
}
}
description 'Converts plantUML diagrams to png files.'
group 'Documentation'

doLast {
/* Get the PlantUML-jar or download it, if it is not available */
def pumlJarFile = project.file("${project.buildDir}/plantuml.jar")
if (!pumlJarFile.exists() || !pumlJarFile.isFile()) {
download {
src 'https://downloads.sourceforge.net/project/plantuml/plantuml.jar'
dest buildDir
}
}
javaexec {
main = "-jar"
args = [
"build/plantuml.jar",
"-psvg",
"-o",
"${docBaseDirPath}readthedocs/_static/figures/uml/",
"${docBaseDirPath}uml/**/*.puml"
]
}
}
}
94 changes: 47 additions & 47 deletions gradle/scripts/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,57 @@

// general configuration
jacoco {
toolVersion = "0.8.7"
reportsDir = file("$buildDir/reports/jacoco")
toolVersion = "0.8.7"
reportsDir = file("$buildDir/reports/jacoco")
}

jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled true
html.destination file("${buildDir}/reports/jacoco")
}

// what to exclude from coverage report (files that should not be analyzed!)
// UI, "noise", generated classes, platform classes, etc.
def excludes = [
'scala/**/*.*',
// exclude scala source files
'groovy/**/*.*',
// exclude groovy source files
'**/**Test**.**',
// exclude unit tests files
'**/**IT**.**' // exclude integration tests files
]

getClassDirectories().setFrom(fileTree(
dir: "$buildDir/classes/",
excludes: excludes
))

// sourceSets sourceSets.main
executionData check // include integration tests in jacoco reports
reports {
xml.enabled true
csv.enabled false
html.enabled true
html.destination file("${buildDir}/reports/jacoco")
}

// what to exclude from coverage report (files that should not be analyzed!)
// UI, "noise", generated classes, platform classes, etc.
def excludes = [
'scala/**/*.*',
// exclude scala source files
'groovy/**/*.*',
// exclude groovy source files
'**/**Test**.**',
// exclude unit tests files
'**/**IT**.**' // exclude integration tests files
]

getClassDirectories().setFrom(fileTree(
dir: "$buildDir/classes/",
excludes: excludes
))

// sourceSets sourceSets.main
executionData check // include integration tests in jacoco reports
}

jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.68
}
}

rule {
enabled = false
element = 'CLASS'
includes = ['org.gradle.*']

limit {
counter = 'LINE'
value = 'TOTALCOUNT'
maximum = 0.3
}
}
}
violationRules {
rule {
limit {
minimum = 0.68
}
}

rule {
enabled = false
element = 'CLASS'
includes = ['org.gradle.*']

limit {
counter = 'LINE'
value = 'TOTALCOUNT'
maximum = 0.3
}
}
}
}
Loading