Skip to content

Commit

Permalink
Merge pull request #14589 from SethTisue/delete-dottyide
Browse files Browse the repository at this point in the history
remove DottyIDE
  • Loading branch information
smarter authored Mar 1, 2022
2 parents eaefd45 + 3c01ded commit fae7c09
Show file tree
Hide file tree
Showing 26 changed files with 53 additions and 5,115 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:

- name: Cmd Tests
run: |
./project/scripts/sbt ";dist/pack; scala3-bootstrapped/compile; scala3-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test;sjsCompilerTests/test ;sbt-test/scripted scala2-compat/* ;configureIDE ;stdlib-bootstrapped/test:run ;stdlib-bootstrapped-tasty-tests/test; scala3-compiler-bootstrapped/scala3CompilerCoursierTest:test"
./project/scripts/sbt ";dist/pack; scala3-bootstrapped/compile; scala3-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test;sjsCompilerTests/test ;sbt-test/scripted scala2-compat/* ;stdlib-bootstrapped/test:run ;stdlib-bootstrapped-tasty-tests/test; scala3-compiler-bootstrapped/scala3CompilerCoursierTest:test"
./project/scripts/cmdTests
./project/scripts/bootstrappedOnlyCmdTests
Expand Down Expand Up @@ -447,7 +447,7 @@ jobs:

- name: Test
run: |
./project/scripts/sbt ";dist/pack ;scala3-bootstrapped/compile ;scala3-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test;sjsCompilerTests/test ;sbt-test/scripted scala2-compat/* ;configureIDE ;stdlib-bootstrapped/test:run ;stdlib-bootstrapped-tasty-tests/test"
./project/scripts/sbt ";dist/pack ;scala3-bootstrapped/compile ;scala3-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test;sjsCompilerTests/test ;sbt-test/scripted scala2-compat/* ;stdlib-bootstrapped/test:run ;stdlib-bootstrapped-tasty-tests/test"
./project/scripts/cmdTests
./project/scripts/bootstrappedOnlyCmdTests
Expand Down
20 changes: 0 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,6 @@ node_modules
.metals/
metals.sbt

# Scala-IDE specific
.scala_dependencies
.cache
.cache-main
.cache-tests
.classpath
.project
.settings
classes/
*/bin/

# Dotty IDE
/.dotty-ide-dev-port
/.dotty-ide-artifact
/.dotty-ide.json

# idea
.idea
.idea_modules
Expand Down Expand Up @@ -79,10 +63,6 @@ compiler/test/debug/Gen.jar
compiler/before-pickling.txt
compiler/after-pickling.txt
bench/compile.txt
*.dotty-ide-version

# The vscode app for testing
vscode-dotty/.vscode-test

community-build/scala3-bootstrapped.version
community-build/sbt-dotty-sbt
Expand Down
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ val sjsJUnitTests = Build.sjsJUnitTests
val sjsCompilerTests = Build.sjsCompilerTests

val `sbt-test` = Build.`sbt-test`
val `vscode-dotty` = Build.`vscode-dotty`

inThisBuild(Build.thisBuildSettings)
inScope(Global)(Build.globalSettings)
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class DottyLanguageServer extends LanguageServer
import lsp4j.jsonrpc.messages.{Either => JEither}
import lsp4j._


private[this] var rootUri: String = _

private[this] var myClient: DottyClient = _
Expand Down Expand Up @@ -646,7 +645,7 @@ class DottyLanguageServer extends LanguageServer
}

object DottyLanguageServer {
/** Configuration file normally generated by the DottyIDEPlugin */

final val IDE_CONFIG_FILE = ".dotty-ide.json"

final val RENAME_OVERRIDDEN_QUESTION = "Do you want to rename the base member, or only this member?"
Expand Down
32 changes: 0 additions & 32 deletions language-server/src/dotty/tools/languageserver/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ import org.eclipse.lsp4j.launch._
import org.eclipse.lsp4j.jsonrpc.Launcher

/** Run the Dotty Language Server.
*
* This is designed to be started from an editor supporting the Language Server
* Protocol, the easiest way to fetch and run this is to use `coursier`:
*
* coursier launch $artifact -M dotty.tools.languageserver.Main -- -stdio
*
* Where $artifact comes from the `.dotty-ide-artifact` file in the current project, this file
* can be created by the DottyIDEPlugin by running `sbt configureIDE`.
*
* See vscode-dotty/ for an example integration of the Dotty Language Server into Visual Studio Code.
*/
object Main {
def main(args: Array[String]): Unit = {
Expand All @@ -34,28 +24,6 @@ object Main {
scala.Console.withOut(scala.Console.err) {
startServer(serverIn, serverOut)
}
case "-client_command" :: clientCommand =>
val serverSocket = new ServerSocket(0)
Runtime.getRuntime().addShutdownHook(new Thread(
new Runnable {
def run: Unit = {
serverSocket.close()
}
}));

println("Starting client: " + clientCommand)
val clientPB = new java.lang.ProcessBuilder(clientCommand: _*)
clientPB.environment.put("DLS_DEV_MODE", "1")

val pw = new PrintWriter("../.dotty-ide-dev-port")
pw.write(serverSocket.getLocalPort.toString)
pw.close()

clientPB.inheritIO().start()

val clientSocket = serverSocket.accept()

startServer(clientSocket.getInputStream, clientSocket.getOutputStream)
case _ =>
Console.err.println("Invalid arguments: expected \"-stdio\" or \"-client_command ...\"")
System.exit(1)
Expand Down
90 changes: 2 additions & 88 deletions project/Build.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import java.io.File
import java.nio.file._

import Process._
import Modes._
import ScaladocGeneration._
import com.jsuereth.sbtpgp.PgpKeys
Expand All @@ -16,8 +17,6 @@ import xerial.sbt.pack.PackPlugin
import xerial.sbt.pack.PackPlugin.autoImport._
import xerial.sbt.Sonatype.autoImport._
import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._
import dotty.tools.sbtplugin.DottyIDEPlugin.{installCodeExtension, prepareCommand, runProcess}
import dotty.tools.sbtplugin.DottyIDEPlugin.autoImport._
import org.scalajs.sbtplugin.ScalaJSPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbtbuildinfo.BuildInfoPlugin
Expand Down Expand Up @@ -52,10 +51,6 @@ object DottyJSPlugin extends AutoPlugin {

// Typecheck the Scala.js IR found on the classpath
scalaJSLinkerConfig ~= (_.withCheckIR(true)),

// Exclude all these projects from `configureIDE/launchIDE` since they
// take time to compile, print a bunch of warnings, and are rarely edited.
excludeFromIDE := true
)
}

Expand Down Expand Up @@ -154,9 +149,6 @@ object Build {
// Compiles the documentation and static site
val genDocs = inputKey[Unit]("run scaladoc to generate static documentation site")

// Only available in vscode-dotty
val unpublish = taskKey[Unit]("Unpublish a package")

// Settings used to configure the test language server
val ideTestsCompilerVersion = taskKey[String]("Compiler version to use in IDE tests")
val ideTestsCompilerArguments = taskKey[Seq[String]]("Compiler arguments to use in IDE tests")
Expand All @@ -183,11 +175,6 @@ object Build {

(Compile / compile / javacOptions) ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"),

// Override `runCode` from DottyIDEPlugin to use the language-server and
// vscode extension from the source repository of dotty instead of a
// published version.
runCode := (`scala3-language-server` / run).toTask("").value,

// Avoid various sbt craziness involving classloaders and parallelism
run / fork := true,
Test / fork := true,
Expand Down Expand Up @@ -285,7 +272,6 @@ object Build {
crossPaths := false,
// Do not depend on the Scala library
autoScalaLibrary := false,
excludeFromIDE := true,
disableDocSetting
)

Expand Down Expand Up @@ -315,7 +301,6 @@ object Build {

version := dottyNonBootstrappedVersion,
scalaVersion := referenceVersion,
excludeFromIDE := true,

disableDocSetting
)
Expand Down Expand Up @@ -1033,23 +1018,6 @@ object Build {
// Work around https://github.com/eclipse/lsp4j/issues/295
dependencyOverrides += "org.eclipse.xtend" % "org.eclipse.xtend.lib" % "2.16.0",
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,

run := Def.inputTaskDyn {
val inputArgs = spaceDelimited("<arg>").parsed

val mainClass = "dotty.tools.languageserver.Main"
val extensionPath = (`vscode-dotty` / baseDirectory).value.getAbsolutePath

val codeArgs =
s"--extensionDevelopmentPath=$extensionPath" +:
(if (inputArgs.isEmpty) List((baseDirectory.value / "..").getAbsolutePath) else inputArgs)

val clientCommand = prepareCommand(codeCommand.value ++ codeArgs)

val allArgs = "-client_command" +: clientCommand

runTask(Runtime, mainClass, allArgs: _*)
}.dependsOn((`vscode-dotty` / Compile / compile)).evaluated
).
settings(
ideTestsCompilerVersion := (`scala3-compiler` / version).value,
Expand Down Expand Up @@ -1456,60 +1424,6 @@ object Build {
).evaluated
)

lazy val `vscode-dotty` = project.in(file("vscode-dotty")).
settings(commonSettings).
settings(
version := "0.1.17-snapshot", // Keep in sync with package.json
autoScalaLibrary := false,
publishArtifact := false,
bspEnabled := false,
(Compile / resourceGenerators) += Def.task {
// Resources that will be copied when bootstrapping a new project
val buildSbtFile = baseDirectory.value / "out" / "build.sbt"
IO.write(buildSbtFile,
s"""scalaVersion := "$publishedDottyVersion"""")
val dottyPluginSbtFile = baseDirectory.value / "out" / "scala3-plugin.sbt"
IO.write(dottyPluginSbtFile,
s"""addSbtPlugin("$dottyOrganization" % "sbt-dotty" % "$sbtDottyVersion")""")
Seq(buildSbtFile, dottyPluginSbtFile)
},
Compile / compile := Def.task {
val workingDir = baseDirectory.value
val coursier = workingDir / "out" / "coursier"
val packageJson = workingDir / "package.json"
if (!coursier.exists || packageJson.lastModified > coursier.lastModified)
runProcess(Seq("npm", "install"), wait = true, directory = Some(workingDir))
val tsc = workingDir / "node_modules" / ".bin" / "tsc"
runProcess(Seq(tsc.getAbsolutePath, "--pretty", "--project", workingDir.getAbsolutePath), wait = true)

// vscode-dotty depends on scala-lang.scala for syntax highlighting,
// this is not automatically installed when starting the extension in development mode
// (--extensionDevelopmentPath=...)
installCodeExtension(codeCommand.value, "scala-lang.scala")

sbt.internal.inc.Analysis.Empty
}.dependsOn((Compile / managedResources)).value,
sbt.Keys.`package`:= {
runProcess(Seq("vsce", "package"), wait = true, directory = Some(baseDirectory.value))

baseDirectory.value / s"dotty-${version.value}.vsix"
},
unpublish := {
runProcess(Seq("vsce", "unpublish"), wait = true, directory = Some(baseDirectory.value))
},
publish := {
runProcess(Seq("vsce", "publish"), wait = true, directory = Some(baseDirectory.value))
},
run := Def.inputTask {
val inputArgs = spaceDelimited("<arg>").parsed
val codeArgs = if (inputArgs.isEmpty) List((baseDirectory.value / "..").getAbsolutePath) else inputArgs
val extensionPath = baseDirectory.value.getAbsolutePath
val processArgs = List(s"--extensionDevelopmentPath=$extensionPath") ++ codeArgs

runProcess(codeCommand.value ++ processArgs, wait = true)
}.dependsOn((Compile / compile)).evaluated
)

lazy val `sbt-community-build` = project.in(file("sbt-community-build")).
enablePlugins(SbtPlugin).
settings(commonSettings).
Expand Down Expand Up @@ -1902,4 +1816,4 @@ object ScaladocConfigs {
.add(ApiSubdirectory(true))
.withTargets(roots)
}
}
}
Loading

0 comments on commit fae7c09

Please sign in to comment.