Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Cross build for Scala 3 for the aws modules #3011

Merged
merged 3 commits into from
Sep 12, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import scala.concurrent.duration._

class EventBridgePublisherSpec extends AnyFlatSpec with Matchers with ScalaFutures with IntegrationTestContext {

implicit val defaultPatience =
implicit val defaultPatience: PatienceConfig =
PatienceConfig(timeout = 15.seconds, interval = 100.millis)

"EventBridge Publisher sink" should "send PutEventsEntry message" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package docs.scaladsl

import java.util.concurrent.CompletableFuture

import akka.actor.ActorSystem
import akka.stream.alpakka.awslambda.scaladsl.AwsLambdaFlow
import akka.stream.alpakka.testkit.scaladsl.LogCapturing
Expand All @@ -25,7 +24,7 @@ import software.amazon.awssdk.core.SdkBytes
import software.amazon.awssdk.services.lambda.LambdaAsyncClient
import software.amazon.awssdk.services.lambda.model.{InvokeRequest, InvokeResponse}

import scala.concurrent.Await
import scala.concurrent.{Await, ExecutionContext}
import scala.concurrent.duration._

class AwsLambdaFlowSpec
Expand All @@ -37,9 +36,9 @@ class AwsLambdaFlowSpec
with Matchers
with LogCapturing {

implicit val ec = system.dispatcher
implicit val ec: ExecutionContext = system.dispatcher

implicit val awsLambdaClient = mock(classOf[LambdaAsyncClient])
implicit val awsLambdaClient: LambdaAsyncClient = mock(classOf[LambdaAsyncClient])

override protected def afterEach(): Unit = {
reset(awsLambdaClient)
Expand Down
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ lazy val avroparquetTests =
.dependsOn(avroparquet)
.disablePlugins(MimaPlugin)

lazy val awslambda = alpakkaProject("awslambda", "aws.lambda", Dependencies.AwsLambda)
lazy val awslambda = alpakkaProject("awslambda", "aws.lambda", Dependencies.AwsLambda).settings(Scala3.settings)

lazy val azureStorageQueue = alpakkaProject(
"azure-storage-queue",
Expand All @@ -148,7 +148,7 @@ lazy val csvBench = internalProject("csv-bench")
.dependsOn(csv)
.enablePlugins(JmhPlugin)

lazy val dynamodb = alpakkaProject("dynamodb", "aws.dynamodb", Dependencies.DynamoDB)
lazy val dynamodb = alpakkaProject("dynamodb", "aws.dynamodb", Dependencies.DynamoDB).settings(Scala3.settings)

lazy val elasticsearch = alpakkaProject(
"elasticsearch",
Expand Down Expand Up @@ -273,7 +273,7 @@ lazy val jms = alpakkaProject("jms", "jms", Dependencies.Jms, Scala3.settings)

lazy val jsonStreaming = alpakkaProject("json-streaming", "json.streaming", Dependencies.JsonStreaming)

lazy val kinesis = alpakkaProject("kinesis", "aws.kinesis", Dependencies.Kinesis)
lazy val kinesis = alpakkaProject("kinesis", "aws.kinesis", Dependencies.Kinesis).settings(Scala3.settings)

lazy val kudu = alpakkaProject("kudu", "kudu", Dependencies.Kudu)

Expand Down Expand Up @@ -320,13 +320,13 @@ lazy val simpleCodecs = alpakkaProject("simple-codecs", "simplecodecs")
lazy val slick = alpakkaProject("slick", "slick", Dependencies.Slick)

lazy val eventbridge =
alpakkaProject("aws-event-bridge", "aws.eventbridge", Dependencies.Eventbridge)
alpakkaProject("aws-event-bridge", "aws.eventbridge", Dependencies.Eventbridge).settings(Scala3.settings)

lazy val sns = alpakkaProject("sns", "aws.sns", Dependencies.Sns)
lazy val sns = alpakkaProject("sns", "aws.sns", Dependencies.Sns).settings(Scala3.settings)

lazy val solr = alpakkaProject("solr", "solr", Dependencies.Solr)

lazy val sqs = alpakkaProject("sqs", "aws.sqs", Dependencies.Sqs)
lazy val sqs = alpakkaProject("sqs", "aws.sqs", Dependencies.Sqs).settings(Scala3.settings)

lazy val sse = alpakkaProject("sse", "sse", Dependencies.Sse)

Expand Down
2 changes: 2 additions & 0 deletions kinesis/src/main/mima-filters/6.0.3.backwards.excludes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 6.0.3 scala3 comp - https://github.com/akka/alpakka/pull/3011
ProblemFilters.exclude[MissingTypesProblem]("akka.stream.alpakka.kinesis.ShardIterator$AtTimestamp$")
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ object ShardIterator {
override final val shardIteratorType: ShardIteratorType = ShardIteratorType.TRIM_HORIZON
}

object AtTimestamp {
def apply(value: Instant) = new AtTimestamp(value)
}
case class AtTimestamp private (value: Instant) extends ShardIterator {
override final val timestamp: Option[Instant] = Some(value)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class KinesisSchedulerSourceSpec

var recordProcessor: ShardRecordProcessor = _
var otherRecordProcessor: ShardRecordProcessor = _
private val schedulerBuilder = { x: ShardRecordProcessorFactory =>
private val schedulerBuilder = { (x: ShardRecordProcessorFactory) =>
recordProcessor = x.shardRecordProcessor()
otherRecordProcessor = x.shardRecordProcessor()
semaphore.release()
Expand Down Expand Up @@ -348,7 +348,7 @@ class KinesisSchedulerSourceSpec
) {
override def shutdownReason: Option[ShutdownReason] = None

override def forceCheckpoint(): Unit = checkpointer(record)
override def forceCheckpoint(): Unit = checkpointer(this.record)
}
)
latestRecord = record
Expand Down Expand Up @@ -390,7 +390,7 @@ class KinesisSchedulerSourceSpec
) {
override def shutdownReason: Option[ShutdownReason] = None

override def forceCheckpoint(): Unit = checkpointerShard1(record)
override def forceCheckpoint(): Unit = checkpointerShard1(this.record)
}
)
latestRecordShard1 = record
Expand All @@ -410,7 +410,7 @@ class KinesisSchedulerSourceSpec
) {
override def shutdownReason: Option[ShutdownReason] = None

override def forceCheckpoint(): Unit = checkpointerShard2(record)
override def forceCheckpoint(): Unit = checkpointerShard2(this.record)
}
)
latestRecordShard2 = record
Expand Down Expand Up @@ -444,7 +444,7 @@ class KinesisSchedulerSourceSpec
)
) {
override def shutdownReason: Option[ShutdownReason] = None
override def forceCheckpoint(): Unit = checkpointer(record)
override def forceCheckpoint(): Unit = checkpointer(this.record)
}
sourceProbe.sendNext(committableRecord)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class KinesisFirehoseFlowSpec extends AnyWordSpec with Matchers with KinesisFire
.run()
}

trait WithPutRecordsSuccess { self: KinesisFirehoseFlowProbe =>
trait WithPutRecordsSuccess { self: KinesisFirehoseFlowProbe with Settings =>
when(amazonKinesisFirehoseAsync.putRecordBatch(any[PutRecordBatchRequest])).thenAnswer(new Answer[AnyRef] {
override def answer(invocation: InvocationOnMock) = {
val request = invocation
Expand All @@ -92,7 +92,7 @@ class KinesisFirehoseFlowSpec extends AnyWordSpec with Matchers with KinesisFire
})
}

trait WithPutRecordsFailure { self: KinesisFirehoseFlowProbe =>
trait WithPutRecordsFailure { self: KinesisFirehoseFlowProbe with Settings =>
when(amazonKinesisFirehoseAsync.putRecordBatch(any[PutRecordBatchRequest])).thenAnswer(new Answer[AnyRef] {
override def answer(invocation: InvocationOnMock) = {
val future = new CompletableFuture()
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object Dependencies {
val InfluxDBJavaVersion = "2.15"

val AwsSdk2Version = "2.17.113"
val AwsSpiAkkaHttpVersion = "0.0.11"
val AwsSpiAkkaHttpVersion = "1.0.1"
// Sync with plugins.sbt
val AkkaGrpcBinaryVersion = "2.3"
// sync ignore prefix in scripts/link-validator.conf#L30
Expand Down
2 changes: 1 addition & 1 deletion sns/src/test/scala/docs/scaladsl/SnsPublisherSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SnsPublisherSpec
with IntegrationTestContext
with LogCapturing {

implicit val defaultPatience =
implicit val defaultPatience: PatienceConfig =
PatienceConfig(timeout = 15.seconds, interval = 100.millis)

"SNS Publisher sink" should "send string message" in {
Expand Down
2 changes: 1 addition & 1 deletion sqs/src/test/scala/docs/scaladsl/SqsSourceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class SqsSourceSpec extends AnyFlatSpec with ScalaFutures with Matchers with Def
val customClient: SdkAsyncHttpClient = AkkaHttpClient.builder().withActorSystem(system).build()

//#init-custom-client
implicit val customSqsClient = SqsAsyncClient
implicit val customSqsClient: SqsAsyncClient = SqsAsyncClient
.builder()
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("x", "x")))
//#init-custom-client
Expand Down