Skip to content

Commit

Permalink
Switch to Scala 3 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
romanowski committed Apr 22, 2022
1 parent 185e4a7 commit 6a7ad56
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 42 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,24 +186,6 @@ jobs:
- name: Check examples
run: bash ./scala-cli --jvm temurin:17 .github/scripts/check_examples.sc

migration-tests:
timeout-minutes: 120
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: coursier/cache-action@v6.3
- uses: VirtusLab/scala-cli-setup@267af2f1ed4911180b4bb25619ca4a586753cbd1
with:
jvm: "temurin:17"
- name: Unit 3.x tests
run: |
./mill -i cli3.compile
./mill -i cli3.test
./mill -i _[3.1.1].test
checks:
timeout-minutes: 15
runs-on: ubuntu-latest
Expand Down
26 changes: 14 additions & 12 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,26 @@ import _root_.scala.util.Properties
implicit def millModuleBasePath: define.BasePath =
define.BasePath(super.millModuleBasePath.value / "modules")

object cli extends Cli
// remove once migrate to Scala 3
object cli3 extends Cli3
object cli extends Cli3

// remove once we do not have blockers with Scala 3
object cli2 extends Cli

object `cli-options` extends CliOptions
object `build-macros` extends Cross[BuildMacros](Scala.defaultInternal, Scala.scala3)
object options extends Cross[Options](Scala.defaultInternal, Scala.scala3)
object `build-macros` extends Cross[BuildMacros](Scala.mainVersions:_*)
object options extends Cross[Options](Scala.mainVersions:_*)
object scalaparse extends ScalaParse
object directives extends Cross[Directives](Scala.defaultInternal, Scala.scala3)
object core extends Cross[Core](Scala.defaultInternal, Scala.scala3)
object `build-module` extends Cross[Build](Scala.defaultInternal, Scala.scala3)
object directives extends Cross[Directives](Scala.mainVersions:_*)
object core extends Cross[Core](Scala.mainVersions:_*)
object `build-module` extends Cross[Build](Scala.mainVersions:_*)
object runner extends Cross[Runner](Scala.all: _*)
object `test-runner` extends Cross[TestRunner](Scala.all: _*)
object `bloop-rifle` extends Cross[BloopRifle](Scala.all: _*)
object `tasty-lib` extends Cross[TastyLib](Scala.all: _*)
// Runtime classes used within native image on Scala 3 replacing runtime from Scala
object `scala3-runtime` extends Scala3Runtime
// Logic to process classes that is shared between build and the scala-cli itself
object `scala3-graal` extends Cross[Scala3Graal](Scala.defaultInternal, Scala.scala3)
object `scala3-graal` extends Cross[Scala3Graal](Scala.mainVersions:_*)
// Main app used to process classpath within build itself
object `scala3-graal-processor` extends Scala3GraalProcessor

Expand Down Expand Up @@ -481,7 +483,7 @@ class Options(val crossScalaVersion: String) extends BuildLikeModule {

trait ScalaParse extends SbtModule with ScalaCliPublishModule with ScalaCliCompile {
def ivyDeps = super.ivyDeps() ++ Agg(Deps.scalaparse)
def scalaVersion = Scala.defaultInternal
def scalaVersion = Scala.scala213
}

trait Scala3Runtime extends SbtModule with ScalaCliPublishModule with ScalaCliCompile {
Expand Down Expand Up @@ -587,7 +589,7 @@ trait CliOptions extends SbtModule with ScalaCliPublishModule with ScalaCliCompi
Deps.osLib,
Deps.signingCliShared
)
def scalaVersion = Scala.defaultInternal
def scalaVersion = Scala.scala213
def repositories = super.repositories ++ customRepositories
}

Expand Down Expand Up @@ -654,7 +656,7 @@ trait Cli3 extends Cli {
mainArgs = Seq(cache.toNIO.toString, classpath),
workingDir = os.pwd
)
val cp = res.out.text
val cp = res.out.lines.head
cp.split(File.pathSeparator).toSeq.map(p => mill.PathRef(os.Path(p)))
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package scala.cli.doc

import caseapp._

final case class InternalDocOptions(
outputDir: String = "website/docs/reference",
check: Boolean = false
) {
lazy val outputPath: os.Path =
os.Path(outputDir, os.pwd)
}

object InternalDocOptions {
implicit lazy val parser: Parser[InternalDocOptions] = Parser.derive
implicit lazy val help: Help[InternalDocOptions] = Help.derive
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import scala.build.preprocessing.directives.{
}
import scala.cli.ScalaCliCommands

object GenerateReferenceDoc extends CaseApp[Options] {
object GenerateReferenceDoc extends CaseApp[InternalDocOptions] {

private def cleanUpOrigin(origin: String): String = {
val origin0 = origin.takeWhile(_ != '[').stripSuffix("Options")
Expand Down Expand Up @@ -289,7 +289,7 @@ object GenerateReferenceDoc extends CaseApp[Options] {
b.toString
}

def run(options: Options, args: RemainingArgs): Unit = {
def run(options: InternalDocOptions, args: RemainingArgs): Unit = {

val scalaCli = new ScalaCliCommands("scala-cli", isSipScala = false)
val commands = scalaCli.commands
Expand Down

This file was deleted.

3 changes: 2 additions & 1 deletion project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ object Scala {
def scala3 = "3.1.1"
val allScala2 = Seq(scala213, scala212)
val all = allScala2 ++ Seq(scala3)
val mainVersions = Seq(scala3, scala213)

def scalaJs = "1.10.0"

Expand All @@ -28,7 +29,7 @@ object Scala {
// The Scala version used to build the CLI itself.
// We should be able to switch to 3.x when it'll have CPS support
// (for the either { value(…) } stuff)
def defaultInternal = scala213
def defaultInternal = scala3

// The Scala version used by default to compile user input.
def defaultUser = scala3
Expand Down

0 comments on commit 6a7ad56

Please sign in to comment.