Skip to content

Commit

Permalink
Merge pull request #379 from olafurpg/scala-2.12.8
Browse files Browse the repository at this point in the history
Update to 2.12.8
  • Loading branch information
olafurpg authored Dec 7, 2018
2 parents ac36deb + d136bff commit 418cc1e
Show file tree
Hide file tree
Showing 17 changed files with 191 additions and 166 deletions.
12 changes: 5 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import java.io.File
def localSnapshotVersion = "0.2.3-SNAPSHOT"
def localSnapshotVersion = "0.4.0-SNAPSHOT"
inThisBuild(
List(
version ~= { dynVer =>
Expand Down Expand Up @@ -89,7 +88,7 @@ commands += Command.command("save-expect") { s =>
lazy val V = new {
val scala210 = "2.10.7"
val scala211 = "2.11.12"
val scala212 = "2.12.7"
val scala212 = "2.12.8"
val scalameta = "4.1.0"
val semanticdb = "4.1.0"
val bsp = "2.0.0-M2"
Expand All @@ -98,8 +97,8 @@ lazy val V = new {
// List of supported Scala versions in SemanticDB. Needs to be manually updated
// for every SemanticDB upgrade.
def supportedScalaVersions = Seq(
"2.12.7", "2.12.6", "2.12.5", "2.12.4", "2.11.12", "2.11.11", "2.11.10",
"2.11.9"
"2.12.8", "2.12.7", "2.12.6", "2.12.5", "2.12.4", "2.11.12", "2.11.11",
"2.11.10", "2.11.9"
)
}

Expand Down Expand Up @@ -276,8 +275,7 @@ lazy val docs = project
moduleName := "metals-docs",
mainClass.in(Compile) := Some("docs.Docs"),
libraryDependencies ++= List(
"org.jsoup" % "jsoup" % "1.11.3",
"com.geirsson" % "mdoc" % "0.6.1" cross CrossVersion.full
"org.jsoup" % "jsoup" % "1.11.3"
)
)
.dependsOn(metals)
Expand Down
38 changes: 23 additions & 15 deletions metals-docs/src/main/scala/docs/TextEditorModifier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,42 @@ class TextEditorModifier extends StringModifier {
s"""
|## Importing a build
|
|The first time you open Metals in a new sbt build it prompts you to "Import
|build via Bloop". Click "Import build via Bloop" to start the `sbt bloopInstall`
|import step.
|The first time you open Metals in a new workspace it prompts you to import the build.
|Click "Import build" to start the installation step.
|
|![Import build](../assets/$editor-import-via-bloop.png)
|![Import build](../assets/$editor-import-build.png)
|
|- you don't need Bloop installed on your machine to run this step.
|- this step is required for compile errors and goto definition to work.
|
|The `sbt bloopInstall` step can take a long time, especially the first time you
|run it in a new build. The exact time depends on the complexity of the build and
|if library dependencies are cached or need to be downloaded. For example, this
|step can take everything from 10 seconds in small cached builds up to 10-15
|minutes in large uncached builds.
|- "Not now" disables this prompt for 2 minutes.
|- "Don't show again" disables this prompt forever, use `rm -rf .metals/` to re-enable
| the prompt.
|- Behind the scenese, Metals uses [Bloop](https://scalacenter.github.io/bloop/) to
| import sbt builds, but you don't need Bloop installed on your machine to run this step.
|
|Once the import step completes, compilation starts for your open `*.scala`
|files.
|
|Once the sources have compiled successfully, you can navigate the codebase with
|"goto definition" by `Cmd+Click` or `Cmd+Shift+Enter`.
|"goto definition" with `Cmd+Click`.
|
|### Speeding up import
|
|The "Import build" step can take a long time, especially the first time you
|run it in a new build. The exact time depends on the complexity of the build and
|if library dependencies need to be downloaded. For example, this step can take
|everything from 10 seconds in small cached builds up to 10-15 minutes in large
|uncached builds.
|
|Consult the [Bloop documentation](https://scalacenter.github.io/bloop/docs/build-tools/sbt#speeding-up-build-export)
|to learn how to speed up build import.
|
|### Importing changes
|
|When you change `build.sbt` or sources under `project/`, you will be prompted to
|re-import the build.
|
|![Import sbt changes](assets/$editor-import-changes.png)
|
|Click "Import changes" and that will restart the `sbt bloopInstall` step. Select
|"Don't show again" if you prefer to manually trigger build import.
|### Manually trigger build import
|
|To manually trigger a build import, execute the "Import build" command through
|the command palette (`Cmd + Shift + P`).
Expand Down
19 changes: 15 additions & 4 deletions metals/src/main/resources/bloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,10 +1038,21 @@ def main():
java_cmd = ["java"] + cmd_args + ["-jar", server_location]
check_call(java_cmd)
except CalledProcessError as e:
print("Bloop server in %s failed to run." % server_location)
print("Command: %s" % e.cmd)
print("Return code: %d" % e.returncode)
sys.exit(e.returncode)
# The binary may be executable directly under certain package managers such as Nix
# Try running it without `java` and ignore previous error if so
try:
if cmd_args:
print("Java arguments are ignored, " + server_location + " deemed to be a binary instead of a jar.")
check_call([server_location])
except CallProcessError as e2:
print("Bloop server in %s failed to run." % server_location)
print("First invocation attempt: %s" % e.cmd)
print("-> Return code: %d" % e.returncode)
print("Second invocation attempt: %s" % e2.cmd)
print("-> Return code: %d" % e2.returncode)

# Only use the return code of the first attempt
sys.exit(e.returncode)
except KeyboardInterrupt as e:
sys.exit(0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,23 @@ final class BloopInstall(
tables.sbtDigests.setStatus(digest, Status.Requested)
if (buildTools.isBloop) {
languageClient
.showMessageRequest(ReimportSbtProject.params)
.showMessageRequest(ImportBuildChanges.params)
.asScala
.map { item =>
if (item == dontShowAgain) {
notification.dismissForever()
}
Confirmation.fromBoolean(item == ReimportSbtProject.yes)
Confirmation.fromBoolean(item == ImportBuildChanges.yes)
}
} else {
languageClient
.showMessageRequest(ImportBuildViaBloop.params)
.showMessageRequest(ImportBuild.params)
.asScala
.map { item =>
if (item == dontShowAgain) {
notification.dismissForever()
}
Confirmation.fromBoolean(item == ImportBuildViaBloop.yes)
Confirmation.fromBoolean(item == ImportBuild.yes)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import java.nio.file.Files
import java.nio.file.Paths
import java.util.Collections
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
import org.eclipse.lsp4j.DiagnosticSeverity
import org.eclipse.lsp4j.PublishDiagnosticsParams
Expand Down Expand Up @@ -165,22 +164,18 @@ final class InteractiveSemanticdbs(
} yield newGlobal(scalacOptions)
}

val pendingNotification = new AtomicBoolean(false)
private def reportUnsupportedScalaVersion(scalaVersion: String): Unit = {
statusBar.addMessage(Only212Navigation.statusBar(scalaVersion))
val notification = tables.dismissedNotifications.Only212Navigation
if (!notification.isDismissed &&
pendingNotification.compareAndSet(false, true)) {
if (!notification.isDismissed) {
notification.dismiss(2, TimeUnit.MINUTES)
client
.showMessageRequest(Only212Navigation.params(scalaVersion))
.asScala
.foreach { item =>
if (item == Only212Navigation.dismissForever) {
notification.dismissForever()
} else if (item == Only212Navigation.ok) {
notification.dismiss(1, TimeUnit.DAYS)
}
pendingNotification.set(false)
}
}
}
Expand Down
15 changes: 9 additions & 6 deletions metals/src/main/scala/scala/meta/internal/metals/Messages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,38 @@ class Messages(icons: Icons) {

def dontShowAgain: MessageActionItem =
new MessageActionItem("Don't show again")
object ReimportSbtProject {
def notNow: MessageActionItem =
new MessageActionItem("Not now")
object ImportBuildChanges {
def yes: MessageActionItem =
new MessageActionItem("Import changes")
def params: ShowMessageRequestParams = {
val params = new ShowMessageRequestParams()
params.setMessage("sbt projects need to be imported")
params.setMessage("sbt build needs to be re-imported")
params.setType(MessageType.Info)
params.setActions(
List(
yes,
notNow,
dontShowAgain
).asJava
)
params
}
}

object ImportBuildViaBloop {
def yes = new MessageActionItem("Import build via Bloop")
object ImportBuild {
def yes = new MessageActionItem("Import build")
def params: ShowMessageRequestParams = {
val params = new ShowMessageRequestParams()
params.setMessage(
"sbt build detected, would you like to import via Bloop? " +
"You don't need Bloop installed on your machine to run this step."
"New sbt workspace detected, would you like to import the build?"
)
params.setType(MessageType.Info)
params.setActions(
List(
yes,
notNow,
dontShowAgain
).asJava
)
Expand Down
4 changes: 3 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.2")
addSbtPlugin("com.geirsson" % "sbt-docusaurus" % "0.3.4")
addSbtPlugin("com.geirsson" % "sbt-docusaurus" % "0.3.5")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")

addSbtCoursier

libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value

resolvers += Resolver.sonatypeRepo("releases")
Empty file removed test-workspace/.dotty-ide-artifact
Empty file.
3 changes: 1 addition & 2 deletions test-workspace/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
inThisBuild(Vector(
scalaVersion := "2.12.7",
scalaVersion := "2.12.8",
scalacOptions ++= List(
"-Yrangepos", "-Ywarn-unused"
),
Expand All @@ -12,4 +12,3 @@ libraryDependencies ++= List(
"com.lihaoyi" %% "sourcecode" % "0.1.4",
"org.scalatest" %% "scalatest" % "3.0.5"
)

Loading

0 comments on commit 418cc1e

Please sign in to comment.