From 3205091c5530b41072dc0624a3362809bdadf6ee Mon Sep 17 00:00:00 2001 From: MichaƂ Pociecha Date: Fri, 22 Jul 2016 12:11:55 +0200 Subject: Improve sbt-based IntelliJ integration in case of Windows Use File.pathSeparator when processing classpath instead of just : to don't end up with classpath like "C:\sth\a.jar:C:\sth\b.jar" what was causing problems after split(":"). Display questions first and then wait for user input. I tested on 3 computes and without flush the printed questions were always displayed just after user replied - never before. --- build.sbt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'build.sbt') diff --git a/build.sbt b/build.sbt index 1d4e208da2..e53f15a332 100644 --- a/build.sbt +++ b/build.sbt @@ -936,7 +936,7 @@ intellij := { val modules: List[(String, Seq[File])] = { // for the sbt build module, the dependencies are fetched from the project's build using sbt-buildinfo - val buildModule = ("scala-build", scalabuild.BuildInfo.buildClasspath.split(":").toSeq.map(new File(_))) + val buildModule = ("scala-build", scalabuild.BuildInfo.buildClasspath.split(java.io.File.pathSeparator).toSeq.map(new File(_))) // `sbt projects` lists all modules in the build buildModule :: List( moduleDeps(compilerP).value, @@ -1015,12 +1015,14 @@ intellij := { var continue = false if (!ipr.exists) { scala.Console.print(s"Could not find src/intellij/scala.ipr. Create new project files from src/intellij/*.SAMPLE (y/N)? ") + scala.Console.flush() if (scala.Console.readLine() == "y") { intellijCreateFromSample((baseDirectory in ThisBuild).value) continue = true } } else { scala.Console.print("Update library classpaths in the current src/intellij/scala.ipr (y/N)? ") + scala.Console.flush() continue = scala.Console.readLine() == "y" } if (continue) { @@ -1045,6 +1047,7 @@ lazy val intellijFromSample = taskKey[Unit]("Create fresh IntelliJ project files intellijFromSample := { val s = streams.value scala.Console.print(s"Create new project files from src/intellij/*.SAMPLE (y/N)? ") + scala.Console.flush() if (scala.Console.readLine() == "y") intellijCreateFromSample((baseDirectory in ThisBuild).value) else @@ -1062,6 +1065,7 @@ lazy val intellijToSample = taskKey[Unit]("Update src/intellij/*.SAMPLE using th intellijToSample := { val s = streams.value scala.Console.print(s"Update src/intellij/*.SAMPLE using the current IntelliJ project files (y/N)? ") + scala.Console.flush() if (scala.Console.readLine() == "y") { val basedir = (baseDirectory in ThisBuild).value val existing = basedir / "src/intellij" * "*.SAMPLE" -- cgit v1.2.3