-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
218 lines (186 loc) · 8.26 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer
plugins {
id 'java' // java support
id 'scala' // scala support
id 'signing'
id 'maven-publish' // publish to a maven repo (local or mvn central, has to be defined)
id 'com.diffplug.spotless' version '7.0.2' // code format
id "com.github.ben-manes.versions" version '0.52.0'
id "de.undercouch.download" version "5.6.0" // downloads plugin
id "kr.motd.sphinx" version "2.10.1" // documentation generation
id 'com.gradleup.shadow' version '8.3.6' // fat jar
id "org.sonarqube" version "6.1.0.5360" // sonarqube
id "org.scoverage" version "8.1" // scala code coverage scoverage
id 'org.hidetake.ssh' version '2.11.2'
id 'net.thauvin.erik.gradle.semver' version '1.0.4' // semantic versioning
id "application"
}
ext {
// version (changing these should be considered thoroughly!)
javaVersion = JavaVersion.VERSION_17
scalaVersion = '2.13'
scalaBinaryVersion = '2.13.16'
pekkoVersion = '1.1.3'
jtsVersion = '1.20.0'
confluentKafkaVersion = '7.9.0'
scapegoatVersion = '3.1.8'
junitVersion = '1.12.1'
testContainerVersion = '0.43.0'
scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator // location of script plugins
}
group = 'com.github.ie3-institute'
description = 'simona'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
apply from: scriptsLocation + 'spotless.gradle'
apply from: scriptsLocation + 'checkJavaVersion.gradle'
apply from: scriptsLocation + 'documentation.gradle' // documentation tasks + configuration
apply from: scriptsLocation + 'tests.gradle' // tasks for tests
apply from: scriptsLocation + 'sonarqube.gradle' // sonarqube config
apply from: scriptsLocation + 'scoverage.gradle' // scoverage scala code coverage
apply from: scriptsLocation + 'deploy.gradle'
apply from: scriptsLocation + 'semVer.gradle'
apply from: scriptsLocation + 'mavenCentralPublish.gradle'
apply from: scriptsLocation + 'branchName.gradle' // checks naming scheme of branches
configurations {
scalaCompilerPlugin
}
repositories {
mavenCentral() // searches in Sonatype's central repository
maven { url = 'https://s01.oss.sonatype.org/content/repositories/snapshots' } // sonatype snapshot repo
maven { url = 'https://packages.confluent.io/maven' } // confluent repo (kafka)
}
dependencies {
// ie³ internal repository
implementation('com.github.ie3-institute:PowerSystemUtils:2.2.1') {
exclude group: 'org.apache.logging.log4j'
exclude group: 'org.slf4j'
/* Exclude our own nested dependencies */
exclude group: 'com.github.ie3-institute'
}
implementation('com.github.ie3-institute:PowerSystemDataModel:6.0.0') {
exclude group: 'org.apache.logging.log4j'
exclude group: 'org.slf4j'
/* Exclude our own nested dependencies */
exclude group: 'com.github.ie3-institute'
}
implementation('com.github.ie3-institute:powerflow:0.2') {
exclude group: 'org.apache.logging.log4j'
exclude group: 'org.slf4j'
/* Exclude our own nested dependencies */
exclude group: 'edu.ie3'
}
implementation('com.github.ie3-institute:simonaAPI:0.7.0') {
exclude group: 'org.apache.logging.log4j'
exclude group: 'org.slf4j'
/* Exclude our own nested dependencies */
exclude group: 'edu.ie3'
}
/* logging */
implementation "com.typesafe.scala-logging:scala-logging_${scalaVersion}:3.9.5" // pekko scala logging
implementation "ch.qos.logback:logback-classic:1.5.18"
/* testing */
// scalatest & junit
testImplementation "org.scalatest:scalatest_${scalaVersion}:3.2.19"
testImplementation "org.junit.platform:junit-platform-launcher:${junitVersion}"
testRuntimeOnly "org.junit.platform:junit-platform-engine:${junitVersion}"
testRuntimeOnly "org.scalatestplus:junit-5-11_${scalaVersion}:3.2.19.0"
// mocking framework
testImplementation 'org.mockito:mockito-core:5.17.0'
testImplementation "org.scalatestplus:mockito-3-4_${scalaVersion}:3.2.10.0"
// pekko
testImplementation "org.apache.pekko:pekko-testkit_${scalaVersion}:${pekkoVersion}"
testImplementation "org.apache.pekko:pekko-actor-testkit-typed_${scalaVersion}:${pekkoVersion}"
// testcontainers
testImplementation "com.dimafeng:testcontainers-scala-scalatest_${scalaVersion}:${testContainerVersion}"
testImplementation "com.dimafeng:testcontainers-scala-postgresql_${scalaVersion}:${testContainerVersion}"
testImplementation "com.dimafeng:testcontainers-scala-kafka_${scalaVersion}:${testContainerVersion}"
/* --- Scala libs --- */
/* CORE Scala */
implementation "org.scala-lang:scala-library:${scalaBinaryVersion}"
/* CORE Pekko */
implementation "org.apache.pekko:pekko-actor_${scalaVersion}:${pekkoVersion}"
implementation "org.apache.pekko:pekko-actor-typed_${scalaVersion}:${pekkoVersion}"
implementation "org.apache.pekko:pekko-slf4j_${scalaVersion}:${pekkoVersion}"
/* config */
implementation 'com.typesafe:config:1.4.3'
implementation "com.github.scopt:scopt_${scalaVersion}:4.1.0" // cmd args parser
implementation "com.github.pureconfig:pureconfig_${scalaVersion}:0.17.8"
// JTS
implementation ("org.locationtech.jts:jts-core:${jtsVersion}") {
exclude group: 'junit', module: 'junit'
}
implementation "org.locationtech.jts.io:jts-io-common:${jtsVersion}"
/* 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}"
/* Kafka */
implementation "org.apache.kafka:kafka-clients:${confluentKafkaVersion}-ccs"
implementation "io.confluent:kafka-streams-avro-serde:${confluentKafkaVersion}"
implementation "com.sksamuel.avro4s:avro4s-core_${scalaVersion}:4.1.2"
implementation 'org.apache.commons:commons-math3:3.6.1' // apache commons math3
implementation 'org.apache.poi:poi-ooxml:5.4.1' // used for FilenameUtils
implementation 'javax.measure:unit-api:2.2'
implementation 'tech.units:indriya:2.2.2' // quantities
implementation "org.typelevel:squants_${scalaVersion}:1.8.3"
implementation 'org.apache.commons:commons-csv:1.14.0'
implementation "org.scalanlp:breeze_${scalaVersion}:2.1.0" // scientific calculations (http://www.scalanlp.org/)
implementation 'de.lmu.ifi.dbs.elki:elki:0.7.5' // Statistics (for random load model)
implementation 'org.jgrapht:jgrapht-core:1.5.2'
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
jar {
manifest {
attributes(
'Main-Class': 'edu.ie3.simona.main.RunSimonaStandalone'
)
}
}
// Run with ./gradlew run --args='--config /path/to/simona.conf'
application {
mainClass.set(jar.manifest.attributes.get('Main-Class') as String)
}
//////////////////////////////////////////////////////////////////////
// Build pekko'able fat jar using the gradle shadow plugin
// see http://www.sureshpw.com/2015/10/building-akka-bundle-with-all.html
// and https://github.com/akka/akka/issues/24248
//////////////////////////////////////////////////////////////////////
shadowJar {
transform(AppendingTransformer) {
resource = 'reference.conf'
}
zip64 = true
archiveBaseName.set('simona')
}
// 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).configureEach {
scalaCompileOptions.additionalParameters = [
"-Xplugin:" + configurations.scalaCompilerPlugin.asPath,
"-P:scapegoat:dataDir:" + project.layout.buildDirectory.get().asFile.absolutePath + "/reports/scapegoat/src/",
"-P:scapegoat:disabledInspections:TryGet"
]
scalaCompileOptions.forkOptions.jvmArgs = [
'-Xss2m',
'-XX:-UseGCOverheadLimit'
]
}
// separate scapegoat report for test classes
compileTestScala {
scalaCompileOptions.additionalParameters = [
"-Xplugin:" + configurations.scalaCompilerPlugin.asPath,
"-P:scapegoat:dataDir:" + project.layout.buildDirectory.get().asFile.absolutePath + "/reports/scapegoat/testsrc/",
"-P:scapegoat:disabledInspections:TryGet"
]
}
tasks.register("printVersion") {
doLast {
println project.version
}
}