Skip to content

Commit b763349

Browse files
Merge branch 'master' into update/scalameta-4.9.9
2 parents f02e693 + 52f4d03 commit b763349

File tree

4 files changed

+47
-36
lines changed

4 files changed

+47
-36
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
scala: [2.12.19, 2.13.14]
29+
scala: [2.12.20, 2.13.15]
3030
os: [ubuntu-latest]
3131
java: [11, 8]
3232
steps:

build.sbt

+15-12
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ lazy val Version = new {
77
"2.13.11",
88
"2.13.12",
99
"2.13.13",
10-
"2.13.14"
10+
"2.13.14",
11+
"2.13.15"
1112
)
1213
val scala212Versions = Seq(
1314
"2.12.16",
1415
"2.12.17",
1516
"2.12.18",
16-
"2.12.19"
17+
"2.12.19",
18+
"2.12.20"
1719
)
1820
def scala213 = scala213Versions.last
1921
def scala212 = scala212Versions.last
2022

21-
def mtags = "1.3.2"
23+
def mtags = "1.3.5"
2224
// Important: this should be the exact same version as the one mtags pulls, as mtags uses some scalameta internal APIs,
2325
// and binary compatibility of these APIs isn't guaranteed.
2426
// Get this version with a command like 'cs resolve org.scalameta:mtags_2.13.14:1.3.1 | grep org.scalameta:scalameta'
@@ -105,8 +107,8 @@ lazy val example = project
105107
"-Xplugin-require:semanticdb"
106108
),
107109
libraryDependencies ++= List(
108-
"org.scalatest" %% "scalatest" % "3.2.18" % Test,
109-
"org.scalacheck" %% "scalacheck" % "1.17.1" % Test,
110+
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
111+
"org.scalacheck" %% "scalacheck" % "1.18.1" % Test,
110112
"org.scalatestplus" %% "scalacheck-1-17" % "3.2.18.0" % Test
111113
),
112114
test := {} // no need to run paiges tests.
@@ -121,10 +123,11 @@ lazy val server = project
121123
resolvers += Resolver.sonatypeRepo("snapshots"),
122124
libraryDependencies ++= List(
123125
"io.undertow" % "undertow-core" % "2.0.30.Final",
124-
"org.slf4j" % "slf4j-api" % "2.0.13",
126+
"org.slf4j" % "slf4j-api" % "2.0.16",
125127
"org.jboss.xnio" % "xnio-nio" % "3.8.0.Final",
126128
"org.scalameta" % "semanticdb-scalac-core" % Version.scalameta cross CrossVersion.full,
127-
("org.scalameta" %% "mtags" % Version.mtags).cross(CrossVersion.full)
129+
("org.scalameta" %% "mtags" % Version.mtags).cross(CrossVersion.full),
130+
"com.lihaoyi" %% "os-lib" % "0.10.1"
128131
),
129132
(Compile / packageBin) := {
130133
import java.io.FileOutputStream
@@ -247,7 +250,7 @@ lazy val js = project
247250
webpackConfigFile := Some(baseDirectory.value / "webpack.config.js"),
248251
libraryDependencies ++= Seq(
249252
"org.scala-js" %%% "scalajs-dom" % "0.9.8",
250-
"org.scalatest" %%% "scalatest" % "3.2.18" % Test
253+
"org.scalatest" %%% "scalatest" % "3.2.19" % Test
251254
),
252255
(Compile / npmDevDependencies) ++= Seq(
253256
"clean-webpack-plugin" -> "3.0.0",
@@ -357,10 +360,10 @@ lazy val tests = project
357360
libraryDependencies ++= List(
358361
"org.scalameta" %% "testkit" % Version.scalameta,
359362
"org.scalameta" % "semanticdb-scalac-core" % Version.scalameta cross CrossVersion.full,
360-
"org.scalatest" %% "scalatest" % "3.2.18",
361-
"org.scalacheck" %% "scalacheck" % "1.17.1",
362-
"org.seleniumhq.selenium" % "selenium-java" % "4.21.0" % IntegrationTest,
363-
"org.slf4j" % "slf4j-simple" % "2.0.13"
363+
"org.scalatest" %% "scalatest" % "3.2.19",
364+
"org.scalacheck" %% "scalacheck" % "1.18.1",
365+
"org.seleniumhq.selenium" % "selenium-java" % "4.23.1" % IntegrationTest,
366+
"org.slf4j" % "slf4j-simple" % "2.0.16"
364367
),
365368
(IntegrationTest / compile) := {
366369
_root_.io.github.bonigarcia.wdm.WebDriverManager.chromedriver.setup()

metabrowse-server/src/main/scala/metabrowse/server/MetabrowseServer.scala

+26-18
Original file line numberDiff line numberDiff line change
@@ -232,30 +232,30 @@ class MetabrowseServer(
232232
.build()
233233

234234
private def getBytes(exchange: HttpServerExchange): Array[Byte] = {
235-
val path = exchange.getRequestPath.stripSuffix(".gz")
236-
if (path.endsWith("index.workspace")) {
235+
val path = os.SubPath("." + exchange.getRequestPath.stripSuffix(".gz"))
236+
if (path.lastOpt.exists(_.endsWith("index.workspace"))) {
237237
getWorkspace.toByteArray
238-
} else if (path.endsWith(".symbolindexes")) {
238+
} else if (path.lastOpt.exists(_.endsWith(".symbolindexes"))) {
239239
val header = exchange.getRequestHeaders.get("Metabrowse-Symbol")
240240
if (header.isEmpty) {
241241
logger.error(s"no Metabrowse-Symbol header: $exchange")
242242
Array.emptyByteArray
243243
} else {
244244
getSymbol(header.getFirst).toByteArray
245245
}
246-
} else if (path.endsWith(".semanticdb")) {
246+
} else if (path.lastOpt.exists(_.endsWith(".semanticdb"))) {
247247
getSemanticdb(path).toByteArray
248-
} else if (path.endsWith(".map")) {
248+
} else if (path.lastOpt.exists(_.endsWith(".map"))) {
249249
// Ignore requests for sourcemaps.
250250
Array.emptyByteArray
251251
} else {
252-
val actualPath = if (path == "/") "/index.html" else path
252+
val actualPath = if (path == os.sub) os.sub / "index.html" else path
253253
withInputStream(
254254
Thread
255255
.currentThread()
256256
.getContextClassLoader
257257
.getResourceAsStream(
258-
s"metabrowse/server/assets/${actualPath.stripPrefix("/")}"
258+
(os.sub / "metabrowse" / "server" / "assets" / actualPath).toString
259259
)
260260
) { is =>
261261
if (is == null) {
@@ -301,27 +301,35 @@ class MetabrowseServer(
301301
Workspace(filenames.result().toSeq)
302302
}
303303

304-
private def getSemanticdb(filename: String): TextDocuments = {
305-
val path = filename
306-
.stripPrefix("/semanticdb/")
307-
.stripPrefix("/") // optional '/'
308-
.stripSuffix(".semanticdb")
309-
logger.info(path)
304+
private def getSemanticdb(subPath: os.SubPath): TextDocuments = {
305+
val path = {
306+
val subPath0 =
307+
if (subPath.startsWith(os.sub / "semanticdb"))
308+
subPath.relativeTo(os.sub / "semanticdb").asSubPath
309+
else
310+
subPath
311+
subPath0.lastOpt match {
312+
case Some(name) if name.endsWith(".semanticdb") =>
313+
subPath0 / os.up / name.stripSuffix(".semanticdb")
314+
case _ => subPath0
315+
}
316+
}
317+
logger.info(path.toString)
310318
for {
311-
text <- state.get().source(path).orElse {
319+
text <- state.get().source(path.toString).orElse {
312320
logger.warn(s"no source file: $path")
313321
None
314322
}
315323
doc <- try {
316324
val timeout = TimeUnit.SECONDS.toMillis(10)
317-
val textDocument = if (path.endsWith(".java")) {
318-
val input = Input.VirtualFile(path, text)
325+
val textDocument = if (path.lastOpt.exists(_.endsWith(".java"))) {
326+
val input = Input.VirtualFile(path.toString, text)
319327
t.JavaMtags.index(input, includeMembers = true).index()
320328
} else {
321329
InteractiveSemanticdb.toTextDocument(
322330
global,
323331
text,
324-
filename,
332+
subPath.toString,
325333
timeout,
326334
List(
327335
"-P:semanticdb:synthetics:on",
@@ -332,7 +340,7 @@ class MetabrowseServer(
332340
Some(textDocument)
333341
} catch {
334342
case NonFatal(e) =>
335-
logger.error(s"compile error: $filename", e)
343+
logger.error(s"compile error: $subPath", e)
336344
None
337345
}
338346
} yield TextDocuments(List(doc.withText(text)))

project/plugins.sbt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0")
2-
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.5")
3-
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0")
2+
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.0")
3+
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.0")
44
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.7")
55
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
66
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
7-
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
7+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0")
88

99
libraryDependencies ++= List(
10-
"io.github.bonigarcia" % "webdrivermanager" % "5.8.0",
11-
"com.thesamet.scalapb" %% "compilerplugin" % "0.11.15",
10+
"io.github.bonigarcia" % "webdrivermanager" % "5.9.2",
11+
"com.thesamet.scalapb" %% "compilerplugin" % "0.11.17",
1212
"org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
1313
)

0 commit comments

Comments
 (0)