From 02d53fe67a8d8997f525f39b22873df6f2bf85b5 Mon Sep 17 00:00:00 2001 From: staudtMarius Date: Tue, 18 Feb 2025 15:35:07 +0100 Subject: [PATCH 1/4] Upgraded to `scala3`. --- CHANGELOG.md | 3 +++ build.gradle | 8 ++++---- gradle/scripts/scoverage.gradle | 2 +- src/main/scala/edu/ie3/powerflow/NewtonRaphsonPF.scala | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b87f9d..bb97416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added Bao and Staudt to list of reviewers [#188](https://github.com/ie3-institute/powerflow/issues/188) +### Changed +- Upgraded to `scala3` [#204](https://github.com/ie3-institute/powerflow/issues/204) + ## [0.2] ### Changed diff --git a/build.gradle b/build.gradle index fa215e9..073ffa3 100644 --- a/build.gradle +++ b/build.gradle @@ -13,8 +13,8 @@ plugins { ext { javaVersion = JavaVersion.VERSION_17 - scalaVersion = '2.13' - scalaBinaryVersion = '2.13.16' + scalaVersion = '3' + scalaBinaryVersion = '3.6.2' scapegoatVersion = '3.1.4' @@ -53,7 +53,7 @@ dependencies { } // CORE Scala // - implementation "org.scala-lang:scala-library:${scalaBinaryVersion}" + implementation "org.scala-lang:scala3-library_${scalaVersion}:${scalaBinaryVersion}" // TEST Scala // testImplementation "org.scalatest:scalatest_${scalaVersion}:3.2.15" @@ -80,7 +80,7 @@ dependencies { 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 + implementation "org.scalanlp:breeze_${scalaVersion}:2.1.0" // Scientific calculations } /* scapegoat hook configuration diff --git a/gradle/scripts/scoverage.gradle b/gradle/scripts/scoverage.gradle index 2424fbd..93a869b 100644 --- a/gradle/scripts/scoverage.gradle +++ b/gradle/scripts/scoverage.gradle @@ -4,7 +4,7 @@ */ scoverage { scoverageVersion = "2.3.0" - scoverageScalaVersion = scalaBinaryVersion + scoverageScalaVersion //= scalaBinaryVersion coverageOutputHTML = false coverageOutputXML = true coverageOutputCobertura = false diff --git a/src/main/scala/edu/ie3/powerflow/NewtonRaphsonPF.scala b/src/main/scala/edu/ie3/powerflow/NewtonRaphsonPF.scala index 8c80faa..0b9203f 100644 --- a/src/main/scala/edu/ie3/powerflow/NewtonRaphsonPF.scala +++ b/src/main/scala/edu/ie3/powerflow/NewtonRaphsonPF.scala @@ -306,7 +306,7 @@ case object NewtonRaphsonPF extends LazyLogging { val v = StateData.extractVoltageVector(state) val nodalPower = v *:* (admittanceMatrix * v).map(i => i.conjugate) (state zip nodalPower.toScalaVector).map(stateAndPowerPair => - stateAndPowerPair._1.copy(power = -1 * stateAndPowerPair._2) + stateAndPowerPair._1.copy(power = stateAndPowerPair._2 * -1) ) } From 5e771d4562d66da75b7bf0b5d7a545c4d106ef05 Mon Sep 17 00:00:00 2001 From: staudtMarius Date: Tue, 22 Apr 2025 11:27:30 +0200 Subject: [PATCH 2/4] Updating `PSU` to version `3.0.0`. --- build.gradle | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 1d4a584..41f2a72 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ plugins { ext { javaVersion = JavaVersion.VERSION_17 scalaVersion = '3' - scalaBinaryVersion = '3.6.2' + scalaBinaryVersion = '3.6.4' scapegoatVersion = '3.1.7' @@ -53,7 +53,7 @@ dependencies { } // CORE Scala // - implementation "org.scala-lang:scala3-library_${scalaVersion}:${scalaBinaryVersion}" + implementation "org.scala-lang:scala3-library_3:${scalaBinaryVersion}" // TEST Scala // testImplementation "org.scalatest:scalatest_${scalaVersion}:3.2.15" @@ -69,7 +69,7 @@ dependencies { implementation "ch.qos.logback:logback-classic:1.5.18" // used for ArrayHelper - implementation('com.github.ie3-institute:PowerSystemUtils:2.2.1') { + implementation('com.github.ie3-institute:PowerSystemUtils:3.0.0') { exclude group: 'org.apache.logging.log4j' exclude group: 'org.slf4j' /* Exclude our own nested dependencies */ @@ -90,6 +90,7 @@ dependencies { */ compileScala { scalaCompileOptions.additionalParameters = [ + "-print-tasty", "-Xplugin:" + configurations.scalaCompilerPlugin.asPath, "-P:scapegoat:dataDir:" + rootDir + "/build/reports/scapegoat/src/", "-P:scapegoat:disabledInspections:VariableShadowing", @@ -100,6 +101,7 @@ compileScala { // separate scapegoat report for test classes compileTestScala { scalaCompileOptions.additionalParameters = [ + "-print-tasty", "-Xplugin:" + configurations.scalaCompilerPlugin.asPath, "-P:scapegoat:dataDir:" + rootDir + "/build/reports/scapegoat/testsrc/", "-P:scapegoat:disabledInspections:VariableShadowing" From 6e1fd482dbf7e34659373b04e4df848a8cf06a91 Mon Sep 17 00:00:00 2001 From: staudtMarius Date: Fri, 9 May 2025 08:51:24 +0200 Subject: [PATCH 3/4] Updating `PSU` to version `3.1.0`. --- build.gradle | 6 ++---- gradle/scripts/scoverage.gradle | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 52ef221..44058eb 100644 --- a/build.gradle +++ b/build.gradle @@ -60,11 +60,11 @@ dependencies { 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 "com.typesafe.scala-logging:scala-logging_${scalaVersion}:3.9.5" // pekko scala logging implementation "ch.qos.logback:logback-classic:1.5.18" // used for ArrayHelper - implementation('com.github.ie3-institute:PowerSystemUtils:3.0.0') { + implementation('com.github.ie3-institute:PowerSystemUtils:3.1.0') { exclude group: 'org.apache.logging.log4j' exclude group: 'org.slf4j' /* Exclude our own nested dependencies */ @@ -85,7 +85,6 @@ dependencies { */ compileScala { scalaCompileOptions.additionalParameters = [ - "-print-tasty", "-Xplugin:" + configurations.scalaCompilerPlugin.asPath, "-P:scapegoat:dataDir:" + rootDir + "/build/reports/scapegoat/src/", "-P:scapegoat:disabledInspections:VariableShadowing", @@ -96,7 +95,6 @@ compileScala { // separate scapegoat report for test classes compileTestScala { scalaCompileOptions.additionalParameters = [ - "-print-tasty", "-Xplugin:" + configurations.scalaCompilerPlugin.asPath, "-P:scapegoat:dataDir:" + rootDir + "/build/reports/scapegoat/testsrc/", "-P:scapegoat:disabledInspections:VariableShadowing" diff --git a/gradle/scripts/scoverage.gradle b/gradle/scripts/scoverage.gradle index 93a869b..919b69a 100644 --- a/gradle/scripts/scoverage.gradle +++ b/gradle/scripts/scoverage.gradle @@ -4,7 +4,6 @@ */ scoverage { scoverageVersion = "2.3.0" - scoverageScalaVersion //= scalaBinaryVersion coverageOutputHTML = false coverageOutputXML = true coverageOutputCobertura = false From 5feb3e77b75f12a6f22bad773dbc979e5ea3665d Mon Sep 17 00:00:00 2001 From: Sebastian Peter Date: Fri, 9 May 2025 09:17:36 +0200 Subject: [PATCH 4/4] Removing checkScoverage, since that's done by sonarqube anyways --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6a7ba82..246b1d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,7 +54,7 @@ String featureBranchName = "" //// gradle tasks that are executed def gradleTasks = "--refresh-dependencies clean spotlessCheck pmdMain pmdTest check" // the gradle tasks that are executed on ALL projects -def mainProjectGradleTasks = "reportScoverage checkScoverage" // additional tasks that are only executed on project 0 (== main project) +def mainProjectGradleTasks = "reportScoverage" // additional tasks that are only executed on project 0 (== main project) /// commit hash def commitHash = ""