diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fbe3931..11749dbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: github.event.pull_request.user.login == 'softwaremill-ci' strategy: matrix: - java: [ '11', '17', '21' ] + java: [ '17', '21' ] fail-fast: false with: java-version: ${{ matrix.java }} diff --git a/.scalafmt.conf b/.scalafmt.conf index 4dffb6f5..0d989cc2 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -5,4 +5,7 @@ fileOverride { "glob:**/scala-3/**" { runner.dialect = scala3 } -} \ No newline at end of file + "glob:**.sbt" { + runner.dialect = scala3 + } +} diff --git a/build.sbt b/build.sbt index abcb38c0..846b5e94 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ import com.softwaremill.UpdateVersionInDocs import sbt._ import sbt.Keys._ -excludeLintKeys in Global ++= Set(ideSkipProject) +Global / excludeLintKeys ++= Set(ideSkipProject) val scala2_12 = "2.12.21" val scala2_13 = "2.13.18" @@ -49,63 +49,51 @@ val versionSpecificScalaSources = { } } -val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq( - organization := "com.softwaremill.macwire", - ideSkipProject := (scalaVersion.value != ideScalaVersion) || thisProjectRef.value.project.contains("JS"), - bspEnabled := !ideSkipProject.value, - scalacOptions ~= (_.filterNot(Set("-Wconf:cat=other-match-analysis:error"))) // doesn't play well with macros -) +commonSmlBuildSettings +ossPublishSettings + +organization := "com.softwaremill.macwire" +ideSkipProject := (scalaVersion.value != ideScalaVersion) || thisProjectRef.value.project.contains("JS") +bspEnabled := !ideSkipProject.value +scalacOptions ~= (_.filterNot(Set("-Wconf:cat=other-match-analysis:error"))) // doesn't play well with macros -val testSettings = commonSettings ++ Seq( +val testSettings = Seq( publishArtifact := false, scalacOptions ++= Seq("-Ywarn-dead-code"), // Otherwise when running tests in sbt, the macro is not visible // (both macro and usages are compiled in the same compiler run) - Test / fork := true + Test / fork := true, + exportJars := false, + // in sbt 2 forked tests are run by a worker, so java.class.path doesn't contain the test classpath needed by the Scala 3 compile tests + Test / javaOptions += { + val converter = fileConverter.value + val classpath = (Test / fullClasspath).value.map(a => converter.toPath(a.data).toString) + s"-Dmacwire.test.classpath=${classpath.mkString(java.io.File.pathSeparator)}" + } ) -val tagging = "com.softwaremill.common" %% "tagging" % "2.3.5" +val tagging = ("com.softwaremill.common" %% "tagging" % "2.3.5").platform(Platform.jvm) val scalatest = "org.scalatest" %% "scalatest" % "3.2.20" val javassist = "org.javassist" % "javassist" % "3.33.0-GA" -val akkaActor = "com.typesafe.akka" %% "akka-actor" % "2.6.21" -val pekkoActor = "org.apache.pekko" %% "pekko-actor" % "1.7.0" +val akkaActor = ("com.typesafe.akka" %% "akka-actor" % "2.6.21").platform(Platform.jvm) +val pekkoActor = ("org.apache.pekko" %% "pekko-actor" % "1.7.0").platform(Platform.jvm) val javaxInject = "javax.inject" % "javax.inject" % "1" -val cats = "org.typelevel" %% "cats-core" % "2.13.0" -val catsEffect = "org.typelevel" %% "cats-effect" % "3.7.1" +val cats = ("org.typelevel" %% "cats-core" % "2.13.0").platform(Platform.jvm) +val catsEffect = ("org.typelevel" %% "cats-effect" % "3.7.1").platform(Platform.jvm) -lazy val root = project - .in(file(".")) - .settings(commonSettings) +lazy val root = rootProject .settings(name := "macwire", publishArtifact := false) - .aggregate( - List( - util, - macros, - proxy, - tests, - tests2, - testUtil, - utilTests, - macrosAkka, - macrosPekko, - macrosAkkaTests, - macrosPekkoTests, - macrosAutoCats, - macrosAutoCatsTests - ).flatMap(_.projectRefs): _* - ) + .autoAggregate lazy val util = projectMatrix .in(file("util")) .settings(libraryDependencies += tagging) - .settings(commonSettings) .jvmPlatform(scalaVersions = scala2And3Versions) .jsPlatform(scalaVersions = scala2And3Versions) .nativePlatform(scalaVersions = scala2And3Versions) lazy val macros = projectMatrix .in(file("macros")) - .settings(commonSettings) .settings( libraryDependencies ++= reflectLibrary(scalaVersion.value), versionSpecificScalaSources @@ -117,7 +105,6 @@ lazy val macros = projectMatrix lazy val proxy = projectMatrix .in(file("proxy")) - .settings(commonSettings) .settings( libraryDependencies ++= Seq(javassist, scalatest % Test), compileOrder := CompileOrder.JavaThenScala, @@ -162,7 +149,6 @@ lazy val tests2 = projectMatrix lazy val macrosAkka = projectMatrix .in(file("macrosAkka")) - .settings(commonSettings) .settings(libraryDependencies ++= Seq(akkaActor % "provided")) .dependsOn(macros) .jvmPlatform(scalaVersions = scala2) @@ -170,7 +156,6 @@ lazy val macrosAkka = projectMatrix lazy val macrosPekko = projectMatrix .in(file("macrosPekko")) - .settings(commonSettings) .settings(libraryDependencies ++= Seq(pekkoActor % "provided")) .dependsOn(macros) .jvmPlatform(scalaVersions = scala2) @@ -204,7 +189,6 @@ lazy val macrosPekkoTests = projectMatrix lazy val macrosAutoCats = projectMatrix .in(file("macrosAutoCats")) - .settings(commonSettings) .settings(libraryDependencies ++= Seq(catsEffect, cats)) .dependsOn(macros) .jvmPlatform(scalaVersions = scala2) diff --git a/project/build.properties b/project/build.properties index e0a1aa02..ddca111e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.13.0 +sbt.version=2.0.9 diff --git a/project/plugins.sbt b/project/plugins.sbt index f5229c8a..4f0ae563 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,4 @@ -addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.11.0") - -val sbtSoftwareMillVersion = "2.1.2" +val sbtSoftwareMillVersion = "3.0.1" addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion) addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion) diff --git a/test-util/src/main/scala-3/com/softwaremill/macwire/Properties.scala b/test-util/src/main/scala-3/com/softwaremill/macwire/Properties.scala index e1bf3d55..5dd10871 100644 --- a/test-util/src/main/scala-3/com/softwaremill/macwire/Properties.scala +++ b/test-util/src/main/scala-3/com/softwaremill/macwire/Properties.scala @@ -3,5 +3,5 @@ package com.softwaremill.macwire import java.io.File object Properties { - def currentClasspath = sys.props("java.class.path") + def currentClasspath = sys.props.getOrElse("macwire.test.classpath", sys.props("java.class.path")) }