Skip to content

Commit

Permalink
Always default to the internal Scala 3 version for Scala 3 cross-comp…
Browse files Browse the repository at this point in the history
…iled modules
  • Loading branch information
Gedochao committed Feb 23, 2024
1 parent ff9e96e commit 0fab65e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
44 changes: 26 additions & 18 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ import _root_.scala.util.{Properties, Using}
implicit def millModuleBasePath: define.Ctx.BasePath =
define.Ctx.BasePath(super.millModuleBasePath.value / "modules")

object cli extends Cross[Cli](Scala.allScala3) {
object cli extends Cross[Cli](Scala.scala3MainVersions) with CrossScalaDefaultToInternal

trait CrossScalaDefaultToInternal { _: mill.define.Cross[_] =>
def defaultCrossSegments = Seq(Scala.defaultInternal)
}

Expand Down Expand Up @@ -70,21 +72,29 @@ object cliBootstrapped extends ScalaCliPublishModule {
}

object `specification-level` extends Cross[SpecificationLevel](Scala.all)
object `build-macros` extends Cross[BuildMacros](Scala.allScala3)
object config extends Cross[Config](Scala.all)
object options extends Cross[Options](Scala.allScala3)
object directives extends Cross[Directives](Scala.allScala3)
object core extends Cross[Core](Scala.allScala3)
object `build-module` extends Cross[Build](Scala.allScala3)
object runner extends Cross[Runner](Scala.runnerScalaVersions)
object `test-runner` extends Cross[TestRunner](Scala.testRunnerScalaVersions)
object `tasty-lib` extends Cross[TastyLib](Scala.all)
with CrossScalaDefaultToInternal
object `build-macros` extends Cross[BuildMacros](Scala.scala3MainVersions)
with CrossScalaDefaultToInternal
object config extends Cross[Config](Scala.all) with CrossScalaDefaultToInternal
object options extends Cross[Options](Scala.scala3MainVersions) with CrossScalaDefaultToInternal
object directives extends Cross[Directives](Scala.scala3MainVersions)
with CrossScalaDefaultToInternal
object core extends Cross[Core](Scala.scala3MainVersions) with CrossScalaDefaultToInternal
object `build-module` extends Cross[Build](Scala.scala3MainVersions)
with CrossScalaDefaultToInternal
object runner extends Cross[Runner](Scala.runnerScalaVersions) with CrossScalaDefaultToInternal
object `test-runner` extends Cross[TestRunner](Scala.testRunnerScalaVersions)
with CrossScalaDefaultToInternal
object `tasty-lib` extends Cross[TastyLib](Scala.all) with CrossScalaDefaultToInternal
// Runtime classes used within native image on Scala 3 replacing runtime from Scala
object `scala3-runtime` extends Cross[Scala3Runtime](Scala.allScala3)
object `scala3-runtime` extends Cross[Scala3Runtime](Scala.scala3MainVersions)
with CrossScalaDefaultToInternal
// Logic to process classes that is shared between build and the scala-cli itself
object `scala3-graal` extends Cross[Scala3Graal](Scala.mainVersions)
with CrossScalaDefaultToInternal
// Main app used to process classpath within build itself
object `scala3-graal-processor` extends Cross[Scala3GraalProcessor](Scala.allScala3)
object `scala3-graal-processor` extends Cross[Scala3GraalProcessor](Scala.scala3MainVersions)
with CrossScalaDefaultToInternal

object `scala-cli-bsp` extends JavaModule with ScalaCliPublishModule {
def ivyDeps = super.ivyDeps() ++ Seq(
Expand Down Expand Up @@ -132,9 +142,8 @@ object integration extends CliIntegration {
}
}

object `docs-tests` extends Cross[DocsTests](Scala.allScala3) {
def defaultCrossSegments = Seq(Scala.defaultInternal)
}
object `docs-tests` extends Cross[DocsTests](Scala.scala3MainVersions)
with CrossScalaDefaultToInternal

trait DocsTests extends CrossSbtModule with ScalaCliScalafixModule with HasTests { main =>
def ivyDeps = Agg(
Expand Down Expand Up @@ -180,9 +189,8 @@ object packager extends ScalaModule with Bloop.Module {
def mainClass = Some("packager.cli.PackagerCli")
}

object `generate-reference-doc` extends Cross[GenerateReferenceDoc](Scala.allScala3) {
def defaultCrossSegments = Seq(Scala.defaultInternal)
}
object `generate-reference-doc` extends Cross[GenerateReferenceDoc](Scala.scala3MainVersions)
with CrossScalaDefaultToInternal

trait GenerateReferenceDoc extends CrossSbtModule with ScalaCliScalafixModule {
def moduleDeps = Seq(
Expand Down
3 changes: 2 additions & 1 deletion project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ object Scala {
val defaults = Seq(defaultInternal, defaultUser).distinct
val allScala3 = Seq(scala3Lts, scala3Next)
val all = (allScala2 ++ allScala3 ++ defaults).distinct
val mainVersions = (Seq(scala213) ++ allScala3 ++ defaults).distinct
val scala3MainVersions = (defaults ++ allScala3).distinct
val mainVersions = (Seq(scala213) ++ scala3MainVersions).distinct
val runnerScalaVersions = runnerScala3 +: allScala2
val testRunnerScalaVersions = runnerScalaVersions ++ allScala3

Expand Down

0 comments on commit 0fab65e

Please sign in to comment.