From 5db162f93cf7776084f9610c8282229e8fe7f923 Mon Sep 17 00:00:00 2001 From: JulianFP Date: Tue, 23 Aug 2022 14:12:55 +0200 Subject: [PATCH 1/2] Resolving deprecation warnings and bumping library versions --- .bsp/sbt.json | 2 +- build.sbt | 15 ++++++----- src/main/scala/PrivateHome/UI/console.scala | 28 ++++++++++----------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.bsp/sbt.json b/.bsp/sbt.json index 951a8ad..6c50eec 100644 --- a/.bsp/sbt.json +++ b/.bsp/sbt.json @@ -1 +1 @@ -{"name":"sbt","version":"1.4.3","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["/Users/maximilian/Library/Java/JavaVirtualMachines/openjdk-15/Contents/Home/bin/java","-Xms100m","-Xmx100m","-classpath","/Users/maximilian/Library/Application Support/JetBrains/IdeaIC2021.2/plugins/Scala/launcher/sbt-launch.jar","xsbt.boot.Boot","-bsp"]} \ No newline at end of file +{"name":"sbt","version":"1.6.2","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["/home/julian/.cache/JetBrains/RemoteDev/dist/28404f7c56bdc_ideaIU-2022.2.1/jbr/bin/java","-Xms100m","-Xmx100m","-classpath","/home/julian/.config/JetBrains/RemoteDev-IU/_home_julian_Documents_Coding_PrivateHome/plugins/Scala/launcher/sbt-launch.jar","xsbt.boot.Boot","-bsp","--sbt-launch-jar=/home/julian/.config/JetBrains/RemoteDev-IU/_home_julian_Documents_Coding_PrivateHome/plugins/Scala/launcher/sbt-launch.jar"]} \ No newline at end of file diff --git a/build.sbt b/build.sbt index 72c272c..5ce998b 100644 --- a/build.sbt +++ b/build.sbt @@ -47,16 +47,16 @@ Debian / maintainerScripts := maintainerScriptsAppendFromFile((Debian/maintaine Postinst -> sourceDirectory.value / "debian" / "postinst" ) -lazy val akkaVersion = "2.6.17" +lazy val akkaVersion = "2.6.19" //pi4j java wrapper for WiringPI (deprecated by author may be continued be other) -libraryDependencies ++= Seq("com.pi4j" % "pi4j-core" % "1.2","com.pi4j" % "pi4j-parent" % "1.2") +libraryDependencies ++= Seq("com.pi4j" % "pi4j-core" % "1.4","com.pi4j" % "pi4j-parent" % "1.4") //scala Test also used by Akka libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.2" % Test //logback logger used by Akka and scalikejdbc and the whole project -libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.6" +libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.11" //Akka library for Webserver with Websockets Support libraryDependencies ++= Seq( @@ -82,11 +82,11 @@ libraryDependencies ++= Seq( "com.h2database" % "h2" % "1.4.200", "org.scalikejdbc" %% "scalikejdbc-config" % "3.4.0") -libraryDependencies += "org.json4s" % "json4s-jackson_2.13" % "3.6.7" +libraryDependencies += "org.json4s" % "json4s-jackson_2.13" % "3.6.12" -libraryDependencies += "de.mkammerer" % "argon2-jvm" % "2.9.1" +libraryDependencies += "de.mkammerer" % "argon2-jvm" % "2.11" -libraryDependencies += "org.scala-sbt.ipcsocket" % "ipcsocket" % "1.3.0" +libraryDependencies += "org.scala-sbt.ipcsocket" % "ipcsocket" % "1.5.0" libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test" @@ -98,3 +98,6 @@ libraryDependencies += "org.rogach" %% "scallop" % "4.0.4" enablePlugins(DebianPlugin) enablePlugins(JavaServerAppPackaging) enablePlugins(SystemdPlugin) + +//show deprecation and feature warnings +scalacOptions ++= Seq("-deprecation", "-feature") \ No newline at end of file diff --git a/src/main/scala/PrivateHome/UI/console.scala b/src/main/scala/PrivateHome/UI/console.scala index f4d7c2f..16322bf 100644 --- a/src/main/scala/PrivateHome/UI/console.scala +++ b/src/main/scala/PrivateHome/UI/console.scala @@ -39,18 +39,18 @@ object console { * This map contains the commands their function and a help description */ private val commands = Map( - "help" -> REPLCommand(_ => help(), "Prints all available commands"), - "addController" -> REPLCommand(_ => addController(), "Adds a new Controller that is needed for mqttSwitches."), - "addUser" -> REPLCommand(_ => addUser(), "Adds a new User for the WebGui"), - "addSwitch" -> REPLCommand(_ => addSwitch(false), "Adds a new Switch"), - "addDimmer" -> REPLCommand(_ => addSwitch(true), "Adds a new dimmable Switch"), - "dim" -> REPLCommand(_ => dim(), "Set the dimming value of a dimmable Switch"), - "status" -> REPLCommand(_ => status(), "Show the status of Switches"), - "recreateDatabase" -> REPLCommand(_ => recreate(), "Recreates the Database and deletes all data"), - "safeCreate" -> REPLCommand(_ => safeCreate(), "Adds missing tables to the database"), - "getKey" -> REPLCommand(_ => printControllerKey(), "Displays the Key of a given Controller."), - "programController" -> REPLCommand(_ => programController(), "This will transfer the settings for a Controller"), - "exit" → REPLCommand(_ ⇒ exit(), "This will terminate the console") + "help" -> REPLCommand(help, "Prints all available commands"), + "addController" -> REPLCommand(addController, "Adds a new Controller that is needed for mqttSwitches."), + "addUser" -> REPLCommand(addUser, "Adds a new User for the WebGui"), + "addSwitch" -> REPLCommand(() => addSwitch(false), "Adds a new Switch"), + "addDimmer" -> REPLCommand(() => addSwitch(true), "Adds a new dimmable Switch"), + "dim" -> REPLCommand(() => dim(), "Set the dimming value of a dimmable Switch"), + "status" -> REPLCommand(() => status(), "Show the status of Switches"), + "recreateDatabase" -> REPLCommand(recreate, "Recreates the Database and deletes all data"), + "safeCreate" -> REPLCommand(safeCreate, "Adds missing tables to the database"), + "getKey" -> REPLCommand(printControllerKey, "Displays the Key of a given Controller."), + "programController" -> REPLCommand(programController, "This will transfer the settings for a Controller"), + "exit" -> REPLCommand(exit, "This will terminate the console") ) var socket: UnixDomainSocket = _ var triedConnecting = false @@ -105,7 +105,7 @@ object console { val userInput = readLine("> ") if (commands.contains(userInput)) { - commands(userInput).methodToCall.apply() + commands(userInput).methodToCall } else { println("Unrecognized command. Please try again.") } @@ -439,4 +439,4 @@ object console { * @param methodToCall the method to call, when the command is executed * @param description the description to show when the user asks for help */ -case class REPLCommand(methodToCall: Unit => Unit, description: String) +case class REPLCommand(methodToCall: () => Unit, description: String) From 66a7caf48371c45cf4e96525fadb2a2c838ab5dd Mon Sep 17 00:00:00 2001 From: JulianFP Date: Tue, 23 Aug 2022 14:28:50 +0200 Subject: [PATCH 2/2] Resolving a deprecation warning and bumping json4 library version --- build.sbt | 2 +- src/main/scala/PrivateHome/UI/Websocket/websocket.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 5ce998b..6fb97a9 100644 --- a/build.sbt +++ b/build.sbt @@ -82,7 +82,7 @@ libraryDependencies ++= Seq( "com.h2database" % "h2" % "1.4.200", "org.scalikejdbc" %% "scalikejdbc-config" % "3.4.0") -libraryDependencies += "org.json4s" % "json4s-jackson_2.13" % "3.6.12" +libraryDependencies += "org.json4s" % "json4s-jackson_2.13" % "4.0.5" libraryDependencies += "de.mkammerer" % "argon2-jvm" % "2.11" diff --git a/src/main/scala/PrivateHome/UI/Websocket/websocket.scala b/src/main/scala/PrivateHome/UI/Websocket/websocket.scala index 2efbde6..7e4184c 100644 --- a/src/main/scala/PrivateHome/UI/Websocket/websocket.scala +++ b/src/main/scala/PrivateHome/UI/Websocket/websocket.scala @@ -150,7 +150,7 @@ object websocket { * * @param msg The message that should be send to all connections as a JSON object */ - def broadcastMsg(msg: json4s.JObject) { + def broadcastMsg(msg: json4s.JObject): Unit = { for (connection <- ConnectionMap.values) connection(TextMessage.Strict(compact(render(msg)))) }