diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ea7678..3ed4636 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - java: ['8', '17'] + java: ['11', '17'] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 26c4d43..5ee4496 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: '17' + java-version: '11' - run: ./mill io.kipp.mill.ci.release.ReleaseModule/publishAll env: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} diff --git a/.scalafix3.conf b/.scalafix3.conf new file mode 100644 index 0000000..46931ae --- /dev/null +++ b/.scalafix3.conf @@ -0,0 +1,18 @@ +rules = [ + DisableSyntax, + OrganizeImports, + NoValInForComprehension, +] + +OrganizeImports { + removeUnused = false + expandRelative = true + groupedImports = Explode + groups = [ + "re:javax?\\." + "scala." + "ch.epfl" + "bloop" + "*" + ] +} diff --git a/build.sc b/build.sc index 4c4c1a3..a2dc7c5 100644 --- a/build.sc +++ b/build.sc @@ -1,3 +1,4 @@ +import os.Path import $ivy.`com.github.lolgab::mill-mima::0.1.1` import $ivy.`com.github.lolgab::mill-crossplatform::0.2.4` import $ivy.`com.goyeau::mill-scalafix::0.4.0` @@ -17,17 +18,16 @@ import io.kipp.mill.ci.release.CiReleaseModule val scala212 = "2.12.19" val scala213 = "2.13.14" +val scala3 = "3.3.4" -val scalaJS1 = "1.16.0" +val scalaJS1 = "1.17.0" -val scalaVersions = List(scala212, scala213) +val scalaVersions = List(scala212, scala213, scala3) trait CommonPublish extends CiReleaseModule with Mima { override def artifactName = "bloop-config" - override def mimaPreviousVersions = Seq("2.0.2") - override def pomSettings = PomSettings( description = "Bloop configuration library.", organization = "ch.epfl.scala", @@ -47,9 +47,14 @@ trait CommonPublish extends CiReleaseModule with Mima { trait Common extends CrossScalaModule with ScalafmtModule with ScalafixModule { - val jsoniterVersion = "2.4.0" + val jsoniterVersion = "2.30.14" val unrollVersion = "0.1.12" + override def scalafixConfig: T[Option[Path]] = T { + if (scalaVersion() == scala3) Some(os.pwd / ".scalafix3.conf") + else Some(os.pwd / ".scalafix.conf") + } + override def ivyDeps = Agg( ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-core::$jsoniterVersion", ivy"com.lihaoyi::unroll-annotation:$unrollVersion" @@ -72,11 +77,26 @@ trait CommonTest extends ScalaModule with TestModule.Munit { } object config extends Cross[ConfigModule](scalaVersions) + trait ConfigModule extends CrossPlatform { trait Shared extends CrossPlatformCrossScalaModule with Common - with CommonPublish + with CommonPublish { + + // note: somehow, this doesn't work (causes "Please override mimaPreviousVersions or mimaPreviousArtifacts") + // override def mimaPreviousVersions: Target[Seq[String]] = + // T { + // if (scalaVersion() == scala3) Seq.empty[String] else Seq("2.0.2") + // } + // so we have to override mimaPreviousArtifacts fully: + // at least until the Scala 3 release is published. + + override def mimaPreviousArtifacts: Target[Agg[Dep]] = T { + if (scalaVersion() == scala3) Agg.empty[Dep] + else Agg(ivy"ch.epfl.scala::bloop-config::2.0.2") + } + } object jvm extends Shared { object test extends CrossPlatformSources with ScalaTests with CommonTest diff --git a/config/src-2/bloop/config/SourceGeneratorCompanionPlatform.scala b/config/src-2/bloop/config/SourceGeneratorCompanionPlatform.scala new file mode 100644 index 0000000..8f6fb21 --- /dev/null +++ b/config/src-2/bloop/config/SourceGeneratorCompanionPlatform.scala @@ -0,0 +1,12 @@ +package bloop.config + +import scala.runtime.AbstractFunction3 + +// needed for binary compat with 2.0.2 +trait SourceGeneratorCompanionPlatform + extends AbstractFunction3[ + List[Config.SourcesGlobs], + PlatformFiles.Path, + List[String], + Config.SourceGenerator + ] {} diff --git a/config/src-3/bloop/config/SourceGeneratorCompanionPlatform.scala b/config/src-3/bloop/config/SourceGeneratorCompanionPlatform.scala new file mode 100644 index 0000000..25b8378 --- /dev/null +++ b/config/src-3/bloop/config/SourceGeneratorCompanionPlatform.scala @@ -0,0 +1,3 @@ +package bloop.config + +trait SourceGeneratorCompanionPlatform {} diff --git a/config/src/bloop/config/Config.scala b/config/src/bloop/config/Config.scala index 5d90c08..eff3a15 100644 --- a/config/src/bloop/config/Config.scala +++ b/config/src/bloop/config/Config.scala @@ -1,7 +1,6 @@ package bloop.config import scala.annotation.unroll -import scala.runtime.AbstractFunction3 import bloop.config.PlatformFiles.Path import bloop.config.PlatformFiles.emptyPath @@ -284,14 +283,7 @@ object Config { @unroll unmanagedInputs: List[Path] = Nil ) - object SourceGenerator - // needed for binary compat with 2.0.2 - extends AbstractFunction3[ - List[SourcesGlobs], - Path, - List[String], - SourceGenerator - ] + object SourceGenerator extends SourceGeneratorCompanionPlatform case class Project( name: String, @@ -364,7 +356,7 @@ object Config { val platformJS = { Platform.Js( JsConfig( - "1.16.0", + "1.17.0", LinkerMode.Release, ModuleKindJS.ESModule, false,