diff --git a/modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala index 2e517170d1..fbea45005c 100644 --- a/modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala +++ b/modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala @@ -110,25 +110,19 @@ final class MillAlg[F[_]](defaultResolver: Resolver)(implicit } object MillAlg { - private[mill] def millMinVersion(millVersion: Option[Version]): Option[String] = - millVersion.flatMap(_.value.trim.split("[.]", 3).take(2).lastOption) - private[mill] val cliPluginCoordinate: String = s"ivy:${org.scalasteward.core.BuildInfo.organization}::${org.scalasteward.core.BuildInfo.millPluginArtifactName}::${org.scalasteward.core.BuildInfo.millPluginVersion}" - private[mill] def content(millVersion: Option[Version]) = { - def rawContent(millBinPlatform: String) = - s"""|import $$ivy.`${org.scalasteward.core.BuildInfo.organization}::${org.scalasteward.core.BuildInfo.millPluginArtifactName}_mill${millBinPlatform}:${org.scalasteward.core.BuildInfo.millPluginVersion}` - |""".stripMargin - - millMinVersion(millVersion) match { - case None => rawContent("$MILL_BIN_PLATFORM") - // We support these platforms, but we can't take the $MILL_BIN_PLATFORM support for granted - case Some("6") => rawContent("0.6") - case Some("7") | Some("8") => rawContent("0.7") - case Some("9") => rawContent("0.9") - case _ => rawContent("$MILL_BIN_PLATFORM") + private[mill] def content(millVersion: Option[Version]): String = { + // We support these platforms, but we can't take the $MILL_BIN_PLATFORM support for granted + val millBinPlatform = millVersion match { + case Some(v) if v >= Version("0.10") => "$MILL_BIN_PLATFORM" + case Some(v) if v >= Version("0.9") => "0.9" + case Some(v) if v >= Version("0.7") => "0.7" + case Some(v) if v >= Version("0.6") => "0.6" + case _ => "$MILL_BIN_PLATFORM" } + s"""import $$ivy.`${org.scalasteward.core.BuildInfo.organization}::${org.scalasteward.core.BuildInfo.millPluginArtifactName}_mill${millBinPlatform}:${org.scalasteward.core.BuildInfo.millPluginVersion}`""" } val extractDeps: String = "org.scalasteward.mill.plugin.StewardPlugin/extractDeps" diff --git a/modules/core/src/test/scala/org/scalasteward/core/buildtool/mill/MillAlgTest.scala b/modules/core/src/test/scala/org/scalasteward/core/buildtool/mill/MillAlgTest.scala index 96a8b9edba..1a1b9bbbfa 100644 --- a/modules/core/src/test/scala/org/scalasteward/core/buildtool/mill/MillAlgTest.scala +++ b/modules/core/src/test/scala/org/scalasteward/core/buildtool/mill/MillAlgTest.scala @@ -100,14 +100,4 @@ class MillAlgTest extends FunSuite { assert(MillAlg.content(Some(Version("0.9.14"))).contains("_mill0.9")) assert(MillAlg.content(Some(Version("0.10.0"))).contains("_mill$MILL_BIN_PLATFORM")) } - - test("mill version") { - assert(MillAlg.millMinVersion(None).isEmpty) - assert(MillAlg.millMinVersion(Some(Version("0.6.1"))).contains("6")) - assert(MillAlg.millMinVersion(Some(Version("0.7.0"))).contains("7")) - assert(MillAlg.millMinVersion(Some(Version("0.8.0"))).contains("8")) - assert(MillAlg.millMinVersion(Some(Version("0.9.14"))).contains("9")) - assert(MillAlg.millMinVersion(Some(Version("0.10.0"))).contains("10")) - assert(MillAlg.millMinVersion(Some(Version("0.11.0"))).contains("11")) - } }