-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
155 lines (125 loc) · 5.35 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
plugins {
// todo revise
id 'java' //java support
id 'scala'
id 'pmd' // code check, working on source code
id 'com.diffplug.spotless' version '6.25.0'//code format
id 'com.github.spotbugs' version '6.1.7' // code check, working on byte code
id 'de.undercouch.download' version '5.6.0'
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
id "com.github.maiflai.scalatest" version "0.33" // run scalatest without specific spec task
id "org.sonarqube" version "6.0.1.5171" // sonarqube
id "org.scoverage" version "8.1" // scala code coverage scoverage
id 'net.thauvin.erik.gradle.semver' version '1.0.4' // semantic versioning
}
ext {
javaVersion = JavaVersion.VERSION_17
scalaVersion = '2.13'
scalaBinaryVersion = '2.13.16'
pekkoVersion = '1.1.3'
tscfgVersion = '0.9.995'
scapegoatVersion = '3.1.6'
scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator
docsDirName = 'docs'
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion.toString()))
}
}
group = 'com.github.ie3-institute'
description = 'OSMoGrid'
apply from: scriptsLocation + 'pmd.gradle'
apply from: scriptsLocation + 'spotbugs.gradle'
apply from: scriptsLocation + 'spotless.gradle'
apply from: scriptsLocation + 'checkJavaVersion.gradle'
apply from: scriptsLocation + 'documentation.gradle'
apply from: scriptsLocation + 'sonarqube.gradle' // sonarqube config
apply from: scriptsLocation + 'scoverage.gradle' // scoverage scala code coverage
apply from: scriptsLocation + 'vcs.gradle'
apply from: scriptsLocation + 'semVer.gradle'
apply from: scriptsLocation + 'tscfg.gradle'
configurations {
scalaCompilerPlugin
}
repositories {
mavenCentral() //searches in bintray's repository 'jCenter', which contains Maven Central
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots' } // sonatype snapshot repo
}
dependencies {
/* Scala compiler plugin for static code analysis */
implementation "com.sksamuel.scapegoat:scalac-scapegoat-plugin_${scalaBinaryVersion}:${scapegoatVersion}"
scalaCompilerPlugin "com.sksamuel.scapegoat:scalac-scapegoat-plugin_${scalaBinaryVersion}:${scapegoatVersion}"
// scala core
implementation "org.scala-lang:scala-library:${scalaBinaryVersion}"
implementation group: 'org.scala-lang.modules', name: "scala-parallel-collections_${scalaVersion}", version: '1.2.0'
// pekko
implementation "org.apache.pekko:pekko-actor-typed_${scalaVersion}:${pekkoVersion}"
testImplementation "org.apache.pekko:pekko-actor-testkit-typed_${scalaVersion}:${pekkoVersion}"
// logging
implementation "com.typesafe.scala-logging:scala-logging_${scalaVersion}:3.9.5"
implementation 'ch.qos.logback:logback-classic:1.5.18'
// config
implementation 'com.typesafe:config:1.4.3'
implementation "com.github.scopt:scopt_$scalaVersion:4.1.0" // cmd args parser
// osm4scala
implementation "org.openstreetmap.osmosis:osmosis-core:0.49.2"
implementation "org.openstreetmap.osmosis:osmosis-pbf2:0.49.2"
// ie³ power system utils
implementation('com.github.ie3-institute:PowerSystemUtils:2.2.1') {
exclude group: 'org.slf4j'
exclude group: 'org.apache.logging.log4j'
exclude group: 'com.github.ie3-institute'
exclude group: 'com.github.johanneshiry', module: 'OSMonaut'
}
// ie³ power system data model
implementation('com.github.ie3-institute:PowerSystemDataModel:6.0.0') {
exclude group: 'org.slf4j'
exclude group: 'org.apache.logging.log4j'
exclude group: 'com.github.ie3-institute'
}
// graphs
implementation 'org.jgrapht:jgrapht-core:1.5.2'
implementation 'tech.units:indriya:2.2.2'
implementation 'org.locationtech.jts:jts-core:1.20.0'
// testing
testImplementation "org.scalatest:scalatest_$scalaVersion:3.2.19"
testRuntimeOnly 'com.vladsch.flexmark:flexmark-all:0.64.8' //scalatest html output
testImplementation 'org.pegdown:pegdown:1.6.0'
testImplementation 'org.mockito:mockito-core:5.16.1' // mocking framework
testImplementation "org.scalatestplus:mockito-3-12_$scalaVersion:3.2.10.0" // syntactic sugar
}
test.dependsOn processScoverageResources
// scapegoat hook configuration
// https://github.com/sksamuel/scapegoat
// using compileScala instead of tasks.withType(ScalaCompile) prevents applying scapegoat to scala test classes
// see https://docs.gradle.org/current/userguide/scala_plugin.html#sec:configure_scala_classpath for details
tasks.withType(ScalaCompile) {
scalaCompileOptions.additionalParameters = [
"-Xplugin:" + configurations.scalaCompilerPlugin.asPath,
"-P:scapegoat:dataDir:" + layout.buildDirectory.dir("reports/scapegoat/src/").get(),
"-P:scapegoat:disabledInspections:VariableShadowing",
"-P:scapegoat:overrideLevels:LonelySealedTrait=warning",
"-P:scapegoat:ignoredFiles:.*/SimonaConfig.scala" // see scapegoat-sbt page for this param
]
}
// separate scapegoat report for test classes
compileTestScala {
scalaCompileOptions.additionalParameters = [
"-Xplugin:" + configurations.scalaCompilerPlugin.asPath,
"-P:scapegoat:dataDir:" + layout.buildDirectory.dir("reports/scapegoat/testsrc/").get(),
"-P:scapegoat:disabledInspections:VariableShadowing",
"-P:scapegoat:overrideLevels:LonelySealedTrait=warning"
]
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc){
options.encoding = 'UTF-8'
}
task printVersion {
doLast {
println project.version
}
}