Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scalacenter/bloop
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.5.1
Choose a base ref
...
head repository: scalacenter/bloop
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.5.2
Choose a head ref
  • 4 commits
  • 4 files changed
  • 2 contributors

Commits on Jun 30, 2022

  1. Copy the full SHA
    a539cd1 View commit details
  2. Merge pull request #1745 from tgodzik/fix-run-java

    bugfix: Allow to run using DAP in Java only projects
    tgodzik authored Jun 30, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2cb26b0 View commit details
  3. Copy the full SHA
    2f4e97f View commit details
  4. Merge pull request #1746 from tgodzik/add-release-notes-1.5.2

    release: Add release notes for 1.5.2
    tgodzik authored Jun 30, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    de121a3 View commit details
5 changes: 1 addition & 4 deletions frontend/src/main/scala/bloop/bsp/BloopBspServices.scala
Original file line number Diff line number Diff line change
@@ -631,10 +631,7 @@ final class BloopBspServices(
}
)
case bsp.DebugSessionParamsDataKind.ScalaAttachRemote =>
BloopDebuggeeRunner.forAttachRemote(state, ioScheduler, projects) match {
case Right(adapter) => Right(adapter)
case Left(error) => Left(JsonRpcResponse.invalidRequest(error))
}
Right(BloopDebuggeeRunner.forAttachRemote(state, ioScheduler, projects))
case dataKind => Left(JsonRpcResponse.invalidRequest(s"Unsupported data kind: $dataKind"))
}
}
143 changes: 63 additions & 80 deletions frontend/src/main/scala/bloop/dap/BloopDebuggeeRunner.scala
Original file line number Diff line number Diff line change
@@ -27,8 +27,14 @@ import bloop.testing.TestInternals
import monix.eval.Task
import monix.execution.Scheduler

abstract class BloopDebuggeeRunner(initialState: State, ioScheduler: Scheduler)
extends DebuggeeRunner {
abstract class BloopDebuggeeRunner(
initialState: State,
ioScheduler: Scheduler,
debugeeScalaVersion: Option[String]
) extends DebuggeeRunner {

// The version doesn't matter for project without Scala version (Java only)
val scalaVersion = debugeeScalaVersion.getOrElse("2.13.8")

override def run(listener: DebuggeeListener): CancelableFuture[Unit] = {
val debugSessionLogger = new DebuggeeLogger(listener, initialState.logger)
@@ -52,8 +58,8 @@ private final class MainClassDebugAdapter(
initialState: State,
ioScheduler: Scheduler,
override val classPath: Seq[Path],
val scalaVersion: String
) extends BloopDebuggeeRunner(initialState, ioScheduler) {
val debugeeScalaVersion: Option[String]
) extends BloopDebuggeeRunner(initialState, ioScheduler, debugeeScalaVersion) {
val javaRuntime: Option[JavaRuntime] = JavaRuntime(env.javaHome.underlying)
def name: String = s"${getClass.getSimpleName}(${project.name}, ${mainClass.`class`})"
def start(state: State, listener: DebuggeeListener): Task[ExitStatus] = {
@@ -86,8 +92,8 @@ private final class TestSuiteDebugAdapter(
initialState: State,
ioScheduler: Scheduler,
override val classPath: Seq[Path],
val scalaVersion: String
) extends BloopDebuggeeRunner(initialState, ioScheduler) {
val debugeeScalaVersion: Option[String]
) extends BloopDebuggeeRunner(initialState, ioScheduler, debugeeScalaVersion) {
override def name: String = {
val projectsStr = projects.map(_.bspUri).mkString("[", ", ", "]")
val selectedTests = testClasses.suites
@@ -123,8 +129,8 @@ private final class AttachRemoteDebugAdapter(
initialState: State,
ioScheduler: Scheduler,
override val classPath: Seq[Path],
val scalaVersion: String
) extends BloopDebuggeeRunner(initialState, ioScheduler) {
val debugeeScalaVersion: Option[String]
) extends BloopDebuggeeRunner(initialState, ioScheduler, debugeeScalaVersion) {
override def name: String = s"${getClass.getSimpleName}(${initialState.build.origin})"
override def start(state: State, listener: DebuggeeListener): Task[ExitStatus] = Task(
ExitStatus.Ok
@@ -133,10 +139,6 @@ private final class AttachRemoteDebugAdapter(

object BloopDebuggeeRunner {

private def noScalaVersion: Left[String, DebuggeeRunner] = Left(
"No scala version specified for the project"
)

def forMainClass(
projects: Seq[Project],
mainClass: ScalaMainClass,
@@ -146,8 +148,8 @@ object BloopDebuggeeRunner {
projects match {
case Seq() => Left(s"No projects specified for main class: [$mainClass]")
case Seq(project) =>
(project.platform, project.scalaInstance) match {
case (jvm: Platform.Jvm, Some(scalaInstance)) =>
project.platform match {
case jvm: Platform.Jvm =>
val classPathEntries = getClassPathEntries(state, project)
val evaluationClassLoader = getEvaluationClassLoader(project, state)
val classpath = getClasspath(state, project)
@@ -161,12 +163,10 @@ object BloopDebuggeeRunner {
state,
ioScheduler,
classpath,
scalaInstance.version
project.scalaInstance.map(_.version)
)
)
case (_, None) =>
noScalaVersion
case (platform, _) =>
case platform =>
Left(s"Unsupported platform: ${platform.getClass.getSimpleName}")
}
case projects => Left(s"Multiple projects specified for main class [$mainClass]: $projects")
@@ -188,86 +188,69 @@ object BloopDebuggeeRunner {
val javaRuntime = JavaRuntime(config.javaHome.underlying)
val evaluationClassLoader = getEvaluationClassLoader(project, state)
val classpath = getClasspath(state, project)
project.scalaInstance.fold[Either[String, DebuggeeRunner]](
noScalaVersion
) { scalaInstance =>
Right(
new TestSuiteDebugAdapter(
projects,
testClasses,
classPathEntries,
javaRuntime,
evaluationClassLoader,
state,
ioScheduler,
classpath,
scalaInstance.version
)
Right(
new TestSuiteDebugAdapter(
projects,
testClasses,
classPathEntries,
javaRuntime,
evaluationClassLoader,
state,
ioScheduler,
classpath,
project.scalaInstance.map(_.version)
)
}
)

case project :: _ =>
project.scalaInstance.fold[Either[String, DebuggeeRunner]](
noScalaVersion
) { scalaInstance =>
Right(
new TestSuiteDebugAdapter(
projects,
testClasses,
Seq.empty,
None,
None,
state,
ioScheduler,
Seq.empty,
scalaInstance.version
)
Right(
new TestSuiteDebugAdapter(
projects,
testClasses,
Seq.empty,
None,
None,
state,
ioScheduler,
Seq.empty,
project.scalaInstance.map(_.version)
)
}
)

}
}

def forAttachRemote(
state: State,
ioScheduler: Scheduler,
projects: Seq[Project]
): Either[String, DebuggeeRunner] = {
): DebuggeeRunner = {
projects match {
case Seq(project) if project.platform.isInstanceOf[Platform.Jvm] =>
val Platform.Jvm(config, _, _, _, _, _) = project.platform
val classPathEntries = getClassPathEntries(state, project)
val javaRuntime = JavaRuntime(config.javaHome.underlying)
val evaluationClassLoader = getEvaluationClassLoader(project, state)
val classpath = getClasspath(state, project)
project.scalaInstance.fold[Either[String, DebuggeeRunner]](noScalaVersion) {
scalaInstance =>
Right(
new AttachRemoteDebugAdapter(
classPathEntries,
javaRuntime,
evaluationClassLoader,
state,
ioScheduler,
classpath,
scalaInstance.version
)
)
}
new AttachRemoteDebugAdapter(
classPathEntries,
javaRuntime,
evaluationClassLoader,
state,
ioScheduler,
classpath,
project.scalaInstance.map(_.version)
)
case projects =>
projects.headOption
.flatMap(_.scalaInstance)
.fold[Either[String, DebuggeeRunner]](noScalaVersion) { scalaInstance =>
Right(
new AttachRemoteDebugAdapter(
Seq.empty,
None,
None,
state,
ioScheduler,
Seq.empty,
scalaInstance.version
)
)
}
new AttachRemoteDebugAdapter(
Seq.empty,
None,
None,
state,
ioScheduler,
Seq.empty,
projects.headOption.flatMap(_.scalaInstance).map(_.version)
)
}
}

4 changes: 2 additions & 2 deletions frontend/src/test/scala/bloop/dap/DebugServerSpec.scala
Original file line number Diff line number Diff line change
@@ -547,7 +547,7 @@ object DebugServerSpec extends DebugBspBaseSuite {
val `Main.scala` = srcFor("Main.scala")
val breakpoints = breakpointsArgs(`Main.scala`, 3)

val Right(attachRemoteProcessRunner) =
val attachRemoteProcessRunner =
BloopDebuggeeRunner.forAttachRemote(
state.compile(project).toTestState.state,
defaultScheduler,
@@ -755,7 +755,7 @@ object DebugServerSpec extends DebugBspBaseSuite {
val `Main.scala` = srcFor("Main.scala")
val breakpoints = breakpointsArgs(`Main.scala`, 4)

val Right(attachRemoteProcessRunner) =
val attachRemoteProcessRunner =
BloopDebuggeeRunner.forAttachRemote(
testState.state,
defaultScheduler,
22 changes: 22 additions & 0 deletions notes/v1.5.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# bloop `v1.5.2`

Bloop v1.5.2 is a bugfix release, a follow up for 1.5.1, which fixes an issue of
running applications in a Java only projects.

## Installing Bloop

For more details about installing Bloop, please see
[Bloop's Installation Guide](https://scalacenter.github.io/bloop/setup))

## Merged pull requests

Here's a list of pull requests that were merged:

- Bugfix: Allow to run using DAP in Java only projects [#1745]

[#1745]: https://github.com/scalacenter/bloop/pull/1745

## Contributors

According to `git shortlog -sn --no-merges v1.5.1..v1.5.2`, the following people
have contributed to this `v1.5.2` release: Tomasz Godzik.