All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mill.scalalib.CrossScalaVersionRanges.scala Maven / Gradle / Ivy

There is a newer version: 0.12.0-RC2-17-07e173
Show newest version
package mill.scalalib

import mill.scalalib.api.ZincWorkerUtil

/**
 * Adds version range specific sources when mixed-in to a cross module like
 * `CrossScalaModule` or `CrossSbtModule`.
 * It is useful when a Scala version specific breaking change requires two
 * implementations of the same code for the cross versions before and after
 * a specific version. For example, migrating to Scala 2.13 it is usually
 * needed to define some version specific code for Scala 2.12- (all the versions
 * less or equal 2.12) and for Scala 2.13+ (all the versions greater or equal to 2.13).
 * Mixing `CrossScalaVersionRanges` into a `CrossScalaModule` will automatically add
 * the `src-2.13+` and `src-2.12-`, based on the `crossScalaVersion`.
 */
trait CrossScalaVersionRanges extends CrossModuleBase {
  val crossScalaVersionsRangeAllVersions: Seq[String] = millOuterCtx.crossValues.map(_.toString)

  override def scalaVersionDirectoryNames: Seq[String] =
    super.scalaVersionDirectoryNames ++
      ZincWorkerUtil.versionRanges(crossScalaVersion, crossScalaVersionsRangeAllVersions)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy