Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package bloop.bloopgun.internal;

// FIXME Copied from shared/src/main/java/bloop/io/internal/ProjDirHelper.java

import coursierapi.shaded.coursier.cache.shaded.dirs.GetWinDirs;
import coursierapi.shaded.coursier.cache.shaded.dirs.ProjectDirectories;
import coursierapi.shaded.coursier.jniutils.WindowsKnownFolders;
import coursierapi.shaded.coursier.paths.Util;

import java.util.ArrayList;

public class ProjDirHelper {
public static String cacheDir() {
return ((ProjectDirectories) get()).cacheDir;
}
public static String dataDir() {
return ((ProjectDirectories) get()).dataDir;
}
// not letting ProjectDirectories leak in the signature, getting weird scalac crashes
// with Scala 2.12.5 (because of shading?)
private static Object get() {
GetWinDirs getWinDirs;
if (Util.useJni()) {
getWinDirs = new GetWinDirs() {
public String[] getWinDirs(String ...guids) {
ArrayList<String> l = new ArrayList<>();
for (int idx = 0; idx < guids.length; idx++) {
l.add(WindowsKnownFolders.knownFolderPath("{" + guids[idx] + "}"));
}
return l.toArray(new String[l.size()]);
}
};
} else {
getWinDirs = GetWinDirs.powerShellBased;
}
return ProjectDirectories.from("", "", "bloop", getWinDirs);
}
}
20 changes: 3 additions & 17 deletions bloopgun-core/src/main/scala/bloop/bloopgun/Defaults.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package bloop.bloopgun
import java.nio.file.attribute.PosixFilePermissions
import java.nio.file.{Files, Path, Paths}
import scala.util.Properties
import coursierapi.shaded.coursier.cache.shaded.dirs.{GetWinDirs, ProjectDirectories}

object Defaults {
val Version = "0.9.3"
Expand All @@ -20,23 +19,10 @@ object Defaults {
val SendThreadWaitTerminationMillis = 5000.toLong
}

// also more or less in bloop.io.Paths…
private lazy val projectDirectories = {
val getWinDirs: GetWinDirs =
if (coursierapi.shaded.coursier.paths.Util.useJni())
new GetWinDirs {
def getWinDirs(guids: String*) =
guids.map { guid =>
coursierapi.shaded.coursier.jniutils.WindowsKnownFolders
.knownFolderPath("{" + guid + "}")
}.toArray
}
else
GetWinDirs.powerShellBased
ProjectDirectories.from("", "", "bloop", getWinDirs)
private lazy val (bloopCacheDir, bloopDataDir) = {
import bloop.bloopgun.internal.ProjDirHelper
(Paths.get(ProjDirHelper.cacheDir()), Paths.get(ProjDirHelper.dataDir()))
}
private lazy val bloopCacheDir: Path = Paths.get(projectDirectories.cacheDir)
private lazy val bloopDataDir: Path = Paths.get(projectDirectories.dataDir)

lazy val daemonDir: Path = {
def defaultDir = {
Expand Down
13 changes: 10 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import build.BuildImplementation.BuildDefaults
import scala.util.Properties

inThisBuild(
List(
Expand Down Expand Up @@ -248,7 +249,8 @@ lazy val bloopgun = project
sonatypeSetting,
name := "bloopgun",
libraryDependencies ++= List(
Dependencies.logback
Dependencies.logback,
Dependencies.svmSubs
),
mainClass in GraalVMNativeImage := Some("bloop.bloopgun.Bloopgun"),
graalVMNativeImageCommand := {
Expand All @@ -259,6 +261,9 @@ lazy val bloopgun = project
graalVMNativeImageOptions ++= {
val reflectionFile = sourceDirectory.in(Compile).value./("graal")./("reflection.json")
assert(reflectionFile.exists)
val extra =
if (Properties.isMac) List("-H:IncludeResources=META-INF/native/darwin/ipcsocket.dylib")
else Nil
List(
"--no-server",
"--enable-http",
Expand All @@ -273,8 +278,10 @@ lazy val bloopgun = project
"--initialize-at-build-time=scala.Function1",
"--initialize-at-build-time=scala.Function2",
"--initialize-at-build-time=scala.runtime.StructuralCallSite",
"--initialize-at-build-time=scala.runtime.EmptyMethodCache"
)
"--initialize-at-build-time=scala.runtime.EmptyMethodCache",
"--initialize-at-build-time=scala.runtime.LambdaDeserialize",
"--initialize-at-build-time=scala.collection.immutable.VM"
) ++ extra
}
)

Expand Down
14 changes: 13 additions & 1 deletion config/src/test/scala/bloop/config/utils/BaseConfigSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ trait BaseConfigSuite {
}
}

protected def hasPathEntryName(entryName: String, paths: List[Path]): Boolean = {
protected def hasPathEntryName(
entryName: String,
paths: List[bloop.config.PlatformFiles.Path]
): Boolean = {
val pathValidEntryName = entryName.replace('/', File.separatorChar)
val pathAsStr = paths.map(_.toString)
pathAsStr.exists(_.contains(pathValidEntryName))
Expand Down Expand Up @@ -166,6 +169,15 @@ trait BaseConfigSuite {
matchMethod: (String, String) => Boolean,
assertMethod: (String, Boolean) => Unit
): Unit = {
def getFileName(path: bloop.config.PlatformFiles.Path): String = {
// possibly broken in some corner cases, but should do the job in the tests here
val pathStr = path.toString
val slashIdx = pathStr.lastIndexOf('/')
val bslashIdx = pathStr.lastIndexOf('\\')
val idx = slashIdx.max(bslashIdx)
if (idx >= 0) pathStr.drop(idx + 1)
else pathStr
}
configs.foreach(config =>
jarNames
.foreach(jarName =>
Expand Down
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions frontend/src/test/scala/bloop/BuildLoaderSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object BuildLoaderSpec extends BaseSuite {

testLoad("reload if settings are added") { (testBuild, logger) =>
val settings =
WorkspaceSettings.fromSemanticdbSettings("0.2.0", "4.2.0", List(BuildInfo.scalaVersion))
WorkspaceSettings.fromSemanticdbSettings("0.2.0", "4.4.31", List(BuildInfo.scalaVersion))
testBuild.state.build.checkForChange(Some(settings), logger).map {
case Build.ReturnPreviousState =>
sys.error(s"Expected return updated state, got previous state")
Expand All @@ -37,7 +37,7 @@ object BuildLoaderSpec extends BaseSuite {
}

val sameSettings =
WorkspaceSettings.fromSemanticdbSettings("0.2.0", "4.2.0", List(BuildInfo.scalaVersion))
WorkspaceSettings.fromSemanticdbSettings("0.2.0", "4.4.31", List(BuildInfo.scalaVersion))

testLoad("do not reload if same settings are added", Some(sameSettings)) { (testBuild, logger) =>
testBuild.state.build.checkForChange(Some(sameSettings), logger).map {
Expand All @@ -63,7 +63,7 @@ object BuildLoaderSpec extends BaseSuite {

testLoad("reload if new Java settings are added", Some(sameSettings)) { (testBuild, logger) =>
val newSettings =
WorkspaceSettings.fromSemanticdbSettings("0.1.0", "4.2.0", List(BuildInfo.scalaVersion))
WorkspaceSettings.fromSemanticdbSettings("0.1.0", "4.4.31", List(BuildInfo.scalaVersion))
testBuild.state.build.checkForChange(Some(newSettings), logger).map {
case Build.ReturnPreviousState =>
sys.error(s"Expected return updated state, got previous state")
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/test/scala/bloop/ConsoleSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object ConsoleSpec extends BaseSuite {
val coursierClasspathArgs =
classpathB.flatMap(elem => Seq("--extra-jars", elem.syntax))
val expectedCommand =
s"coursier launch com.lihaoyi:ammonite_2.12.8:latest.release --main-class ammonite.Main ${coursierClasspathArgs
s"coursier launch com.lihaoyi:ammonite_2.12.15:latest.release --main-class ammonite.Main ${coursierClasspathArgs
.mkString(" ")} ${("--" :: ammArgs).mkString(" ")}"

assertNoDiff(
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/test/scala/bloop/bsp/BspCompileSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,9 @@ class BspCompileSpec(
}

// Change the semanticdb jar every time we upgrade Scala version
assert(BuildInfo.scalaVersion == "2.12.8")
assert(BuildInfo.scalaVersion == "2.12.15")
val sourceDir = workspace.resolve("a").resolve("src")
val semanticdbJar = unsafeGetResource("semanticdb_2.12.8-4.1.11.jar")
val semanticdbJar = unsafeGetResource("semanticdb-scalac_2.12.15-4.4.31.jar")
val semanticdbOpts = List(
s"-Xplugin:$semanticdbJar",
"-Yrangepos",
Expand Down
44 changes: 22 additions & 22 deletions frontend/src/test/scala/bloop/bsp/BspMetalsClientSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object TcpBspMetalsClientSpec extends BspMetalsClientSpec(BspProtocol.Tcp)
class BspMetalsClientSpec(
override val protocol: BspProtocol
) extends BspBaseSuite {
private val testedScalaVersion = "2.12.8"
private val testedScalaVersion = "2.12.15"

override def test(name: String)(fun: => Any): Unit =
super.test(name) {
Expand All @@ -46,7 +46,7 @@ class BspMetalsClientSpec(
val projects = List(`A`)
val configDir = TestProject.populateWorkspace(workspace, projects)
val logger = new RecordingLogger(ansiCodesSupported = false)
val semanticdbVersion = "4.2.0"
val semanticdbVersion = "4.4.31"
val extraParams = BloopExtraBuildParams(
ownsBuildFiles = None,
clientClassesRootDir = None,
Expand All @@ -61,9 +61,9 @@ class BspMetalsClientSpec(
configDir,
"""|{
| "javaSemanticDBVersion": "0.5.7",
| "semanticDBVersion": "4.2.0",
| "semanticDBVersion": "4.4.31",
| "supportedScalaVersions": [
| "2.12.8"
| "2.12.15"
| ]
|}
|""".stripMargin
Expand All @@ -75,7 +75,7 @@ class BspMetalsClientSpec(
|-P:semanticdb:failures:warning
|-P:semanticdb:sourceroot:$workspace
|-P:semanticdb:synthetics:on
|-Xplugin:semanticdb-scalac_2.12.8-4.2.0.jar
|-Xplugin:semanticdb-scalac_2.12.15-4.4.31.jar
|-Yrangepos
|""".stripMargin
)
Expand All @@ -91,7 +91,7 @@ class BspMetalsClientSpec(

test("do not initialize metals client and save settings with unsupported scala version") {
TestUtil.withinWorkspace { workspace =>
val semanticdbVersion = "4.2.0" // Doesn't support 2.12.4
val semanticdbVersion = "4.4.31" // Doesn't support 2.12.4
val `A` = TestProject(workspace, "A", Nil, scalaVersion = Some("2.12.4"))
val projects = List(`A`)
val configDir = TestProject.populateWorkspace(workspace, projects)
Expand All @@ -100,7 +100,7 @@ class BspMetalsClientSpec(
ownsBuildFiles = None,
clientClassesRootDir = None,
semanticdbVersion = Some(semanticdbVersion),
supportedScalaVersions = Some(List("2.12.8")),
supportedScalaVersions = Some(List("2.12.15")),
javaSemanticdbVersion = Some("0.5.7")
)

Expand All @@ -109,9 +109,9 @@ class BspMetalsClientSpec(
configDir,
"""|{
| "javaSemanticDBVersion": "0.5.7",
| "semanticDBVersion": "4.2.0",
| "semanticDBVersion": "4.4.31",
| "supportedScalaVersions": [
| "2.12.8"
| "2.12.15"
| ]
|}
|""".stripMargin
Expand All @@ -125,7 +125,7 @@ class BspMetalsClientSpec(

test("initialize metals client in workspace with already enabled semanticdb") {
TestUtil.withinWorkspace { workspace =>
val pluginPath = s"-Xplugin:path-to-plugin/semanticdb-scalac_2.12.8-4.2.0.jar.jar"
val pluginPath = s"-Xplugin:path-to-plugin/semanticdb-scalac_2.12.15-4.4.31.jar.jar"
val defaultScalacOptions = List(
"-P:semanticdb:failures:warning",
s"-P:semanticdb:sourceroot:$workspace",
Expand All @@ -144,7 +144,7 @@ class BspMetalsClientSpec(
val projects = List(`A`)
val configDir = TestProject.populateWorkspace(workspace, projects)
val logger = new RecordingLogger(ansiCodesSupported = false)
val semanticdbVersion = "4.2.0"
val semanticdbVersion = "4.4.31"
val extraParams = BloopExtraBuildParams(
ownsBuildFiles = None,
clientClassesRootDir = None,
Expand All @@ -158,9 +158,9 @@ class BspMetalsClientSpec(
configDir,
"""|{
| "javaSemanticDBVersion": "0.5.7",
| "semanticDBVersion": "4.2.0",
| "semanticDBVersion": "4.4.31",
| "supportedScalaVersions": [
| "2.12.8"
| "2.12.15"
| ]
|}
|""".stripMargin
Expand All @@ -183,7 +183,7 @@ class BspMetalsClientSpec(
"-P:semanticdb:failures:warning",
"-P:semanticdb:synthetics:on",
"-Xplugin-require:semanticdb",
s"-Xplugin:path-to-plugin/semanticdb-scalac_2.12.8-4.2.0.jar.jar",
s"-Xplugin:path-to-plugin/semanticdb-scalac_2.12.15-4.4.31.jar.jar",
"-Yrangepos"
)
val `A` = TestProject(
Expand All @@ -196,7 +196,7 @@ class BspMetalsClientSpec(
val projects = List(`A`)
val configDir = TestProject.populateWorkspace(workspace, projects)
val logger = new RecordingLogger(ansiCodesSupported = false)
val semanticdbVersion = "4.2.0"
val semanticdbVersion = "4.4.31"
val extraParams = BloopExtraBuildParams(
ownsBuildFiles = None,
clientClassesRootDir = None,
Expand All @@ -210,9 +210,9 @@ class BspMetalsClientSpec(
configDir,
"""|{
| "javaSemanticDBVersion": "0.5.7",
| "semanticDBVersion": "4.2.0",
| "semanticDBVersion": "4.4.31",
| "supportedScalaVersions": [
| "2.12.8"
| "2.12.15"
| ]
|}
|""".stripMargin
Expand All @@ -226,7 +226,7 @@ class BspMetalsClientSpec(

test("should save workspace settings with cached build") {
TestUtil.withinWorkspace { workspace =>
val semanticdbVersion = "4.2.0"
val semanticdbVersion = "4.4.31"
val javaSemanticdbVersion = "0.5.7"
val extraParams = BloopExtraBuildParams(
ownsBuildFiles = None,
Expand Down Expand Up @@ -303,7 +303,7 @@ class BspMetalsClientSpec(

val javaNormalClientsVersion = "0.5.7"
val javaMetalsVersion = "0.1.0"
val normalClientsVersion = "4.2.0"
val normalClientsVersion = "4.4.31"
val metalsClientVersion = "4.1.11"
val client1 = createClient(javaNormalClientsVersion, normalClientsVersion)
val client2 = createClient(javaNormalClientsVersion, normalClientsVersion)
Expand All @@ -329,7 +329,7 @@ class BspMetalsClientSpec(
val logger = new RecordingLogger(ansiCodesSupported = false)
WorkspaceSettings.writeToFile(
configDir,
WorkspaceSettings.fromSemanticdbSettings("0.5.7", "4.2.0", List(testedScalaVersion)),
WorkspaceSettings.fromSemanticdbSettings("0.5.7", "4.4.31", List(testedScalaVersion)),
logger
)
loadBspState(workspace, projects, logger) { state =>
Expand All @@ -349,7 +349,7 @@ class BspMetalsClientSpec(
val logger = new RecordingLogger(ansiCodesSupported = false)
WorkspaceSettings.writeToFile(
configDir,
WorkspaceSettings.fromSemanticdbSettings("0.5.7", "4.1.11", List(testedScalaVersion)),
WorkspaceSettings.fromSemanticdbSettings("0.5.7", "4.4.31", List(testedScalaVersion)),
logger
)
loadBspState(workspace, projects, logger) { state =>
Expand Down Expand Up @@ -455,7 +455,7 @@ class BspMetalsClientSpec(
val extraParams = BloopExtraBuildParams(
ownsBuildFiles = None,
clientClassesRootDir = None,
semanticdbVersion = Some("4.2.0"),
semanticdbVersion = Some("4.4.31"),
supportedScalaVersions = Some(List(testedScalaVersion)),
javaSemanticdbVersion = Some("0.5.7")
)
Expand Down
5 changes: 4 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package build

object Dependencies {
val Scala212Version = "2.12.8"
val Scala212Version = "2.12.15"

// Keep in sync in BloopComponentCompiler
val zincVersion = "1.3.0-M4+47-d881fa2f"
Expand Down Expand Up @@ -120,4 +120,7 @@ object Dependencies {

val libdaemonjvm = "io.github.alexarchambault.libdaemon" %% "libdaemon" % "0.0.8"
val ipcsocket = "io.github.alexarchambault.tmp.ipcsocket" % "ipcsocket" % "1.4.1-aa-5-1"

val svmSubs = "org.scalameta" %% "svm-subs" % "20.1.0"

}
2 changes: 1 addition & 1 deletion project/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exportJars := true
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.1.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.4")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
Expand Down
Loading