diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2025b5aa..b9d9159f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,13 +27,11 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [3.1.0, 2.12.15, 2.13.7] + scala: [3.1.0, 2.13.7] java: [corretto@8, corretto@11] exclude: - scala: 3.1.0 java: corretto@11 - - scala: 2.12.15 - java: corretto@11 runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -120,16 +118,6 @@ jobs: tar xf targets.tar rm targets.tar - - name: Download target directories (2.12.15) - uses: actions/download-artifact@v2 - with: - name: target-${{ matrix.os }}-2.12.15-${{ matrix.java }} - - - name: Inflate target directories (2.12.15) - run: | - tar xf targets.tar - rm targets.tar - - name: Download target directories (2.13.7) uses: actions/download-artifact@v2 with: diff --git a/.scalafmt.conf b/.scalafmt.conf index 83a0ba60..ca81bcc6 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,6 +1,14 @@ version = 3.2.1 runner.dialect = Scala213Source3 +fileOverride { + "glob:**/scala-3/**/*.scala" { + runner.dialect = scala3 + } + "glob:**/scala-2.13/**/*.scala" { + runner.dialect = scala213 + } +} maxColumn = 96 diff --git a/build.sbt b/build.sbt index 826b09e9..4d69ff2b 100644 --- a/build.sbt +++ b/build.sbt @@ -21,7 +21,7 @@ ThisBuild / baseVersion := "0.1" ThisBuild / organization := "org.typelevel" ThisBuild / organizationName := "Typelevel" -ThisBuild / crossScalaVersions := Seq("3.1.0", "2.12.15", "2.13.7") +ThisBuild / crossScalaVersions := Seq("3.1.0", "2.13.7") ThisBuild / developers := List( Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")), diff --git a/lambda-cloudformation-custom-resource/src/main/scala/feral/lambda/cloudformation/CloudFormationCustomResource.scala b/lambda-cloudformation-custom-resource/src/main/scala/feral/lambda/cloudformation/CloudFormationCustomResource.scala index 6febdfba..f6fc9c82 100644 --- a/lambda-cloudformation-custom-resource/src/main/scala/feral/lambda/cloudformation/CloudFormationCustomResource.scala +++ b/lambda-cloudformation-custom-resource/src/main/scala/feral/lambda/cloudformation/CloudFormationCustomResource.scala @@ -46,7 +46,7 @@ object CloudFormationCustomResource { client: Client[F], handler: CloudFormationCustomResource[F, Input, Output])( implicit - env: LambdaEnv[F, CloudFormationCustomResourceRequest[Input]]): F[Option[Unit]] = { + env: LambdaEnv[F, CloudFormationCustomResourceRequest[Input]]): F[Option[INothing]] = { val http4sClientDsl = new Http4sClientDsl[F] {} import http4sClientDsl._ diff --git a/lambda/shared/src/main/scala-2/feral/lambda/package.scala b/lambda/shared/src/main/scala-2/feral/lambda/package.scala new file mode 100644 index 00000000..e0ba7471 --- /dev/null +++ b/lambda/shared/src/main/scala-2/feral/lambda/package.scala @@ -0,0 +1,38 @@ +/* + * Copyright 2021 Typelevel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package feral + +import io.circe.Encoder + +import scala.annotation.nowarn + +package object lambda { + /** + * Alias for `Nothing` which works better with type inference. Inspired by fs2, but inlined + * here to avoid pulling in an otherwise-unnecessary dependency. + */ + type INothing <: Nothing + + /** + * This can't actually be used. It's here because `IOLambda` demands an Encoder for its result + * type, which should be `Nothing` when no output is desired. Userland code will return an + * `Option[Nothing]` which is only inhabited by `None`, and the encoder is only used when the + * userland code returns `Some`. + */ + @nowarn("msg=dead code following this construct") + implicit val nothingEncoder: Encoder[INothing] = (_: INothing) => ??? +} diff --git a/lambda/shared/src/main/scala-3/feral/lambda/INothing.scala b/lambda/shared/src/main/scala-3/feral/lambda/INothing.scala new file mode 100644 index 00000000..fbca9608 --- /dev/null +++ b/lambda/shared/src/main/scala-3/feral/lambda/INothing.scala @@ -0,0 +1,38 @@ +/* + * Copyright 2021 Typelevel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package feral.lambda + +import io.circe.Encoder + +import scala.annotation.nowarn + +/** + * Alias for `Nothing` which works better with type inference. Inspired by fs2, but inlined here + * to avoid pulling in an otherwise-unnecessary dependency. + */ +type INothing <: Nothing +object INothing { + + /** + * This can't actually be used. It's here because `IOLambda` demands an Encoder for its result + * type, which should be `Nothing` when no output is desired. Userland code will return an + * `Option[Nothing]` which is only inhabited by `None`, and the encoder is only used when the + * userland code returns `Some`. + */ + @nowarn("msg=dead code following this construct") + implicit val nothingEncoder: Encoder[INothing] = (_: INothing) => ??? +}