From ed48bcdd96c3e465d76bac93591b53a54a3d9eb3 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 19 May 2018 23:30:22 -0700 Subject: Preserve caches between interactive and client/server mode (#342) We were incorrectly duplicating the JDK classpath as part of the application classpath when we spawned the Mill server from the Mill client. This makes the transmission of application classpath to the Mill server explicit via an environment variable, so we don't end up including random things from the client classloader hierarchy that we didn't expect --- build.sc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'build.sc') diff --git a/build.sc b/build.sc index 7f0f6e10..f5b61d4c 100755 --- a/build.sc +++ b/build.sc @@ -316,7 +316,10 @@ object dev extends MillModule{ val classpath = runClasspath().map(_.path.toString) val args = forkArgs().distinct val (shellArgs, cmdArgs) = - if (!scala.util.Properties.isWin) (args, args) + if (!scala.util.Properties.isWin) ( + Seq("-DMILL_CLASSPATH=" + classpath.mkString(":")) ++ args, + Seq("-DMILL_CLASSPATH=" + classpath.mkString(";")) ++ args + ) else ( Seq("""-XX:VMOptionsFile="$( dirname "$0" )"/mill.vmoptions"""), Seq("""-XX:VMOptionsFile=%~dp0\mill.vmoptions""") @@ -345,6 +348,7 @@ def release = T{ val dest = T.ctx().dest val filename = if (scala.util.Properties.isWin) "mill.bat" else "mill" val args = Seq( + "-DMILL_CLASSPATH=$0", "-DMILL_VERSION=" + publishVersion()._2, // Workaround for Zinc/JNA bug // https://github.com/sbt/sbt/blame/6718803ee6023ab041b045a6988fafcfae9d15b5/main/src/main/scala/sbt/Main.scala#L130 -- cgit v1.2.3