Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Support for scala 3.1 #896

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
target/
.bsp/
.coursier/
.DS_Store
.idea/
.bloop
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,14 @@ People are expected to follow the [Scala Code of Conduct](https://www.scala-lang
when discussing almond on GitHub, Gitter channel, or other venues.

Feel free to open an issue if you notice a bug, have an idea for a feature, or have a question about the code. Pull requests are also gladly accepted.

# Building with Scala 3

## Building with scala 3.0.2

checkout branch scala30

## Building with scala 3.1.0

checkout branch scala31

8 changes: 2 additions & 6 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,8 @@ class ScalaInterpreter(val crossScalaVersion: String) extends AlmondModule with
}
object test extends Tests with AlmondTestModule {
def moduleDeps = {
val rx =
if (crossScalaVersion.startsWith("2.12.")) Seq(scala.`almond-rx`())
else Nil
super.moduleDeps ++
Seq(shared.kernel().test) ++
rx
super.moduleDeps ++
Seq(shared.kernel().test)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import almond.logger.internal._

import scala.language.experimental.macros
import scala.quoted._
import annotation.experimental

@experimental
final case class Logger(underlying: ActualLogger) {

def prefix(prefix: String): Logger =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package almond.logger

import java.io.PrintStream
import annotation.experimental

import almond.logger.internal.LoggerContextImpl

@experimental
trait LoggerContext {
def apply(prefix: String): Logger

Expand All @@ -22,4 +24,4 @@ object LoggerContext {
def stderr(level: Level): LoggerContext =
LoggerContextImpl(Logger.stderr(level))

}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package almond.logger.internal

import java.io.PrintStream
import annotation.experimental

import almond.logger._

@experimental
trait LoggerCompanionMethods {

def nop: Logger =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package almond.logger.internal

import annotation.experimental
import almond.logger.{Logger, LoggerContext}

@experimental
final case class LoggerContextImpl(baseLogger: Logger) extends LoggerContext {
def apply(prefix: String): Logger =
baseLogger.prefix(prefix)
Expand Down
6 changes: 4 additions & 2 deletions project/jupyterserver.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.nio.file._
def kernelId = "scala-debug"

def writeKernelJson(launcher: Path, jupyterDir: Path): Unit = {
val launcherPath = launcher.toAbsolutePath.toString
val launcherPath = launcher.toAbsolutePath.toString.replace("\\","\\\\")
val dir = jupyterDir.resolve(s"kernels/$kernelId")
Files.createDirectories(dir)
val kernelJson = s"""{
Expand All @@ -26,7 +26,9 @@ def jupyterServer(launcher: Path, jupyterDir: Path, args: Seq[String]): Unit = {
writeKernelJson(launcher, jupyterDir)

os.makeDir.all(os.pwd / "notebooks")
val jupyterCommand = Seq("jupyter", "lab", "--notebook-dir", "notebooks")
val jupyterCommand = Seq(
if (mill.main.client.Util.isWindows) "jupyter.bat" else "jupyter",
"lab", "--notebook-dir", "notebooks")
val b = new ProcessBuilder(jupyterCommand ++ args: _*).inheritIO()
val env = b.environment()
env.put("JUPYTER_PATH", jupyterDir.toAbsolutePath.toString)
Expand Down