Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@ object Common extends AutoPlugin {
organizationHomepage := Some(url("http://www.tmt.org")),
resolvers += "jitpack" at "https://jitpack.io",

// Scala 3 (3.6.4). The following Scala 2-only flags were removed in the port:
// -Wdead-code, -Xlint:_,-missing-interpolator, -Xsource:3, -Xcheckinit, -Xasync
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-deprecation",
//-W Options
"-Wdead-code",
//-X Options
"-Xlint:_,-missing-interpolator",
"-Xsource:3",
"-Xcheckinit",
"-Xasync"
"-deprecation"
),
Compile / doc / javacOptions ++= Seq("-Xdoclint:none"),
Test / testOptions ++= Seq(
Expand All @@ -47,4 +42,4 @@ object Common extends AutoPlugin {
// case Some("false") => false
// case _ => true
// }
}
}
39 changes: 13 additions & 26 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,47 +1,34 @@
import sbt._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._

object Dependencies {
val vbdsServer = Seq(
CSW.`csw-location-client`,
CSW.`csw-network-utils`,
Akka.`akka-stream-typed`,
Akka.`akka-actor-typed`,
Akka.`akka-cluster-typed`,
Akka.`akka-slf4j`,
AkkaHttp.`akka-http`,
AkkaHttp.`akka-http-spray-json`,
Pekko.`pekko-stream-typed`,
Pekko.`pekko-actor-typed`,
Pekko.`pekko-cluster-typed`,
Pekko.`pekko-slf4j`,
PekkoHttp.`pekko-http`,
PekkoHttp.`pekko-http-spray-json`,
Libs.`scopt`,
Libs.`boopickle`,
// Chill.`chill-akka`,
Libs.`logback-classic`,

Libs.`commons-io` % Test,
Libs.`scalatest` % Test,
AkkaHttp.`akka-http-testkit` % Test,
Akka.`akka-multi-node-testkit` % Test
PekkoHttp.`pekko-http-testkit` % Test,
Pekko.`pekko-multi-node-testkit` % Test
)

val vbdsClient = Seq(
CSW.`csw-location-client`,
Akka.`akka-stream`,
Akka.`akka-slf4j`,
AkkaHttp.`akka-http`,
Pekko.`pekko-stream`,
Pekko.`pekko-slf4j`,
PekkoHttp.`pekko-http`,
Libs.`scopt`,
Libs.`logback-classic`,

Libs.`scalatest` % Test,
AkkaHttp.`akka-http-testkit` % Test
PekkoHttp.`pekko-http-testkit` % Test
)

// ScalaJS web client scala dependencies
val webClient = Def.setting(Seq(
"org.scala-js" %%% "scalajs-dom" % "1.1.0",
"com.lihaoyi" %%% "scalatags" % "0.9.4",
"com.github.japgolly.scalacss" %%% "core" % "0.7.0",
"com.github.japgolly.scalacss" %%% "ext-scalatags" % "0.7.0",
"com.lihaoyi" %%% "upickle" % "1.4.0",
"org.scalatest" %%% "scalatest" % "3.2.9" % "test"
))

}
}
80 changes: 39 additions & 41 deletions project/Libs.scala
Original file line number Diff line number Diff line change
@@ -1,54 +1,52 @@
import sbt._

object Libs {
val ScalaVersion = "2.13.8"

val `scalatest` = "org.scalatest" %% "scalatest" % "3.2.11" //Apache License 2.0
val `scala-async` = "org.scala-lang.modules" %% "scala-async" % "1.0.1" //BSD 3-clause "New" or "Revised" License
val `scopt` = "com.github.scopt" %% "scopt" % "4.0.1" //MIT License
val `logback-classic` = "ch.qos.logback" % "logback-classic" % "1.2.10" // GNU Lesser General Public License version 2.1
val `akka-management-cluster-http` = "com.lightbend.akka" %% "akka-management-cluster-http" % "1.1.3" //N/A at the moment
val `boopickle` = "io.suzaku" %% "boopickle" % "1.4.0" // Apache License 2.0
val `commons-io` = "commons-io" % "commons-io" % "2.11.0" // Apache License 2.0
val ScalaVersion = "3.6.4"

val `scalatest` = "org.scalatest" %% "scalatest" % "3.2.19" // Apache License 2.0 (aligned w/ csw-6.0.0)
val `scopt` = "com.github.scopt" %% "scopt" % "4.1.0" // MIT License (aligned w/ csw-6.0.0)
val `logback-classic` = "ch.qos.logback" % "logback-classic" % "1.5.17" // EPL v1.0 / LGPL 2.1 (aligned w/ csw-6.0.0)
val `boopickle` = "io.suzaku" %% "boopickle" % "1.4.0" // Apache License 2.0 (Scala 3-capable)
val `commons-io` = "commons-io" % "commons-io" % "2.11.0" // Apache License 2.0

// Removed in the csw-6.0.0 / Pekko / Scala 3 port:
// scala-async -- Scala 2-only, and was not wired into either module
// akka-management-cluster-http -- defined-but-unused
}

object CSW {
private val Org = "com.github.tmtsoftware.csw"
// private val Version = "0.1.0-SNAPSHOT"
private val Version = "5.0.0"
private val Org = "com.github.tmtsoftware.csw"
private val Version = "6.0.0"

val `csw-network-utils` = Org %% "csw-network-utils" % Version
val `csw-network-utils` = Org %% "csw-network-utils" % Version
val `csw-location-client` = Org %% "csw-location-client" % Version
val `csw-commons` = Org %% "csw-commons" % Version
val `csw-commons` = Org %% "csw-commons" % Version
}

object Akka {
val Version = "2.6.18" //all akka is Apache License 2.0
val `akka-stream` = "com.typesafe.akka" %% "akka-stream" % Version
val `akka-stream-typed` = "com.typesafe.akka" %% "akka-stream-typed" % Version
val `akka-stream-testkit` = "com.typesafe.akka" %% "akka-stream-testkit" % Version
val `akka-actor` = "com.typesafe.akka" %% "akka-actor" % Version
val `akka-actor-typed` = "com.typesafe.akka" %% "akka-actor-typed" % Version
val `akka-testkit-typed` = "com.typesafe.akka" %% "akka-testkit-typed" % Version
val `akka-distributed-data` = "com.typesafe.akka" %% "akka-distributed-data" % Version
val `akka-multi-node-testkit` = "com.typesafe.akka" %% "akka-multi-node-testkit" % Version
val `akka-cluster` = "com.typesafe.akka" %% "akka-cluster" % Version
val `akka-cluster-tools` = "com.typesafe.akka" %% "akka-cluster-tools" % Version
val `akka-cluster-typed` = "com.typesafe.akka" %% "akka-cluster-typed" % Version
val `akka-slf4j` = "com.typesafe.akka" %% "akka-slf4j" % Version
object Pekko { // all pekko is Apache License 2.0
val Version = "1.1.3"
val Org = "org.apache.pekko"

val `pekko-stream` = Org %% "pekko-stream" % Version
val `pekko-stream-typed` = Org %% "pekko-stream-typed" % Version
val `pekko-stream-testkit` = Org %% "pekko-stream-testkit" % Version
val `pekko-actor` = Org %% "pekko-actor" % Version
val `pekko-actor-typed` = Org %% "pekko-actor-typed" % Version
val `pekko-actor-testkit-typed`= Org %% "pekko-actor-testkit-typed" % Version
val `pekko-distributed-data` = Org %% "pekko-distributed-data" % Version
val `pekko-multi-node-testkit` = Org %% "pekko-multi-node-testkit" % Version
val `pekko-cluster` = Org %% "pekko-cluster" % Version
val `pekko-cluster-tools` = Org %% "pekko-cluster-tools" % Version
val `pekko-cluster-typed` = Org %% "pekko-cluster-typed" % Version
val `pekko-slf4j` = Org %% "pekko-slf4j" % Version
}

object AkkaHttp { //ApacheV2
val Version = "10.2.7"
val `akka-http` = "com.typesafe.akka" %% "akka-http" % Version
val `akka-http-core` = "com.typesafe.akka" %% "akka-http-core" % Version
val `akka-http-testkit` = "com.typesafe.akka" %% "akka-http-testkit" % Version
val `akka-http-spray-json` = "com.typesafe.akka" %% "akka-http-spray-json" % Version
}

//object Chill {
// val Version = "0.10.0"
// val `chill-akka` = "com.twitter" %% "chill-akka" % Version //Apache License 2.0
//}

object PekkoHttp { // Apache License 2.0
val Version = "1.1.0"
val Org = "org.apache.pekko"

val `pekko-http` = Org %% "pekko-http" % Version
val `pekko-http-core` = Org %% "pekko-http-core" % Version
val `pekko-http-testkit` = Org %% "pekko-http-testkit" % Version
val `pekko-http-spray-json` = Org %% "pekko-http-spray-json" % Version
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.5.2
sbt.version=1.12.11
17 changes: 4 additions & 13 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
//addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
//addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.4.0")
//addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.4.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")

// web client
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0")

// Requires local plugin build and publishLocal, since existing plugin was abandoned
//addSbtPlugin("com.lihaoyi" % "workbench" % "0.4.2")

addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.4.0")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.1")
18 changes: 9 additions & 9 deletions vbds-client/src/main/scala/vbds/client/FileUploader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package vbds.client

import java.nio.file.Path

import akka.{Done, NotUsed}
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.marshalling.Marshal
import akka.http.scaladsl.model.Multipart.FormData
import akka.http.scaladsl.model._
import akka.stream.ThrottleMode
import akka.stream.scaladsl._
import org.apache.pekko.{Done, NotUsed}
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.marshalling.Marshal
import org.apache.pekko.http.scaladsl.model.Multipart.FormData
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.stream.ThrottleMode
import org.apache.pekko.stream.scaladsl._

import scala.concurrent.Future
import scala.concurrent.duration._
Expand Down Expand Up @@ -55,4 +55,4 @@ class FileUploader(chunkSize: Int = 1024 * 1024)(implicit val system: ActorSyste
upload(source.throttle(1, delay, 1, ThrottleMode.Shaping))
else upload(source)
}
}
}
21 changes: 10 additions & 11 deletions vbds-client/src/main/scala/vbds/client/VbdsClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ package vbds.client
import java.io.File
import java.nio.file.Path
import java.time.Instant

import akka.Done
import akka.actor.{ActorRef, ActorSystem}
import akka.event.{LogSource, Logging}
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.*
import akka.http.scaladsl.model.ws.Message
import akka.stream.scaladsl.MergeHub
import org.apache.pekko.Done
import org.apache.pekko.actor.{ActorRef, ActorSystem}
import org.apache.pekko.event.{LogSource, Logging}
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model.*
import org.apache.pekko.http.scaladsl.model.ws.Message
import org.apache.pekko.stream.scaladsl.MergeHub
import vbds.client.VbdsClient.Subscription

import scala.concurrent.{Await, Future}
import scala.concurrent.{Await, ExecutionContextExecutor, Future}
import scala.concurrent.duration.*
import scala.util.{Failure, Success, Try}

Expand All @@ -37,7 +36,7 @@ object VbdsClient {
//noinspection HttpUrlsUsage
class VbdsClient(name: String, host: String, port: Int, chunkSize: Int = 1024 * 1024)(implicit val system: ActorSystem) {

implicit val executionContext = system.dispatcher
implicit val executionContext: ExecutionContextExecutor = system.dispatcher
val adminRoute = "/vbds/admin/streams"
val accessRoute = "/vbds/access/streams"
val transferRoute = "/vbds/transfer/streams"
Expand Down Expand Up @@ -197,4 +196,4 @@ class VbdsClient(name: String, host: String, port: Int, chunkSize: Int = 1024 *
wsListener.subscribe(uri, receiver, outSource)
}

}
}
21 changes: 11 additions & 10 deletions vbds-client/src/main/scala/vbds/client/WebSocketActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package vbds.client
import java.io.{File, FileOutputStream}
import java.nio.file.Path

import akka.NotUsed
import akka.actor.{Actor, ActorLogging, ActorRef, ActorSystem, Props}
import akka.http.scaladsl.model.ws.{BinaryMessage, Message, TextMessage}
import akka.util.{ByteString, Timeout}
import akka.stream.scaladsl.{Sink, Source}
import org.apache.pekko.NotUsed
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef, ActorSystem, Props}
import org.apache.pekko.http.scaladsl.model.ws.{BinaryMessage, Message, TextMessage}
import org.apache.pekko.util.{ByteString, Timeout}
import org.apache.pekko.stream.scaladsl.{Sink, Source}

import scala.concurrent.Future
import scala.concurrent.duration._
import scala.util._
import akka.pattern.ask
import scala.compiletime.uninitialized
import org.apache.pekko.pattern.ask

/**
* An actor that receives websocket messages from the VBDS server.
Expand Down Expand Up @@ -74,9 +75,9 @@ class WebSocketActor(name: String,
import system.dispatcher

var count = 0
var file: File = _
var os: FileOutputStream = _
implicit val askTimeout = Timeout(20.seconds)
var file: File = uninitialized
var os: FileOutputStream = uninitialized
implicit val askTimeout: Timeout = Timeout(20.seconds)

log.debug(s"$name: Started WebSocketActor")

Expand Down Expand Up @@ -142,4 +143,4 @@ class WebSocketActor(name: String,
}
}

}
}
14 changes: 7 additions & 7 deletions vbds-client/src/main/scala/vbds/client/WebSocketListener.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package vbds.client

import akka.NotUsed
import akka.actor.{ActorRef, ActorSystem}
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.ws.{Message, WebSocketRequest}
import akka.http.scaladsl.model.{HttpResponse, Uri}
import akka.stream.scaladsl.{Flow, Sink, Source}
import org.apache.pekko.NotUsed
import org.apache.pekko.actor.{ActorRef, ActorSystem}
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model.ws.{Message, WebSocketRequest}
import org.apache.pekko.http.scaladsl.model.{HttpResponse, Uri}
import org.apache.pekko.stream.scaladsl.{Flow, Sink, Source}
import vbds.client.WebSocketListener.SubscribeResult

import scala.concurrent.{Future, Promise}
Expand Down Expand Up @@ -61,4 +61,4 @@ class WebSocketListener(implicit val system: ActorSystem) {
new SubscribeResult(upgradeResponse.map(_.response), promise)
}

}
}
Loading