def parseMillVersion()

in modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/parser.scala [46:76]


  def parseMillVersion(s: String): Option[Version] =
    Option(s.trim).filter(_.nonEmpty).map(Version.apply)

  /** Used to correctly format the Mill plugin artifacts will when included look like:
    *   - import $ivy.`com.goyeau::mill-scalafix::0.2.10`
    *
    * However for the actual artifact if the user is on 0.10.x will look like:
    *   - mill-scalafix_mill0.10_.2.13
    *
    * @param artifactName
    *   name of the artifact parsed from the build file
    * @param millVersion
    *   the current Mill version being used
    * @return
    *   the newly put together ArtifactId
    */
  private def millPluginArtifact(artifactName: String, millVersion: Version): ArtifactId = {
    def format(major: String, minor: String) = s"${major}.${minor}_2.13"
    val millSuffix = millVersion.value.split('.') match {
      // Basically for right now we only accept "0.9.12", which is when this syntax for Mill plugins
      // was introduced, and all other pre v1 versions. Once it's for sure verified that v1 will also
      // follow this pattern we can include that.
      case Array(major, minor, patch) if major == "0" && minor == "9" && patch == "12" =>
        format(major, minor)
      case Array(major, minor, _) if major == "0" && Try(minor.toInt).map(_ > 9).getOrElse(false) =>
        format(major, minor)
      case _ => ""
    }

    ArtifactId(artifactName, Some(s"${artifactName}_mill${millSuffix}"))
  }