From 7f89bfaeca11f5989c6728f03d2940af4b66878d Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 6 Jun 2017 10:55:31 +0200 Subject: [PATCH 1/7] Merge prepareIDE with configureIDE In the next commit we'll extend configureIDE to work even when it needs to update some settings to set the scalaVersion to Dotty. Since this update takes some time and is discarded at the end of the task, it makes sense to run the configuration and compilation steps in the same task to avoid having to do the settings update twice. --- project/Build.scala | 4 ++-- .../dotty/tools/sbtplugin/DottyIDEPlugin.scala | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 2dc8ea68b101..687df46a1557 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -94,7 +94,7 @@ object Build { // Override `launchIDE` from sbt-dotty to use the language-server and // vscode extension from the source repository of dotty instead of a // published version. - launchIDE := (run in `dotty-language-server`).dependsOn(prepareIDE).toTask("").value + launchIDE := (run in `dotty-language-server`).dependsOn(configureIDE).toTask("").value ) // Only available in vscode-dotty @@ -882,7 +882,7 @@ object Build { sbtPlugin := true, - version := "0.1.1", + version := "0.1.2-SNAPSHOT", ScriptedPlugin.scriptedSettings, ScriptedPlugin.sbtTestDirectory := baseDirectory.value / "sbt-test", ScriptedPlugin.scriptedBufferLog := false, diff --git a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala index bb2a1227f97b..512ce30e31dc 100644 --- a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala +++ b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala @@ -44,12 +44,11 @@ object DottyIDEPlugin extends AutoPlugin { } private val projectConfig = taskKey[Option[ProjectConfig]]("") - private val configureIDE = taskKey[Unit]("Generate IDE config files") private val compileForIDE = taskKey[Unit]("Compile all projects supported by the IDE") private val runCode = taskKey[Unit]("") object autoImport { - val prepareIDE = taskKey[Unit]("Prepare for IDE launch") + val configureIDE = taskKey[Unit]("Generate IDE config files") val launchIDE = taskKey[Unit]("Run Visual Studio Code on this project") } @@ -64,6 +63,11 @@ object DottyIDEPlugin extends AutoPlugin { Def.derive(projectConfig := { if (sources.value.isEmpty) None else { + // Not needed to generate the config, but this guarantees that the + // generated config is usable by an IDE without any extra compilation + // step. + val _ = compile.value + val id = s"${thisProject.value.id}/${configuration.value.name}" val compilerVersion = scalaVersion.value .replace("-nonbootstrapped", "") // The language server is only published bootstrapped @@ -135,11 +139,6 @@ object DottyIDEPlugin extends AutoPlugin { .start() }, - prepareIDE := { - val x1 = configureIDE.value - val x2 = compileForIDE.value - }, - - launchIDE := runCode.dependsOn(prepareIDE).value + launchIDE := runCode.dependsOn(configureIDE).value ) } From 9b086b6082e0dcdbc0c01cdc3116646983ba752e Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 6 Jun 2017 10:58:20 +0200 Subject: [PATCH 2/7] Make configureIDE work with crossScalaVersions So far, configureIDE detected the dotty-compiled projects by looking at `scalaVersion`, with this commit we now also look at `crossScalaVersions`. This is considerably harder to do since extracting the settings requires updating `scalaVersion` in all projects where it's not set to a dotty version but `crossScalaVersion` is, moreover this update needs to be temporary: once the `configureIDE` task is done, the state should revert to the original one. --- .../tools/sbtplugin/DottyIDEPlugin.scala | 156 +++++++++++++----- 1 file changed, 119 insertions(+), 37 deletions(-) diff --git a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala index 512ce30e31dc..91a6493d243d 100644 --- a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala +++ b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala @@ -14,7 +14,7 @@ import DottyPlugin.autoImport._ object DottyIDEPlugin extends AutoPlugin { // Adapted from scala-reflect - private[this] def distinctBy[A, B](xs: Seq[A])(f: A => B): Seq[A] = { + private def distinctBy[A, B](xs: Seq[A])(f: A => B): Seq[A] = { val buf = new mutable.ListBuffer[A] val seen = mutable.Set[B]() xs foreach { x => @@ -27,20 +27,102 @@ object DottyIDEPlugin extends AutoPlugin { buf.toList } - private def inAllDottyConfigurations[A](key: TaskKey[A], state: State): Task[Seq[A]] = { - val struct = Project.structure(state) - val settings = struct.data - struct.allProjectRefs.flatMap { projRef => - val project = Project.getProjectForReference(projRef, struct).get + private def isDottyVersion(version: String) = + version.startsWith("0.") + + + /** Return a new state derived from `state` such that scalaVersion returns `newScalaVersion` in all + * projects in `projRefs` (`state` is returned if no setting needed to be updated). + */ + private def updateScalaVersion(state: State, projRefs: Seq[ProjectRef], newScalaVersion: String): State = { + val extracted = Project.extract(state) + val settings = extracted.structure.data + + if (projRefs.forall(projRef => scalaVersion.in(projRef).get(settings).get == newScalaVersion)) + state + else { + def matchingSetting(setting: Setting[_]) = + setting.key.key == scalaVersion.key && + setting.key.scope.project.fold(ref => projRefs.contains(ref), ifGlobal = true, ifThis = true) + + val newSettings = extracted.session.mergeSettings.collect { + case setting if matchingSetting(setting) => + scalaVersion in setting.key.scope := newScalaVersion + } + val newSession = extracted.session.appendRaw(newSettings) + BuiltinCommands.reapply(newSession, extracted.structure, state) + } + } + + /** Setup to run in all dotty projects. + * Return a triplet of: + * (1) A version of dotty + * (2) A list of dotty projects + * (3) A state where `scalaVersion` is set to (1) in all projects in (2) + */ + private def dottySetup(state: State): (String, Seq[ProjectRef], State) = { + val structure = Project.structure(state) + val settings = structure.data + + // FIXME: this function uses `sorted` to order versions but this is incorrect, + // we need an Ordering for version numbers, like the one in Coursier. + + val (dottyVersions, dottyProjRefs) = + structure.allProjectRefs.flatMap { projRef => + val version = scalaVersion.in(projRef).get(settings).get + if (isDottyVersion(version)) + Some((version, projRef)) + else + crossScalaVersions.in(projRef).get(settings).get.filter(isDottyVersion).sorted.lastOption match { + case Some(v) => + Some((v, projRef)) + case _ => + None + } + }.unzip + + if (dottyVersions.isEmpty) + throw new FeedbackProvidedException { + override def toString = "No Dotty project detected" + } + else { + val dottyVersion = dottyVersions.sorted.last + val dottyState = updateScalaVersion(state, dottyProjRefs, dottyVersion) + (dottyVersion, dottyProjRefs, dottyState) + } + } + + /** Run `task` in state `state` */ + private def runTask[T](task: Task[T], state: State): T = { + val extracted = Project.extract(state) + val structure = extracted.structure + val (_, result) = + EvaluateTask.withStreams(structure, state) { streams => + EvaluateTask.runTask(task, state, streams, structure.index.triggers, + EvaluateTask.extractedTaskConfig(extracted, structure, state))( + EvaluateTask.nodeView(state, streams, Nil) + ) + } + result match { + case Value(v) => + v + case Inc(i) => + throw i + } + } + + /** Run task `key` in all configurations in all projects in `projRefs`, using state `state` */ + private def runInAllConfigurations[T](key: TaskKey[T], projRefs: Seq[ProjectRef], state: State): Seq[T] = { + val structure = Project.structure(state) + val settings = structure.data + val joinedTask = projRefs.flatMap { projRef => + val project = Project.getProjectForReference(projRef, structure).get project.configurations.flatMap { config => - isDotty.in(projRef, config).get(settings) match { - case Some(true) => - key.in(projRef, config).get(settings) - case _ => - None - } + key.in(projRef, config).get(settings) } }.join + + runTask(joinedTask, state) } private val projectConfig = taskKey[Option[ProjectConfig]]("") @@ -57,6 +139,7 @@ object DottyIDEPlugin extends AutoPlugin { override def requires: Plugins = plugins.JvmPlugin override def trigger = allRequirements + override def projectSettings: Seq[Setting[_]] = Seq( // Use Def.derive so `projectConfig` is only defined in the configurations where the // tasks/settings it depends on are defined. @@ -70,7 +153,6 @@ object DottyIDEPlugin extends AutoPlugin { val id = s"${thisProject.value.id}/${configuration.value.name}" val compilerVersion = scalaVersion.value - .replace("-nonbootstrapped", "") // The language server is only published bootstrapped val compilerArguments = scalacOptions.value val sourceDirectories = unmanagedSourceDirectories.value ++ managedSourceDirectories.value val depClasspath = Attributed.data(dependencyClasspath.value) @@ -89,40 +171,40 @@ object DottyIDEPlugin extends AutoPlugin { ) override def buildSettings: Seq[Setting[_]] = Seq( - configureIDE := { - val log = streams.value.log - - val configs0 = state.flatMap(s => - inAllDottyConfigurations(projectConfig, s) - ).value.flatten - // Drop configurations who do not define their own sources, but just - // inherit their sources from some other configuration. - val configs = distinctBy(configs0)(_.sourceDirectories.deep) - - if (configs.isEmpty) { - log.error("No Dotty project detected") - } else { - // If different versions of Dotty are used by subprojects, choose the latest one - // FIXME: use a proper version number Ordering that knows that "0.1.1-M1" < "0.1.1" - val ideVersion = configs.map(_.compilerVersion).sorted.last + configureIDE := Def.taskDyn { + val origState = state.value + Def.task { + val (dottyVersion, projRefs, dottyState) = dottySetup(origState) + val configs0 = runInAllConfigurations(projectConfig, projRefs, dottyState).flatten + + // Drop configurations that do not define their own sources, but just + // inherit their sources from some other configuration. + val configs = distinctBy(configs0)(_.sourceDirectories.deep) + // Write the version of the Dotty Language Server to use in a file by itself. // This could be a field in the JSON config file, but that would require all // IDE plugins to parse JSON. + val dlsVersion = dottyVersion + .replace("-nonbootstrapped", "") // The language server is only published bootstrapped + val dlsBinaryVersion = dlsVersion.split("\\.").take(2).mkString(".") val pwArtifact = new PrintWriter(".dotty-ide-artifact") - pwArtifact.println(s"ch.epfl.lamp:dotty-language-server_0.1:${ideVersion}") + pwArtifact.println(s"ch.epfl.lamp:dotty-language-server_${dlsBinaryVersion}:${dlsVersion}") pwArtifact.close() val mapper = new ObjectMapper mapper.writerWithDefaultPrettyPrinter() .writeValue(new File(".dotty-ide.json"), configs.toArray) } - }, - - compileForIDE := { - val _ = state.flatMap(s => - inAllDottyConfigurations(compile, s) - ).value - }, + }.value, + + compileForIDE := Def.taskDyn { + val origState = state.value + Def.task { + val (dottyVersion, projRefs, dottyState) = dottySetup(origState) + runInAllConfigurations(compile, projRefs, dottyState) + () + } + }.value, runCode := { val exitCode = new ProcessBuilder("code", "--install-extension", "lampepfl.dotty") From ba33872ae40e6e98a5829d2e518b6ff3209d297c Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 6 Jun 2017 11:03:07 +0200 Subject: [PATCH 3/7] Update dottyLatestNightlyBuild to fetch dotty 0.2 --- sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala b/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala index ed53d537c43e..ce916a6e6ba0 100644 --- a/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala +++ b/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala @@ -14,10 +14,10 @@ object DottyPlugin extends AutoPlugin { // - if this was a settingKey, then this would evaluate even if you don't use it. def dottyLatestNightlyBuild: Option[String] = { println("Fetching latest Dotty nightly version (requires an internet connection)...") - val Version = """ (0.1\..*-bin.*)""".r + val Version = """ (0.2\..*-bin.*)""".r val latest = scala.io.Source .fromURL( - "http://repo1.maven.org/maven2/ch/epfl/lamp/dotty_0.1/maven-metadata.xml") + "http://repo1.maven.org/maven2/ch/epfl/lamp/dotty_0.2/maven-metadata.xml") .getLines() .collect { case Version(version) => version } .toSeq From f4960d14d331018f7d2a809751a6a3cb150520bb Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 6 Jun 2017 23:25:44 +0200 Subject: [PATCH 4/7] Use MessageOnlyException instead of FeedbackProvidedException --- project/Build.scala | 28 +++++-------------- .../tools/sbtplugin/DottyIDEPlugin.scala | 8 ++---- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 687df46a1557..600f2585c2ca 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -920,9 +920,7 @@ object Build { .start() .waitFor() if (exitCode != 0) - throw new FeedbackProvidedException { - override def toString = "'npm run update-all' in vscode-dotty failed" - } + throw new MessageOnlyException("'npm run update-all' in vscode-dotty failed") } val tsc = baseDirectory.value / "node_modules" / ".bin" / "tsc" val exitCodeTsc = new java.lang.ProcessBuilder(tsc.getAbsolutePath, "--pretty", "--project", baseDirectory.value.getAbsolutePath) @@ -930,9 +928,7 @@ object Build { .start() .waitFor() if (exitCodeTsc != 0) - throw new FeedbackProvidedException { - override def toString = "tsc in vscode-dotty failed" - } + throw new MessageOnlyException("tsc in vscode-dotty failed") // Currently, vscode-dotty depends on daltonjorge.scala for syntax highlighting, // this is not automatically installed when starting the extension in development mode @@ -942,9 +938,7 @@ object Build { .start() .waitFor() if (exitCodeInstall != 0) - throw new FeedbackProvidedException { - override def toString = "Installing dependency daltonjorge.scala failed" - } + throw new MessageOnlyException("Installing dependency daltonjorge.scala failed") sbt.inc.Analysis.Empty }, @@ -955,9 +949,7 @@ object Build { .start() .waitFor() if (exitCode != 0) - throw new FeedbackProvidedException { - override def toString = "vsce package failed" - } + throw new MessageOnlyException("vsce package failed") baseDirectory.value / s"dotty-${version.value}.vsix" }, @@ -968,9 +960,7 @@ object Build { .start() .waitFor() if (exitCode != 0) - throw new FeedbackProvidedException { - override def toString = "vsce unpublish failed" - } + throw new MessageOnlyException("vsce unpublish failed") }, publish := { val exitCode = new java.lang.ProcessBuilder("vsce", "publish") @@ -979,9 +969,7 @@ object Build { .start() .waitFor() if (exitCode != 0) - throw new FeedbackProvidedException { - override def toString = "vsce publish failed" - } + throw new MessageOnlyException("vsce publish failed") }, run := Def.inputTask { val inputArgs = spaceDelimited("").parsed @@ -994,9 +982,7 @@ object Build { .start() .waitFor() if (exitCode != 0) - throw new FeedbackProvidedException { - override def toString = "Running Visual Studio Code failed" - } + throw new MessageOnlyException("Running Visual Studio Code failed") }.dependsOn(compile in Compile).evaluated ) diff --git a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala index 91a6493d243d..b708b19efdef 100644 --- a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala +++ b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala @@ -82,9 +82,7 @@ object DottyIDEPlugin extends AutoPlugin { }.unzip if (dottyVersions.isEmpty) - throw new FeedbackProvidedException { - override def toString = "No Dotty project detected" - } + throw new MessageOnlyException("No Dotty project detected") else { val dottyVersion = dottyVersions.sorted.last val dottyState = updateScalaVersion(state, dottyProjRefs, dottyVersion) @@ -212,9 +210,7 @@ object DottyIDEPlugin extends AutoPlugin { .start() .waitFor() if (exitCode != 0) - throw new FeedbackProvidedException { - override def toString = "Installing the Dotty support for VSCode failed" - } + throw new MessageOnlyException("Installing the Dotty support for VSCode failed") new ProcessBuilder("code", baseDirectory.value.getAbsolutePath) .inheritIO() From 34b04d43504b4ad96ddeaafbbb93337192080b28 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 6 Jun 2017 23:27:43 +0200 Subject: [PATCH 5/7] Be more paranoid about closing files --- sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala index b708b19efdef..4eacea0ca3bf 100644 --- a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala +++ b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala @@ -186,8 +186,11 @@ object DottyIDEPlugin extends AutoPlugin { .replace("-nonbootstrapped", "") // The language server is only published bootstrapped val dlsBinaryVersion = dlsVersion.split("\\.").take(2).mkString(".") val pwArtifact = new PrintWriter(".dotty-ide-artifact") - pwArtifact.println(s"ch.epfl.lamp:dotty-language-server_${dlsBinaryVersion}:${dlsVersion}") - pwArtifact.close() + try { + pwArtifact.println(s"ch.epfl.lamp:dotty-language-server_${dlsBinaryVersion}:${dlsVersion}") + } finally { + pwArtifact.close() + } val mapper = new ObjectMapper mapper.writerWithDefaultPrettyPrinter() From bd1df68599b9a7968b76e32569f896a81564fa88 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 6 Jun 2017 23:54:05 +0200 Subject: [PATCH 6/7] configureIDE and compileForIDE are now commands instead of tasks This makes sense since they deal with the state (even if they always return the original state). --- project/Build.scala | 4 +- .../tools/sbtplugin/DottyIDEPlugin.scala | 85 +++++++++---------- 2 files changed, 42 insertions(+), 47 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 600f2585c2ca..96d6c8e1a903 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -91,10 +91,10 @@ object Build { bootstrapFromPublishedJars := false, - // Override `launchIDE` from sbt-dotty to use the language-server and + // Override `runCode` from sbt-dotty to use the language-server and // vscode extension from the source repository of dotty instead of a // published version. - launchIDE := (run in `dotty-language-server`).dependsOn(configureIDE).toTask("").value + runCode := (run in `dotty-language-server`).toTask("").value ) // Only available in vscode-dotty diff --git a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala index 4eacea0ca3bf..1e4226d48aa3 100644 --- a/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala +++ b/sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala @@ -124,12 +124,10 @@ object DottyIDEPlugin extends AutoPlugin { } private val projectConfig = taskKey[Option[ProjectConfig]]("") - private val compileForIDE = taskKey[Unit]("Compile all projects supported by the IDE") - private val runCode = taskKey[Unit]("") object autoImport { - val configureIDE = taskKey[Unit]("Generate IDE config files") - val launchIDE = taskKey[Unit]("Run Visual Studio Code on this project") + val runCode = taskKey[Unit]("Start VSCode, usually called from launchIDE") + val launchIDE = taskKey[Unit]("Configure and run VSCode on this project") } import autoImport._ @@ -137,6 +135,40 @@ object DottyIDEPlugin extends AutoPlugin { override def requires: Plugins = plugins.JvmPlugin override def trigger = allRequirements + def configureIDE = Command.command("configureIDE") { origState => + val (dottyVersion, projRefs, dottyState) = dottySetup(origState) + val configs0 = runInAllConfigurations(projectConfig, projRefs, dottyState).flatten + + // Drop configurations that do not define their own sources, but just + // inherit their sources from some other configuration. + val configs = distinctBy(configs0)(_.sourceDirectories.deep) + + // Write the version of the Dotty Language Server to use in a file by itself. + // This could be a field in the JSON config file, but that would require all + // IDE plugins to parse JSON. + val dlsVersion = dottyVersion + .replace("-nonbootstrapped", "") // The language server is only published bootstrapped + val dlsBinaryVersion = dlsVersion.split("\\.").take(2).mkString(".") + val pwArtifact = new PrintWriter(".dotty-ide-artifact") + try { + pwArtifact.println(s"ch.epfl.lamp:dotty-language-server_${dlsBinaryVersion}:${dlsVersion}") + } finally { + pwArtifact.close() + } + + val mapper = new ObjectMapper + mapper.writerWithDefaultPrettyPrinter() + .writeValue(new File(".dotty-ide.json"), configs.toArray) + + origState + } + + def compileForIDE = Command.command("compileForIDE") { origState => + val (dottyVersion, projRefs, dottyState) = dottySetup(origState) + runInAllConfigurations(compile, projRefs, dottyState) + + origState + } override def projectSettings: Seq[Setting[_]] = Seq( // Use Def.derive so `projectConfig` is only defined in the configurations where the @@ -169,43 +201,7 @@ object DottyIDEPlugin extends AutoPlugin { ) override def buildSettings: Seq[Setting[_]] = Seq( - configureIDE := Def.taskDyn { - val origState = state.value - Def.task { - val (dottyVersion, projRefs, dottyState) = dottySetup(origState) - val configs0 = runInAllConfigurations(projectConfig, projRefs, dottyState).flatten - - // Drop configurations that do not define their own sources, but just - // inherit their sources from some other configuration. - val configs = distinctBy(configs0)(_.sourceDirectories.deep) - - // Write the version of the Dotty Language Server to use in a file by itself. - // This could be a field in the JSON config file, but that would require all - // IDE plugins to parse JSON. - val dlsVersion = dottyVersion - .replace("-nonbootstrapped", "") // The language server is only published bootstrapped - val dlsBinaryVersion = dlsVersion.split("\\.").take(2).mkString(".") - val pwArtifact = new PrintWriter(".dotty-ide-artifact") - try { - pwArtifact.println(s"ch.epfl.lamp:dotty-language-server_${dlsBinaryVersion}:${dlsVersion}") - } finally { - pwArtifact.close() - } - - val mapper = new ObjectMapper - mapper.writerWithDefaultPrettyPrinter() - .writeValue(new File(".dotty-ide.json"), configs.toArray) - } - }.value, - - compileForIDE := Def.taskDyn { - val origState = state.value - Def.task { - val (dottyVersion, projRefs, dottyState) = dottySetup(origState) - runInAllConfigurations(compile, projRefs, dottyState) - () - } - }.value, + commands ++= Seq(configureIDE, compileForIDE), runCode := { val exitCode = new ProcessBuilder("code", "--install-extension", "lampepfl.dotty") @@ -218,8 +214,7 @@ object DottyIDEPlugin extends AutoPlugin { new ProcessBuilder("code", baseDirectory.value.getAbsolutePath) .inheritIO() .start() - }, - - launchIDE := runCode.dependsOn(configureIDE).value - ) + } + + ) ++ addCommandAlias("launchIDE", ";configureIDE;runCode") } From 4d05747e345de88f664a393213ddd7ad3fd116f8 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Tue, 6 Jun 2017 11:04:14 +0200 Subject: [PATCH 7/7] sbt-dotty: Bump version to 0.1.2 --- project/Build.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Build.scala b/project/Build.scala index 96d6c8e1a903..fea9b5496547 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -882,7 +882,7 @@ object Build { sbtPlugin := true, - version := "0.1.2-SNAPSHOT", + version := "0.1.2", ScriptedPlugin.scriptedSettings, ScriptedPlugin.sbtTestDirectory := baseDirectory.value / "sbt-test", ScriptedPlugin.scriptedBufferLog := false,