Skip to content

Commit

Permalink
bump: Scala 2.13.12 (was 2.13.10) (#3027)
Browse files Browse the repository at this point in the history
  • Loading branch information
ennru committed Oct 23, 2023
1 parent 98dda52 commit ff322ae
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private[ftp] trait FtpBrowserGraphStage[FtpClient, S <: RemoteFileSettings]

def emitTraversedDirectories: Boolean = false

def createLogic(inheritedAttributes: Attributes) = {
def createLogic(inheritedAttributes: Attributes): FtpGraphStageLogic[FtpFile, FtpClient, S] = {
val logic = new FtpGraphStageLogic[FtpFile, FtpClient, S](shape, ftpLike, connectionSettings, ftpClient) {

private[this] var buffer: Seq[FtpFile] = Seq.empty[FtpFile]
Expand Down Expand Up @@ -75,9 +75,9 @@ private[ftp] trait FtpBrowserGraphStage[FtpClient, S <: RemoteFileSettings]

private[this] def getFilesFromPath(basePath: String) =
if (basePath.isEmpty)
ftpLike.listFiles(handler.get)
logicFtpLike.listFiles(handler.get)
else
ftpLike.listFiles(basePath, handler.get)
logicFtpLike.listFiles(basePath, handler.get)

} // end of stage logic

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private[ftp] trait FtpDirectoryOperationsGraphStage[FtpClient, S <: RemoteFileSe
out,
new OutHandler {
override def onPull(): Unit = {
push(out, ftpLike.mkdir(basePath, directoryName, handler.get))
push(out, logicFtpLike.mkdir(basePath, directoryName, handler.get))
complete(out)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ import scala.util.control.NonFatal
@InternalApi
private[ftp] abstract class FtpGraphStageLogic[T, FtpClient, S <: RemoteFileSettings](
val shape: Shape,
val ftpLike: FtpLike[FtpClient, S],
val logicFtpLike: FtpLike[FtpClient, S],
val connectionSettings: S,
val ftpClient: () => FtpClient
) extends GraphStageLogic(shape) {

protected[this] implicit val client: FtpClient = ftpClient()
protected[this] var handler: Option[ftpLike.Handler] = Option.empty[ftpLike.Handler]
protected[this] var handler: Option[logicFtpLike.Handler] = Option.empty[logicFtpLike.Handler]
protected[this] var failed = false

override def preStart(): Unit = {
super.preStart()
try {
val tryConnect = ftpLike.connect(connectionSettings)
val tryConnect = logicFtpLike.connect(connectionSettings)
if (tryConnect.isSuccess) {
handler = tryConnect.toOption
} else
Expand Down Expand Up @@ -67,7 +67,7 @@ private[ftp] abstract class FtpGraphStageLogic[T, FtpClient, S <: RemoteFileSett
protected[this] def doPreStart(): Unit

protected[this] def disconnect(): Unit =
handler.foreach(ftpLike.disconnect)
handler.foreach(logicFtpLike.disconnect)

protected[this] def matSuccess(): Boolean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ private[ftp] trait FtpIOSourceStage[FtpClient, S <: RemoteFileSettings]
}

protected[this] def doPreStart(): Unit =
isOpt = ftpLike match {
isOpt = logicFtpLike match {
case ur: UnconfirmedReads =>
withUnconfirmedReads(ur)
case ro: RetrieveOffset =>
Some(ro.retrieveFileInputStream(path, handler.get.asInstanceOf[ro.Handler], offset).get)
case _ =>
Some(ftpLike.retrieveFileInputStream(path, handler.get).get)
Some(logicFtpLike.retrieveFileInputStream(path, handler.get).get)
}

private def withUnconfirmedReads(
Expand Down Expand Up @@ -236,7 +236,7 @@ private[ftp] trait FtpIOSinkStage[FtpClient, S <: RemoteFileSettings]
}

protected[this] def doPreStart(): Unit = {
osOpt = Some(ftpLike.storeFileOutputStream(path, handler.get, append).get)
osOpt = Some(logicFtpLike.storeFileOutputStream(path, handler.get, append).get)
pull(in)
}

Expand Down Expand Up @@ -286,7 +286,7 @@ private[ftp] trait FtpMoveSink[FtpClient, S <: RemoteFileSettings]
override def onPush(): Unit = {
try {
val sourcePath = grab(in)
ftpLike.move(sourcePath.path, destinationPath(sourcePath), handler.get)
logicFtpLike.move(sourcePath.path, destinationPath(sourcePath), handler.get)
numberOfMovedFiles = numberOfMovedFiles + 1
pull(in)
} catch {
Expand Down Expand Up @@ -342,7 +342,7 @@ private[ftp] trait FtpRemoveSink[FtpClient, S <: RemoteFileSettings]
new InHandler {
override def onPush(): Unit = {
try {
ftpLike.remove(grab(in).path, handler.get)
logicFtpLike.remove(grab(in).path, handler.get)
numberOfRemovedFiles = numberOfRemovedFiles + 1
pull(in)
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import scala.util.Random
abstract class GCStorageWiremockBase(_system: ActorSystem, _wireMockServer: Hoverfly) extends TestKit(_system) {

def this(mock: Hoverfly) =
this(ActorSystem(getCallerName(getClass),
this(ActorSystem(getCallerName(classOf[GCStorageWiremockBase]),
config(mock.getHoverflyConfig.getProxyPort).withFallback(ConfigFactory.load())),
mock)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import akka.stream.Materializer
import akka.stream.alpakka.google.RequestSettings

import java.time.Clock
import scala.annotation.unused
import scala.concurrent.Future

@InternalApi
Expand All @@ -26,7 +27,7 @@ private[auth] object ComputeEngineCredentials {
private final class ComputeEngineCredentials(projectId: String)(implicit mat: Materializer)
extends OAuth2Credentials(projectId) {
override protected def getAccessToken()(implicit mat: Materializer,
settings: RequestSettings,
@unused settings: RequestSettings,
clock: Clock): Future[AccessToken] =
GoogleComputeMetadata.getAccessToken()
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.typesafe.config.Config

import java.net.URI
import java.util
import scala.annotation.unused
import scala.concurrent.{ExecutionContext, Future}

@InternalApi
Expand All @@ -25,10 +26,11 @@ private[auth] final case class NoCredentials private (projectId: String, token:

private val futureToken = Future.successful(OAuth2BearerToken(token))

override def get()(implicit ec: ExecutionContext, settings: RequestSettings): Future[OAuth2BearerToken] =
override def get()(implicit @unused ec: ExecutionContext,
@unused settings: RequestSettings): Future[OAuth2BearerToken] =
futureToken

override def asGoogle(implicit ec: ExecutionContext, settings: RequestSettings): GoogleCredentials =
override def asGoogle(implicit @unused ec: ExecutionContext, @unused settings: RequestSettings): GoogleCredentials =
new GoogleCredentials {
override def getAuthenticationType: String = "<none>"
override def getRequestMetadata(uri: URI): util.Map[String, util.List[String]] = util.Collections.emptyMap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import akka.stream.{CompletionStrategy, Materializer, OverflowStrategy}
import com.google.auth.{Credentials => GoogleCredentials}

import java.time.Clock
import scala.annotation.unused
import scala.concurrent.{ExecutionContext, Future, Promise}

@InternalApi
Expand All @@ -28,7 +29,7 @@ private[auth] abstract class OAuth2Credentials(val projectId: String)(implicit m

private val tokenStream = stream.run()

override def get()(implicit ec: ExecutionContext, settings: RequestSettings): Future[OAuth2BearerToken] = {
override def get()(implicit @unused ec: ExecutionContext, settings: RequestSettings): Future[OAuth2BearerToken] = {
val token = Promise[OAuth2BearerToken]()
tokenStream ! TokenRequest(token, settings)
token.future
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import spray.json.DefaultJsonProtocol._
import spray.json.{JsonParser, RootJsonFormat}

import java.time.Clock
import scala.annotation.unused
import scala.concurrent.Future
import scala.io.Source

Expand Down Expand Up @@ -68,7 +69,7 @@ private final class UserAccessCredentials(clientId: String,
) extends OAuth2Credentials(projectId) {

override protected def getAccessToken()(implicit mat: Materializer,
settings: RequestSettings,
@unused settings: RequestSettings,
clock: Clock): Future[AccessToken] = {
UserAccessMetadata.getAccessToken(clientId, clientSecret, refreshToken)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.scalatest.wordspec.AnyWordSpecLike
import pdi.jwt.JwtTime

import java.time.Clock
import scala.annotation.unused
import scala.concurrent.{Future, Promise}

class OAuth2CredentialsSpec
Expand All @@ -41,9 +42,9 @@ class OAuth2CredentialsSpec
}

val testableCredentials = new OAuth2Credentials("dummyProject") {
override protected def getAccessToken()(implicit mat: Materializer,
settings: RequestSettings,
clock: Clock): Future[AccessToken] =
override protected def getAccessToken()(implicit @unused mat: Materializer,
@unused settings: RequestSettings,
@unused clock: Clock): Future[AccessToken] =
AccessTokenProvider.accessTokenPromise.future
}

Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Dependencies {

val CronBuild = sys.env.get("GITHUB_EVENT_NAME").contains("schedule")

val Scala213 = "2.13.10" // update even in link-validator.conf
val Scala213 = "2.13.12" // update even in link-validator.conf
val Scala3 = "3.3.1"
val Scala2Versions = Seq(Scala213)
val ScalaVersions = Dependencies.Scala2Versions :+ Dependencies.Scala3
Expand Down
4 changes: 2 additions & 2 deletions scripts/link-validator.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ site-link-validator {
"http://www.thedevpiece.com/"
# genereated by @apidoc
"http://pravega.io/"
"http://www.scala-lang.org/api/2.13.10/scala/concurrent/Future.html"
"http://www.scala-lang.org/api/2.13.10/scala/util/Try.html"
"http://www.scala-lang.org/api/2.13.12/scala/concurrent/Future.html"
"http://www.scala-lang.org/api/2.13.12/scala/util/Try.html"
]
}

0 comments on commit ff322ae

Please sign in to comment.