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

Update metabrowse to 0.2.8 #886

Merged
merged 5 commits into from
Aug 18, 2022
Merged
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
19 changes: 1 addition & 18 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,9 @@ class ScalaInterpreter(val crossScalaVersion: String) extends AlmondModule with
shared.interpreter(),
scala.`scala-kernel-api`()
)
def addMetabrowse = T{
val sv = scalaVersion()
val patch = sv
.split('.')
.drop(2)
.headOption
.flatMap(s => _root_.scala.util.Try(s.takeWhile(_.isDigit).toInt).toOption)
(sv.startsWith("2.12.") && patch.exists(_ <= 10)) ||
(sv.startsWith("2.13.") && patch.exists(_ <= 1))
}
def ivyDeps = T{
val metabrowse =
if (addMetabrowse()) Agg(Deps.metabrowseServer)
if (crossScalaVersion.startsWith("2.")) Agg(Deps.metabrowseServer)
else Agg.empty
metabrowse ++ Agg(
Deps.coursier.withDottyCompat(crossScalaVersion),
Expand All @@ -163,13 +153,6 @@ class ScalaInterpreter(val crossScalaVersion: String) extends AlmondModule with
Deps.ammoniteRepl(crossScalaVersion)
)
}
def sources = T.sources {
val dirName =
if (addMetabrowse()) "scala-has-metabrowse"
else "scala-no-metabrowse"
val extra = PathRef(millSourcePath / "src" / "main" / dirName)
super.sources() ++ Seq(extra)
}
object test extends Tests with AlmondTestModule {
def moduleDeps = {
val rx =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ammonite.runtime.Frame
import ammonite.util.Ref
import ammonite.util.Util.newLine
import metabrowse.server.{MetabrowseServer, Sourcepath}
import scala.meta.dialects

import scala.tools.nsc.Global
import scala.tools.nsc.interactive.{Global => Interactive}
Expand Down Expand Up @@ -58,7 +59,16 @@ final class ScalaInterpreterInspections(
else
ConnectionParameters.randomPort()

val dialect =
if (compilerManager.scalaVersion.startsWith("3."))
dialects.Scala3
else if (compilerManager.scalaVersion.startsWith("2.13."))
dialects.Scala213
else
dialects.Scala212

val server = new MetabrowseServer(
dialect,
host = metabrowseHost,
port = port
// FIXME Pass custom logger?
Expand Down
2 changes: 1 addition & 1 deletion project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object Deps {
def jsoniterScalaMacros = ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-macros:${Versions.jsoniterScala}"
def jvmRepr = ivy"com.github.jupyter:jvm-repr:0.4.0"
def mdoc = ivy"org.scalameta::mdoc:2.3.3"
def metabrowseServer = ivy"org.scalameta::metabrowse-server:0.2.3"
def metabrowseServer = ivy"org.scalameta:::metabrowse-server:0.2.8"
def scalafmtDynamic = ivy"org.scalameta::scalafmt-dynamic:${Versions.scalafmt}"
def scalaReflect(sv: String) = ivy"org.scala-lang:scala-reflect:$sv"
def scalaRx = ivy"com.lihaoyi::scalarx:0.4.3"
Expand Down