Skip to content

Commit 420e56a

Browse files
committed
Merge remote-tracking branch 'remotes/origin/master' into ck/#12-coverage4scala
# Conflicts: # .travis/build.sh # build.gradle
2 parents 274c85b + 15848c2 commit 420e56a

File tree

99 files changed

+3723
-1973
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+3723
-1973
lines changed

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.travis/build.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

Jenkinsfile

Lines changed: 202 additions & 471 deletions
Large diffs are not rendered by default.

build.gradle

Lines changed: 32 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
1-
plugins{
1+
plugins {
22
id "com.jfrog.artifactory" version "4.9.7"
33
id 'groovy' // groovy support
44
id 'java' // java support
55
id 'scala' // scala support
66
id 'maven-publish' // publish to a maven repo (local or mvn central, has to be defined)
77
id 'pmd' // code check, working on source code
88
id 'com.github.spotbugs' version '2.0.0' // code check, working on byte code
9-
id 'com.diffplug.gradle.spotless' version '3.24.2'// code format
9+
id 'com.diffplug.gradle.spotless' version '3.28.1'// code format
1010
id "de.undercouch.download" version "3.4.3" // downloads plugin
1111
id 'jacoco' // java code coverage plugin
12-
id "org.sonarqube" version "2.7.1" // sonarqube
12+
id "org.sonarqube" version "2.8" // sonarqube
1313
id 'org.scoverage' version '4.0.1' // Code coverage plugin for scala
1414
}
1515

1616
ext {
17-
//version (changing these should be considered thoroughly!)
18-
unitsOfMeasurementVersion = '1.0.8'
19-
javaVersion = JavaVersion.VERSION_11
17+
//version (changing these should be considered thoroughly!)
18+
javaVersion = JavaVersion.VERSION_1_8
2019

20+
unitsOfMeasurementVersion = '1.0.10'
2121
scalaVersion = '2.13'
22-
tscfgVersion = '0.9.9'
22+
tscfgVersion = '0.9.96'
2323
slf4jVersion = '1.7.26'
2424

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

28+
group = 'com.github.ie3-institute'
29+
description = 'simbench4ie3'
30+
version = '1.0-SNAPSHOT'
31+
32+
apply from: scriptsLocation + 'tests.gradle'
2833
apply from: scriptsLocation + 'pmd.gradle'
2934
apply from: scriptsLocation + 'spotbugs.gradle'
30-
apply from: scriptsLocation + 'sonarqube.gradle' // sonarqube config
3135
apply from: scriptsLocation + 'spotless.gradle'
32-
apply from: scriptsLocation + 'tests.gradle' // tasks for tests
3336
apply from: scriptsLocation + 'checkJavaVersion.gradle'
3437
apply from: scriptsLocation + 'tscfg.gradle' // config tasks
3538
apply from: scriptsLocation + 'jacoco.gradle' // jacoco java code coverage
@@ -38,45 +41,52 @@ apply from: scriptsLocation + 'scoverage.gradle'
3841
repositories {
3942
jcenter() //searches in bintray's repository 'jCenter', which contains Maven Central
4043
maven { url 'https://www.jitpack.io' } // allows github repos as dependencies
44+
45+
// sonatype snapshots repo // todo remove
46+
maven { url 'https://oss.sonatype.org/service/local/repositories/snapshots/content' }
4147
}
4248

4349
dependencies {
50+
/* PowerSystemDataModel */
51+
compile ('com.github.ie3-institute:PowerSystemDataModel:1.1-SNAPSHOT') {
52+
/* Exclude nested logging and ie³ related dependencies */
53+
exclude group: 'org.slf4j', module: 'slf4j-api'
54+
exclude group: 'com.github.ie3-institute'
55+
}
56+
4457
/* util functions */
45-
compile ('com.github.ie3-institute:PowerSystemUtils:1.3+') {
58+
compile ('com.github.ie3-institute:PowerSystemUtils:1.3.1') {
4659
/* Exclude nested logging and ie³ related dependencies */
47-
exclude group: 'org.slf4j'
60+
exclude group: 'org.slf4j', module: 'slf4j-api'
4861
exclude group: 'com.github.ie3-institute'
4962
}
5063

64+
compile 'org.codehaus.groovy:groovy:3.0.3'
65+
66+
compile "tec.uom:uom-se:$unitsOfMeasurementVersion"
67+
5168
// logging
52-
compile "org.slf4j:slf4j-api:${slf4jVersion}" // slf4j wrapper
53-
compile 'com.lmax:disruptor:3.4.2' // async logging
5469
compile 'org.apache.logging.log4j:log4j-api:+' // log4j
5570
compile 'org.apache.logging.log4j:log4j-core:+' // log4j
5671
compile 'org.apache.logging.log4j:log4j-slf4j-impl:+' // log4j -> slf4j
5772

5873
compile "com.typesafe.scala-logging:scala-logging_${scalaVersion}:+" // akka scala logging
5974
compile "org.slf4j:log4j-over-slf4j:${slf4jVersion}" // slf4j -> log4j
6075

61-
// testing
62-
testCompile 'org.spockframework:spock-core:1.3-groovy-+'
63-
64-
compile 'javax.measure:unit-api:+'
65-
compile "tec.uom:uom-se:$unitsOfMeasurementVersion" // quantities
66-
6776
// NEW scala libs //
6877
// CORE Scala //
6978
compile "org.scala-lang:scala-library:${scalaVersion}+"
7079

7180
// TEST Scala //
7281
testCompile "org.scalatest:scalatest_${scalaVersion}:3.0.8"
7382
testRuntime "org.pegdown:pegdown:1.6.0" // HTML report for scalatest
83+
compile 'org.mockito:mockito-core:+' // mocking framework
7484
scoverage "org.scoverage:scalac-scoverage-plugin_${scalaVersion}:1.4.1"
7585
scoverage "org.scoverage:scalac-scoverage-runtime_${scalaVersion}:1.4.1"
7686

7787
// config //
7888
implementation 'com.typesafe:config:+'
79-
compile "com.github.carueda:tscfg:v${tscfgVersion}"
89+
compile "com.github.carueda:tscfg_2.13:${tscfgVersion}"
8090

8191
// cmd args parser //
8292
compile "com.github.scopt:scopt_${scalaVersion}:+"
@@ -89,61 +99,6 @@ wrapper {
8999
gradleVersion = '6.0.1'
90100
}
91101

92-
group = 'edu.ie3'
93-
version = '0.1-SNAPSHOT'
94-
description = 'simbench4ie3'
95-
sourceCompatibility = javaVersion
96-
targetCompatibility = javaVersion
97-
98-
task sourcesJar(type: Jar) {
99-
getArchiveClassifier().set('sources')
100-
from(sourceSets.main.allSource)
101-
}
102-
103-
task javadocJar(type: Jar) {
104-
getArchiveClassifier().set('javadoc')
105-
from(javadoc.destinationDir)
106-
}
107-
108-
if (project.hasProperty('user') && project.hasProperty('password')) {
109-
artifactory {
110-
contextUrl = "https://simona.ie3.e-technik.tu-dortmund.de/artifactory"
111-
publish {
112-
repository {
113-
repoKey = 'libs-snapshot-local'
114-
username = project.getProperty('user')
115-
password = project.getProperty('password')
116-
maven = true
117-
}
118-
defaults {
119-
publications('mavenJava')
120-
}
121-
}
122-
}
123-
}
124-
125-
publishing {
126-
publications {
127-
mavenJava(MavenPublication) {
128-
artifactId = 'simbench4ie3'
129-
from components.java
130-
artifact sourcesJar
131-
artifact javadocJar
132-
versionMapping {
133-
usage('java-api') {
134-
fromResolutionOf('runtimeClasspath')
135-
}
136-
usage('java-runtime') {
137-
fromResolutionResult()
138-
}
139-
}
140-
}
141-
}
142-
repositories {
143-
maven {
144-
def releasesRepoUrl = "$buildDir/repos/releases"
145-
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
146-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
147-
}
148-
}
102+
tasks.withType(JavaCompile) {
103+
options.encoding = 'UTF-8'
149104
}

gradle/scripts/checkJavaVersion.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tasks.register("checkJavaVersion") {
88
def foundVersion = JavaVersion.current()
99
if (foundVersion != javaVersion)
1010
throw new IllegalStateException("Wrong Java version: required is "
11-
+ javaVersion + ", but found " + foundVersion)
11+
+ javaVersion + ", but found " + foundVersion)
1212
}
1313
}
1414
compileJava.dependsOn(checkJavaVersion)

gradle/scripts/jacoco.gradle

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,21 @@ jacocoTestReport {
3030
// what to exclude from coverage report (files that should not be analyzed!)
3131
// UI, "noise", generated classes, platform classes, etc.
3232
def excludes = [
33-
'scala/**/*.*', // exclude scala source files
34-
'groovy/**/*.*', // exclude groovy source files
35-
'**/**Test**.**', // exclude unit tests files
36-
'**/**IT**.**' // exclude integration tests files
33+
'scala/**/*.*',
34+
// exclude scala source files
35+
'groovy/**/*.*',
36+
// exclude groovy source files
37+
'**/**Test**.**',
38+
// exclude unit tests files
39+
'**/**IT**.**' // exclude integration tests files
3740
]
3841

3942
getClassDirectories().setFrom(fileTree(
4043
dir: "$buildDir/classes/",
4144
excludes: excludes
42-
))
45+
))
4346

44-
// sourceSets sourceSets.main
47+
// sourceSets sourceSets.main
4548
executionData allTests // include integration tests in jacoco reports
4649
}
4750

gradle/scripts/sonarqube.gradle

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@ sonarqube {
55
property 'sonar.projectName', 'simbench4ie3' // project name
66
property 'sonar.verbose', 'true' // verbose mode
77
property 'sonar.sourceEncoding', 'UTF-8' // encoding
8-
property 'sonar.sources', ['src/main/resources', 'src/main/scala'] // src dirs
9-
property "sonar.tests", ['src/test/resources', 'src/test/scala', 'src/test/groovy'] // test src dirs
10-
8+
property 'sonar.sources', [
9+
'src/main/resources',
10+
'src/main/scala'] // src dirs
11+
property "sonar.tests", [
12+
'src/test/resources',
13+
'src/test/scala',
14+
'src/test/groovy'] // test src dirs
1115
// reports stuff (for all languages)
12-
property 'sonar.junit.reportPaths', ['build/test-results/allTests'] // Comma-delimited list of paths to Surefire XML-format reports.
13-
16+
property 'sonar.junit.reportPaths', [
17+
'build/test-results/allTests'] // Comma-delimited list of paths to Surefire XML-format reports.
1418
// unit tests reports dirs
15-
property "sonar.coverage.jacoco.xmlReportsPath", ["build/reports/jacoco/test/jacocoTestReport.xml"] // Comma-separated list of paths to JaCoCo (jacoco.xml) report files.
19+
property "sonar.coverage.jacoco.xmlReportsPath", [
20+
"build/reports/jacoco/test/jacocoTestReport.xml"] // Comma-separated list of paths to JaCoCo (jacoco.xml) report files.
1621
// scapegoat report dir
1722
//property "sonar.scala.scapegoat.reportPaths", ["build/reports/scapegoat/src/scapegoat-scalastyle.xml", "build/reports/scapegoat/testsrc/scapegoat-scalastyle.xml"] // Comma-delimited list of paths to Scapegoat reports in the Scalastyle format
1823
// spotbugs report dir
19-
property "sonar.java.spotbugs.reportPaths", ["build/reports/spotbugs/main.xml","build/reports/spotbugs/test.xml"] // Comma-delimited list of paths to reports from SpotBugs
20-
24+
property "sonar.java.spotbugs.reportPaths", [
25+
"build/reports/spotbugs/main.xml",
26+
"build/reports/spotbugs/test.xml"] // Comma-delimited list of paths to reports from SpotBugs
2127
// scala specific stuff
2228
//property 'sonar.scala.coverage.reportPaths', ''//todo enable when scoverage gradle plugin is available for scala 2.13
2329

gradle/scripts/spotless.gradle

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
11
// spotless is a code formatter
22

33
spotless {
4+
def ie3LicHead = '/*\n' +
5+
' * © $YEAR. TU Dortmund University,\n' +
6+
' * Institute of Energy Systems, Energy Efficiency and Energy Economics,\n' +
7+
' * Research group Distribution grid planning and operation\n' +
8+
'*/'
49

510
//sets a license header, removes unused imports and formats conforming to the google java format
611
java {
712
removeUnusedImports() // removes any unused imports
813
googleJavaFormat()
9-
licenseHeader '/*\n' +
10-
' * © $YEAR. TU Dortmund University,\n' +
11-
' * Institute of Energy Systems, Energy Efficiency and Energy Economics,\n' +
12-
' * Research group Distribution grid planning and operation\n' +
13-
' */\n\n'
14+
licenseHeader ie3LicHead
1415
}
16+
1517
//sets a license header, removes unused imports and formats conforming to the scala fmt formatter
1618
scala {
1719
scalafmt()
1820
}
21+
22+
/* cf. https://github.com/diffplug/spotless/tree/master/plugin-gradle */
23+
groovy {
24+
licenseHeader ie3LicHead
25+
excludeJava() // excludes all Java sources within the Groovy source dirs from formatting
26+
paddedCell() // Avoid cyclic ambiguities
27+
// the Groovy Eclipse formatter extends the Java Eclipse formatter,
28+
// so it formats Java files by default (unless `excludeJava` is used).
29+
greclipse()
30+
}
31+
32+
groovyGradle {
33+
// same as groovy, but for .gradle (defaults to '*.gradle')
34+
target '*.gradle', 'gradle/scripts/*.gradle'
35+
greclipse()
36+
}
37+
1938
// removes unnecessary whitespace, indents with tabs and ends on new line for gradle, md and gitignore files and config-XMLs
2039
format 'misc', {
2140
target '**/*.gradle', '**/*.md', '**/.gitignore', 'configs/**'

gradle/scripts/tests.gradle

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
test {
2-
// by default we don't want to run integration tests
3-
filter {
4-
excludeTestsMatching '*IT'
5-
}
6-
}
7-
81
// Task to run scala tests, as Scala tests are not picked up by gradle by default
92
task spec(dependsOn: ['testClasses'], type: JavaExec) {
103
main = 'org.scalatest.tools.Runner'
11-
args = ['-R', 'build/classes/scala/test', '-h', 'build/reports/tests/scalatest', '-oD']
4+
args = [
5+
'-R',
6+
'build/classes/scala/test',
7+
'-h',
8+
'build/reports/tests/scalatest',
9+
'-oD'
10+
]
1211
classpath = sourceSets.test.runtimeClasspath
1312
}
1413
build.dependsOn spec
@@ -21,16 +20,9 @@ task integrationTest(type: Test) {
2120
}
2221
mustRunAfter test
2322
}
24-
integrationTest.dependsOn(test)
2523

2624
task allTests(type: Test) {
2725
description 'executes all tests'
28-
filter {
29-
includeTestsMatching '*Test*.*'
30-
includeTestsMatching '*IT'
31-
}
32-
mustRunAfter test
3326
mustRunAfter spec
3427
}
35-
allTests.dependsOn(test)
3628
allTests.dependsOn(spec)

0 commit comments

Comments
 (0)