-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
140 lines (120 loc) · 4.44 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
plugins {
id 'groovy' // groovy support
id 'java' // java support
id 'scala' // scala support
id 'pmd' //code check, working on source code
id 'com.diffplug.spotless' version '7.0.2'//code format
id "org.sonarqube" version "6.1.0.5360" // sonarqube
id 'org.scoverage' version '8.1' // Code coverage plugin for scala
id "com.github.maiflai.scalatest" version "0.33" // run scalatest without specific spec task
id 'maven-publish'
id 'signing'
}
ext {
javaVersion = JavaVersion.VERSION_17
scalaVersion = '2.13'
scalaBinaryVersion = '2.13.16'
scapegoatVersion = '3.1.7'
scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator //location of script plugins
}
group = 'com.github.ie3-institute'
version = '1.0-SNAPSHOT'
description = 'powerflow'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
apply from: scriptsLocation + '/checkJavaVersion.gradle'
apply from: scriptsLocation + '/spotless.gradle'
apply from: scriptsLocation + '/pmd.gradle'
apply from: scriptsLocation + '/scoverage.gradle'
apply from: scriptsLocation + '/sonarqube.gradle'
apply from: scriptsLocation + '/mavenCentralPublish.gradle'
configurations {
scalaCompilerPlugin
}
repositories {
mavenCentral()
}
dependencies {
constraints {
// flexmark uses 1.14.3 with vulnerability
implementation( 'org.jsoup:jsoup:1.19.1' ){
because "CVE-2022-36033 6.1 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') vulnerability pending CVSS allocation"
}
}
// CORE Scala //
implementation "org.scala-lang:scala-library:${scalaBinaryVersion}"
// TEST Scala //
testImplementation "org.scalatest:scalatest_${scalaVersion}:3.2.15"
testImplementation 'com.vladsch.flexmark:flexmark-all:0.64.8'
testImplementation "org.pegdown:pegdown:1.6.0" // HTML report for scalatest
// Linter Scala //
implementation "com.sksamuel.scapegoat:scalac-scapegoat-plugin_${scalaBinaryVersion}:${scapegoatVersion}" // scala scapegoat
scalaCompilerPlugin "com.sksamuel.scapegoat:scalac-scapegoat-plugin_${scalaBinaryVersion}:${scapegoatVersion}" // scala scapegoat
// logging //
implementation "com.typesafe.scala-logging:scala-logging_${scalaVersion}:3.9.5" // akka scala logging
implementation "ch.qos.logback:logback-classic:1.5.18"
// used for ArrayHelper
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.googlecode.matrix-toolkits-java:mtj:1.0.4' // matrix data structures
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'org.apache.commons:commons-lang3:3.17.0' // for HashCodeBuilder
implementation 'javax.measure:unit-api:2.2'
implementation 'org.scalanlp:breeze_2.13:2.1.0' // Scientific calculations
}
/* 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
*/
compileScala {
scalaCompileOptions.additionalParameters = [
"-Xplugin:" + configurations.scalaCompilerPlugin.asPath,
"-P:scapegoat:dataDir:" + rootDir + "/build/reports/scapegoat/src/",
"-P:scapegoat:disabledInspections:VariableShadowing",
"-P:scapegoat:ignoredFiles:.*/PowerFactoryGrid.scala" // see scapegoat-sbt page for this param
]
}
// separate scapegoat report for test classes
compileTestScala {
scalaCompileOptions.additionalParameters = [
"-Xplugin:" + configurations.scalaCompilerPlugin.asPath,
"-P:scapegoat:dataDir:" + rootDir + "/build/reports/scapegoat/testsrc/",
"-P:scapegoat:disabledInspections:VariableShadowing"
]
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc){
options.encoding = 'UTF-8'
}
tasks.withType(ScalaCompile) {
options.forkOptions.jvmArgs += [
'-Xmx4096m',
'-Xss4m',
'-Xms2048m',
'-XX:+UseParallelGC',
'-XX:MaxInlineLevel=20'
]
options.compilerArgs += [
'-Xmx4096m',
'-Xss4m',
'-Xms2048m',
'-XX:+UseParallelGC',
'-XX:MaxInlineLevel=20'
]
}
tasks {
test {
// Solution for :compileScoverageGroovy
dependsOn compileScoverageGroovy // or mustRunAfter compileScoverageGroovy
dependsOn processScoverageResources
}
}