Skip to content

Commit

Permalink
Release as JDK 8+ for most modules, JDK 11+ for smithy4s modules (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
etspaceman committed May 9, 2023
1 parent 0f883b4 commit 8526691
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
15 changes: 10 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ lazy val `smithy4s-client-transformers` = projectMatrix
description := "Transformers for the smithy4s-client project",
libraryDependencies ++= Seq(
Smithy.build(smithy4s.codegen.BuildInfo.smithyVersion)
)
),
tlJdkRelease := Some(11)
)
.jvmPlatform(List(Scala212))

Expand All @@ -281,7 +282,8 @@ lazy val `smithy4s-client` = projectMatrix
Scala212
) / Compile / packageBin).value,
Compile / smithy4sSmithyLibrary := false,
scalacOptions -= "-deprecation"
scalacOptions -= "-deprecation",
tlJdkRelease := Some(11)
)
.jvmPlatform(last2ScalaVersions)
.nativePlatform(Seq(Scala3))
Expand All @@ -291,7 +293,8 @@ lazy val `smithy4s-client` = projectMatrix
lazy val `smithy4s-client-logging-circe` = projectMatrix
.settings(
description := "JSON structured logging instances for the Smithy4s Kinesis Client, via Circe",
libraryDependencies ++= Seq(Http4s.circe.value)
libraryDependencies ++= Seq(Http4s.circe.value),
tlJdkRelease := Some(11)
)
.jvmPlatform(last2ScalaVersions)
.nativePlatform(Seq(Scala3))
Expand All @@ -300,7 +303,8 @@ lazy val `smithy4s-client-logging-circe` = projectMatrix

lazy val `smithy4s-client-localstack` = projectMatrix
.settings(
description := "A test-kit for working with Kinesis and Localstack, via the Smithy4s Client project"
description := "A test-kit for working with Kinesis and Localstack, via the Smithy4s Client project",
tlJdkRelease := Some(11)
)
.jvmPlatform(last2ScalaVersions)
.nativePlatform(Seq(Scala3))
Expand Down Expand Up @@ -330,7 +334,8 @@ lazy val integrationTestsJvmSettings: Seq[Setting[_]] = Seq(
}
case x => MergeStrategy.defaultMergeStrategy(x)
},
assembly / mainClass := Some("kinesis4cats.kcl.http4s.TestKCLService")
assembly / mainClass := Some("kinesis4cats.kcl.http4s.TestKCLService"),
tlJdkRelease := Some(11)
)

lazy val integrationTestsJvmDependencies = List(
Expand Down
6 changes: 4 additions & 2 deletions kpl/src/main/scala/kinesis4cats/kpl/KPLProducer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class KPLProducer[F[_]] private (
* Optional hash key, used to explicitly set the shard and override the
* partitionKey hash.
* @param data
* [[java.nio.ByteBuffer]] representing the data to be produced
* [[https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html ByteBuffer]]
* representing the data to be produced
* @return
* F of
* [[https://github.com/awslabs/amazon-kinesis-producer/blob/master/java/amazon-kinesis-producer/src/main/java/com/amazonaws/services/kinesis/producer/UserRecordResult.java UserRecordResult]]
Expand Down Expand Up @@ -154,7 +155,8 @@ class KPLProducer[F[_]] private (
* Optional hash key, used to explicitly set the shard and override the
* partitionKey hash.
* @param data
* [[java.nio.ByteBuffer]] representing the data to be produced
* [[https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html ByteBuffer]]
* representing the data to be produced
* @param schema
* [[https://github.com/awslabs/aws-glue-schema-registry/blob/master/common/src/main/java/com/amazonaws/services/schemaregistry/common/Schema.java Schema]]
* representing a glue schema for this event
Expand Down
4 changes: 3 additions & 1 deletion project/Kinesis4CatsPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ object Kinesis4CatsPlugin extends AutoPlugin {
import TypelevelCiPlugin.autoImport._
import TypelevelGitHubPlugin.autoImport._
import TypelevelKernelPlugin.autoImport._
import TypelevelSettingsPlugin.autoImport._
import TypelevelSitePlugin.autoImport._
import TypelevelVersioningPlugin.autoImport._
import autoImport._
Expand Down Expand Up @@ -257,7 +258,8 @@ object Kinesis4CatsPlugin extends AutoPlugin {
else (Compile / doc / sources).value
},
assembly / test := {},
Test / parallelExecution := false
Test / parallelExecution := false,
tlJdkRelease := Some(8)
) ++ Seq(
addCommandAlias(
"cpl",
Expand Down
19 changes: 12 additions & 7 deletions shared/src/main/scala/kinesis4cats/syntax/bytebuffer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ trait ByteBufferSyntax {
object ByteBufferSyntax {
final class ByteBufferOps(private val buffer: ByteBuffer) extends AnyVal {

/** Safely copies the contents of a [[java.nio.ByteBuffer]] to a byte array.
* Will ensure that the ByteBuffer's current state remains intact.
/** Safely copies the contents of a
* [[https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html ByteBuffer]]
* to a byte array. Will ensure that the ByteBuffer's current state remains
* intact.
*
* @return
* Byte array with the contents of the ByteBuffer
Expand All @@ -46,17 +48,20 @@ object ByteBufferSyntax {
arr
}

/** Safely copies the content of a [[java.nio.ByteBuffer]] into a string.
* Will ensure that the ByteBuffer's current state remains intact.
/** Safely copies the content of a
* [[https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html ByteBuffer]]
* into a string. Will ensure that the ByteBuffer's current state remains
* intact.
*
* @return
* String with the contents of the ByteBuffer
*/
def asString: String = new String(asArray)

/** Safely copies the content of a [[java.nio.ByteBuffer]] into a Base64.
* encoded string. Will ensure that the ByteBuffer's current state remains
* intact.
/** Safely copies the content of a
* [[[https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html ByteBuffer]]
* into a Base64. encoded string. Will ensure that the ByteBuffer's current
* state remains intact.
*
* @return
* Base64 string with the contents of the ByteBuffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import scala.jdk.CollectionConverters._

import java.nio.ByteBuffer
import java.time.Instant
import java.util.Arrays
import java.util.Collections

import cats.syntax.all._
import com.amazonaws.kinesis.agg.AggRecord
Expand Down Expand Up @@ -138,7 +140,7 @@ class AggregatedBatchSpec extends munit.CatsEffectSuite {
.build()

val res = new AggregatorUtil()
.deaggregate(java.util.List.of[KinesisClientRecord](kclRecord))
.deaggregate(Collections.unmodifiableList(Arrays.asList(kclRecord)))
.asScala
.toList

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import java.util.ArrayList
import java.util.Collections
import java.util.function
import java.util.function.BiFunction
import java.util.stream.Collectors

import software.amazon.smithy.build._
import software.amazon.smithy.model.Model
Expand Down Expand Up @@ -106,7 +107,7 @@ final class KinesisSpecTransformer extends ProjectionTransformer {
.build()
else member
}
.toList()
.collect(Collectors.toList())

shape
.asStructureShape()
Expand All @@ -121,7 +122,9 @@ final class KinesisSpecTransformer extends ProjectionTransformer {

val withMappedTraits =
transformer.mapTraits(context.getModel(), traitTransform)
val newShapesAl = new ArrayList[Shape](withMappedTraits.shapes().toList())
val newShapesAl = new ArrayList[Shape](
withMappedTraits.shapes().collect(Collectors.toList())
)
newShapesAl.add(nonNegativeIntegerObjectShape)

val newShapes = Collections.unmodifiableList(newShapesAl)
Expand Down

0 comments on commit 8526691

Please sign in to comment.