From 46c8445afeb004961fc1a4a5201eec6211d09cda Mon Sep 17 00:00:00 2001 From: Barry O'Neill Date: Fri, 15 Nov 2024 14:00:09 -0500 Subject: [PATCH 1/3] use the laserdisc plugin --- .gitignore | 41 +++++++++++++++++-- .scalafmt.conf | 17 +++++++- build.sbt | 82 +++----------------------------------- project/Dependencies.scala | 40 +++++++------------ project/build.properties | 14 ++++++- project/plugins.sbt | 8 ++-- 6 files changed, 90 insertions(+), 112 deletions(-) diff --git a/.gitignore b/.gitignore index 143feda..373499d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,42 @@ -.terraform/ +# ------------------ autogenerated file - do not edit ------------------- +# This file was generated by sbt-laserdisc-defaults +# +# Please check in any changes generated in this file (for IDE support) +# +# To make changes, please publish a new version of the plugin at: +# https://github.com/laserdisc-io/sbt-laserdisc-defaults +# +# To temporarily disable generation, set this at the top of build.sbt: +# ThisBuild / laserdiscGitIgnoreGenOn := false +# ----------------------------------------------------------------------- + +# tip: use a "global" gitignore (core.excludesfile) for your own, local, personal preferences +# See: https://gist.github.com/subfuzion/db7f57fff2fb6998a16c + +# scala / sbt / java +project/project/ +project/target/ target/ +.sbtopts +.tasty + +# intellij .idea/ -.idea/* *.iml + +# metals / bsp +.metals/ .bloop/ .bsp/ -.jvmopts -.DS_Store +project/metals.sbt + +# vscode +.vscode/ + +# terraform +.terraform/ +*.tfplan +*.terraform.lock.hcl + +# mac +.DS_Store \ No newline at end of file diff --git a/.scalafmt.conf b/.scalafmt.conf index 8d8e3c6..34ae598 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,12 +1,25 @@ +# ------------------ autogenerated file - do not edit ------------------- +# This file was generated by sbt-laserdisc-defaults +# +# Please check in any changes generated in this file (for IDE support) +# +# To make changes, please publish a new version of the plugin at: +# https://github.com/laserdisc-io/sbt-laserdisc-defaults +# +# To temporarily disable generation, set this at the top of build.sbt: +# ThisBuild / laserdiscScalaFmtGenOn := false +# ----------------------------------------------------------------------- + version=3.8.3 maxColumn = 140 style = default align.preset = more -runner.dialect = scala213source3 +project.layout = StandardConvention +runner.dialect = scala3 fileOverride { - "glob:**/scala-3/**" { runner.dialect = scala3 } + "lang:scala-2" = scala213source3 } danglingParentheses.preset = true diff --git a/build.sbt b/build.sbt index 4a133db..c478b18 100644 --- a/build.sbt +++ b/build.sbt @@ -1,79 +1,12 @@ -lazy val scala213 = "2.13.15" -lazy val scala3 = "3.3.4" -lazy val supportedScalaVersions = List(scala213, scala3) -ThisBuild / crossScalaVersions := supportedScalaVersions -ThisBuild / scalaVersion := scala213 +import laserdisc.sbt.LaserDiscDevelopers.Barry -lazy val publishSettings = Seq( - Test / publishArtifact := false, - pomIncludeRepository := (_ => false), - organization := "io.laserdisc", - homepage := Some(url("http://laserdisc.io/slack4s")), - developers := List( - Developer("barryoneill", "Barry O'Neill", "", url("https://github.com/barryoneill")) - ), - scmInfo := Some( - ScmInfo( - url("https://github.com/laserdisc-io/slack4s/tree/master"), - "scm:git:git@github.com:laserdisc-io/slack4s.git" - ) - ), - licenses := Seq( - "MIT" -> url("https://raw.githubusercontent.com/laserdisc-io/slack4s/master/LICENSE") - ) -) +ThisBuild / laserdiscRepoName := "slack4s" lazy val root = project .in(file(".")) .settings( - name := "slack4s", - publishSettings, - Seq( - libraryDependencies ++= Seq( - compilerPlugin(("org.typelevel" %% "kind-projector" % "0.13.3").cross(CrossVersion.full)), - compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1") - ).filterNot(_ => scalaVersion.value.startsWith("3.")), - scalacOptions ++= Seq( - "-deprecation", - "-encoding", - "UTF-8", - "-feature", - "-language:existentials,experimental.macros,higherKinds,implicitConversions,postfixOps", - "-unchecked", - "-Xfatal-warnings" - ), - scalacOptions ++= { - CrossVersion.partialVersion(scalaVersion.value) match { - case Some((2, minor)) if minor >= 13 => - Seq( - "-Xlint:-unused,_", - "-Ywarn-numeric-widen", - "-Ywarn-value-discard", - "-Ywarn-unused:implicits", - "-Ywarn-unused:imports", - "-Xsource:3", - "-Xlint:-byname-implicit", - "-P:kind-projector:underscore-placeholders", - "-Xlint", - "-Ywarn-macros:after" - ) - case _ => Seq.empty - } - }, - scalacOptions ++= { - CrossVersion.partialVersion(scalaVersion.value) match { - case Some((3, _)) => - Seq( - "-Ykind-projector:underscores", - "-source:future", - "-language:adhocExtensions", - "-Wconf:msg=`= _` has been deprecated; use `= uninitialized` instead.:s" - ) - case _ => Seq.empty - } - } - ), - Test / fork := true, + name := "slack4s", + developers := List(Barry), // ------------------------- deps ------------------------- excludeDependencies += "commons-logging", Dependencies.TestLib, @@ -85,9 +18,6 @@ lazy val root = project Dependencies.Slack, // ------------------ version fmt + buildinfo ------------------ buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion), - buildInfoPackage := "slack4s", - addCommandAlias("format", ";scalafmtAll;scalafmtSbt"), - addCommandAlias("checkFormat", ";scalafmtCheckAll;scalafmtSbtCheck"), - addCommandAlias("fullTest", ";clean;checkFormat;test") + buildInfoPackage := "slack4s" ) - .enablePlugins(BuildInfoPlugin, GitVersioning) + .enablePlugins(BuildInfoPlugin, LaserDiscDefaultsPlugin) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index c0cb060..b61e38b 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -8,48 +8,38 @@ object Dependencies { testFrameworks += new TestFramework("munit.Framework"), libraryDependencies ++= Seq( "org.scalameta" %% "munit" % "1.0.2", - "org.mockito" % "mockito-core" % "5.14.1", + "org.mockito" % "mockito-core" % "5.14.2", "org.gnieh" %% "diffson-circe" % "4.6.0" ).map(_ % Test) ) - val Slack = Seq( - libraryDependencies += "com.slack.api" % "slack-app-backend" % "1.43.1" - ) + val Slack = libraryDependencies += "com.slack.api" % "slack-app-backend" % "1.44.1" - val Refined = Seq( - libraryDependencies += "eu.timepit" %% "refined" % "0.11.2" - ) + val Refined = libraryDependencies += "eu.timepit" %% "refined" % "0.11.2" - val NewTypes = Seq( - libraryDependencies += "io.monix" %% "newtypes-core" % "0.3.0" - ) + val NewTypes = libraryDependencies += "io.monix" %% "newtypes-core" % "0.3.0" val Logging = Seq( libraryDependencies ++= Seq( "org.typelevel" %% "log4cats-slf4j" % "2.7.0", - "ch.qos.logback" % "logback-classic" % "1.5.9" % Test, - "ch.qos.logback" % "logback-core" % "1.5.9" % Test, + "ch.qos.logback" % "logback-classic" % "1.5.12" % Test, + "ch.qos.logback" % "logback-core" % "1.5.12" % Test, "org.slf4j" % "jcl-over-slf4j" % "2.0.16" % Test, "org.slf4j" % "jul-to-slf4j" % "2.0.16" % Test ) ) - val Http4s = Seq( - libraryDependencies ++= Seq( - "org.http4s" %% "http4s-dsl", - "org.http4s" %% "http4s-ember-server", - "org.http4s" %% "http4s-ember-client", - "org.http4s" %% "http4s-circe" - ).map(_ % "0.23.28") - ) + val Http4s = libraryDependencies ++= Seq( + "http4s-dsl", + "http4s-ember-server", + "http4s-ember-client", + "http4s-circe" + ).map("org.http4s" %% _ % "0.23.29") val CirceVersion = "0.14.10" - val Circe = Seq( - libraryDependencies ++= Seq( - "io.circe" %% "circe-core" % CirceVersion, - "io.circe" %% "circe-parser" % CirceVersion - ) + val Circe = libraryDependencies ++= Seq( + "io.circe" %% "circe-core" % CirceVersion, + "io.circe" %% "circe-parser" % CirceVersion ) } diff --git a/project/build.properties b/project/build.properties index 0b699c3..8bfed43 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1,13 @@ -sbt.version=1.10.2 +# ------------------ autogenerated file - do not edit ------------------- +# This file was generated by sbt-laserdisc-defaults +# +# Please check in any changes generated in this file (for IDE support) +# +# To make changes, please publish a new version of the plugin at: +# https://github.com/laserdisc-io/sbt-laserdisc-defaults +# +# To temporarily disable generation, set this at the top of build.sbt: +# ThisBuild / laserdiscSBTVersionGenOn := false +# ----------------------------------------------------------------------- + +sbt.version = 1.10.5 \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index bf81168..eeb48d6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11") -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.7.0") +addSbtPlugin("io.laserdisc" % "sbt-laserdisc-defaults" % "0.1.1") +addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.12") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0") From 467dee162da4f781eff1ee06fc20972d21e9738c Mon Sep 17 00:00:00 2001 From: Barry O'Neill Date: Fri, 15 Nov 2024 14:06:14 -0500 Subject: [PATCH 2/3] cross compile --- build.sbt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index c478b18..7aff820 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,8 @@ +import laserdisc.sbt.CompileTarget.Scala2And3 import laserdisc.sbt.LaserDiscDevelopers.Barry -ThisBuild / laserdiscRepoName := "slack4s" +ThisBuild / laserdiscRepoName := "slack4s" +ThisBuild / laserdiscCompileTarget := Scala2And3 lazy val root = project .in(file(".")) From ce3d472eccc47dcaffd559a39aec244c52c47098 Mon Sep 17 00:00:00 2001 From: Barry O'Neill Date: Fri, 15 Nov 2024 14:42:41 -0500 Subject: [PATCH 3/3] fix up workflows --- .github/workflows/ci.yaml | 13 ++++++------- .github/workflows/release.yml | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index faed62c..52baa55 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,25 +12,24 @@ jobs: strategy: matrix: scala: - - 2.13.11 - - 3.3.0 + - 2.13.15 + - 3.3.4 java: - - corretto@1.11 - corretto@1.17 os: - ubuntu-22.04 runs-on: ${{ matrix.os }} steps: - name: Branch Checkout - uses: actions/checkout@v2.5.0 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Java And Sbt - uses: olafurpg/setup-scala@v13 + uses: olafurpg/setup-scala@v14 with: java-version: ${{ matrix.java }} - name: Cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | $HOME/.cache/coursier @@ -42,7 +41,7 @@ jobs: project/target key: ${{ runner.os }}-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Test (${{ matrix.scala }}, ${{ matrix.java }}) - run: sbt ++${{ matrix.scala }} fullTest + run: sbt ++${{ matrix.scala }} build - name: Upload To Codecov uses: codecov/codecov-action@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c064bc..6b57417 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,12 +5,12 @@ on: tags: ["*"] jobs: publish: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: olafurpg/setup-scala@v10 + - uses: olafurpg/setup-scala@v14 - run: sbt ci-release env: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}