scalacenter / bloop

Bloop is a build server and CLI tool to compile, test and run Scala fast from any editor or build tool.
https://scalacenter.github.io/bloop/
Apache License 2.0
901 stars 202 forks source link

Unexpected `NullPointerException` in `ScalaInstance.scala` #1142

Closed jypma closed 4 years ago

jypma commented 4 years ago

When trying to run bloop test on an SBT-built mostly-java project (ts-reaktive):

However I'm unsure what's really going on, since I do recall having used bloop on Java/SBT projects with previous versions, even having ran JUnit tests...

This is with bloop 1.4.0-RC1.

jvican commented 4 years ago

Thanks for reporting. This is a regression, I'll fix it. /cc @dotta

At the very least this could be a better message

This is not the most friendly way to put that your expectation as a user is a better error message.

jypma commented 4 years ago

Thanks a lot for jumping on this!

This is not the most friendly way to put that your expectation as a user is a better error message.

I apologize if I've offended anyone, that was certainly not my intent. I was expressing expectations of the program, not of any of its creators or contributors. The anthropomorphism obviously was too subtle; again, my apologies for that.

I'll edit the description to the intent is more clear. Thanks for mentioning it.

jvican commented 4 years ago

No worries, no personal offense taken. As a user, I agree with your expectation that NPEs should not leak to the end user. This must be a regression from some of the low level compiler APIs that we use in Bloop.

Could you provide more info about the contents of the configuration file ts-reactive-actors, maybe copy paste it here?

jypma commented 4 years ago

It's open source (MIT license), here is its entire build.sbt, but I can try and copy the relevant details here:

lazy val projectSettings = Seq(
  scalaVersion := "2.12.6",
  crossScalaVersions := Seq("2.12.6"),
  publishMavenStyle := true,
  javacOptions ++= Seq("-source", "1.8"),
  scalacOptions ++= Seq("-target:jvm-1.8"),
  [...]
)

lazy val javaSettings = Seq(
  // This forbids including Scala related libraries into the dependency
  autoScalaLibrary := false,

  // Make this a Java-only project in Eclipse
  EclipseKeys.projectFlavor := EclipseProjectFlavor.Java
)

lazy val `ts-reaktive-actors` = project
  .enablePlugins(ProtobufPlugin)
  .enablePlugins(GitVersioning)
  .settings(commonSettings: _*)
  .settings(javaSettings: _*)
  [...]
  .dependsOn(`ts-reaktive-java`, `ts-reaktive-akka`, `ts-reaktive-testkit` % "test")

I'm guessing the autoScalaLibrary := false may be to blame?

jvican commented 4 years ago

It's a good lead, I'll let you know what I find.

dotta commented 4 years ago

@jvican If this is a regression (as it seems to be), I guess a simple fix is to wrap usage of compilerJar in the supportsHydra impl with an Option. This is how it should have been done already. Happy to push a PR with the change if that helps.