From 2e2f1fe17832c348f2cc5d38e691fbd1e7012898 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 29 Mar 2023 16:16:43 +0200 Subject: [PATCH 1/2] don't pass unsupported options to Scala 3 compiler --- build.sbt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ad9c9bd5..ea56dcc6 100644 --- a/build.sbt +++ b/build.sbt @@ -12,11 +12,17 @@ inThisBuild(Seq( scmInfo := Some(ScmInfo(url("https://github.com/lightbend/mima"), "scm:git:git@github.com:lightbend/mima.git")), dynverVTagPrefix := false, scalaVersion := scala212, - scalacOptions ++= Seq("-feature", "-Xsource:3", "-Xlint", "-Wconf:cat=deprecation&msg=Stream|JavaConverters:s"), resolvers ++= (if (isStaging) List(stagingResolver) else Nil), publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeOssSnapshots.head else Opts.resolver.sonatypeStaging), )) +def compilerOptions(scalaVersion: String): Seq[String] = + Seq("-feature", "-Wconf:cat=deprecation&msg=Stream|JavaConverters:s") ++ + (CrossVersion.partialVersion(scalaVersion) match { + case Some((2, _)) => Seq("-Xsource:3", "-Xlint") + case _ => Seq() + }) + // Useful to self-test releases val stagingResolver = "Sonatype OSS Staging" at "https://oss.sonatype.org/content/repositories/staging" def isStaging = sys.props.contains("mimabuild.staging") @@ -44,6 +50,7 @@ val munit = Def.setting("org.scalameta" %%% "munit" % "1.0.0-M7") val core = crossProject(JVMPlatform, NativePlatform).crossType(CrossType.Pure).settings( name := "mima-core", crossScalaVersions ++= Seq(scala213, scala3), + scalacOptions ++= compilerOptions(scalaVersion.value), libraryDependencies += munit.value % Test, testFrameworks += new TestFramework("munit.Framework"), MimaSettings.mimaSettings, @@ -62,6 +69,7 @@ val core = crossProject(JVMPlatform, NativePlatform).crossType(CrossType.Pure).s val sbtplugin = project.enablePlugins(SbtPlugin).dependsOn(core.jvm).settings( name := "sbt-mima-plugin", + scalacOptions ++= compilerOptions(scalaVersion.value), // drop the previous value to drop running Test/compile scriptedDependencies := Def.task(()).dependsOn(publishLocal, core.jvm / publishLocal).value, scriptedLaunchOpts += s"-Dplugin.version=${version.value}", @@ -79,6 +87,7 @@ val functionalTests = Project("functional-tests", file("functional-tests")) libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value, libraryDependencies += munit.value, testFrameworks += new TestFramework("munit.Framework"), + scalacOptions ++= compilerOptions(scalaVersion.value), //Test / run / fork := true, //Test / run / forkOptions := (Test / run / forkOptions).value.withWorkingDirectory((ThisBuild / baseDirectory).value), // Test / testOnly / watchTriggers += baseDirectory.value.toGlob / "src" / "test" / **, From 220350594a391bdfa1083d9b0e644ad35bd8884a Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 29 Mar 2023 16:17:32 +0200 Subject: [PATCH 2/2] set versionScheme --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index ea56dcc6..d597931d 100644 --- a/build.sbt +++ b/build.sbt @@ -11,6 +11,7 @@ inThisBuild(Seq( ), scmInfo := Some(ScmInfo(url("https://github.com/lightbend/mima"), "scm:git:git@github.com:lightbend/mima.git")), dynverVTagPrefix := false, + versionScheme := Some("early-semver"), scalaVersion := scala212, resolvers ++= (if (isStaging) List(stagingResolver) else Nil), publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeOssSnapshots.head else Opts.resolver.sonatypeStaging),