summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJoseph K. Strauss <joseph.k.strauss@gmail.com>2018-05-30 21:20:12 -0400
committerLi Haoyi <haoyi.sg@gmail.com>2018-05-30 18:20:12 -0700
commit5766840e1978b5db7612020c64d2dd33967175d2 (patch)
tree3476675488f52cbc64a68f3b712b9373f3f51582 /main
parentd093b9770a96524a9dbec66ae1ae8bb7062975cb (diff)
downloadmill-5766840e1978b5db7612020c64d2dd33967175d2.tar.gz
mill-5766840e1978b5db7612020c64d2dd33967175d2.tar.bz2
mill-5766840e1978b5db7612020c64d2dd33967175d2.zip
Fix MILL_CLASSPATH for Windows (#354)
* Use comma as separator in MILL_CLASSPATH There is no need to use environment-specific separator, especially since - other variables are using commas anyway, and - it is not sent to any system-level command * Fix whitespace * Use MILL_CLASSPATH for Windows * Use vm options file for client on windows * Remove overzealous distinct * Clean up unnecessary ceremony
Diffstat (limited to 'main')
-rw-r--r--main/client/src/mill/main/client/MillClientMain.java29
1 files changed, 20 insertions, 9 deletions
diff --git a/main/client/src/mill/main/client/MillClientMain.java b/main/client/src/mill/main/client/MillClientMain.java
index 3ec4f8b0..3857caff 100644
--- a/main/client/src/mill/main/client/MillClientMain.java
+++ b/main/client/src/mill/main/client/MillClientMain.java
@@ -11,25 +11,36 @@ import java.util.*;
public class MillClientMain {
static void initServer(String lockBase, boolean setJnaNoSys) throws IOException,URISyntaxException{
- String[] selfJars = System.getProperty("MILL_CLASSPATH").split(File.pathSeparator);
+ String[] selfJars = System.getProperty("MILL_CLASSPATH").split(",");
- ArrayList<String> l = new java.util.ArrayList<String>();
+ List<String> l = new ArrayList<>();
+ List<String> vmOptions = new ArrayList<>();
l.add("java");
- Properties props = System.getProperties();
- Iterator<String> keys = props.stringPropertyNames().iterator();
- while(keys.hasNext()){
- String k = keys.next();
- if (k.startsWith("MILL_")) l.add("-D" + k + "=" + props.getProperty(k));
+ final Properties props = System.getProperties();
+ for(final String k: props.stringPropertyNames()){
+ if (k.startsWith("MILL_") && !"MILL_CLASSPATH".equals(k)) {
+ vmOptions.add("-D" + k + "=" + props.getProperty(k));
+ }
}
if (setJnaNoSys) {
- l.add("-Djna.nosys=true");
+ vmOptions.add("-Djna.nosys=true");
+ }
+ if(!Util.isWindows){
+ l.addAll(vmOptions);
+ } else {
+ final File vmOptionsFile = new File(lockBase, "vmoptions");
+ try (PrintWriter out = new PrintWriter(vmOptionsFile)) {
+ for(String opt: vmOptions)
+ out.println(opt);
+ }
+ l.add("-XX:VMOptionsFile=" + vmOptionsFile.getCanonicalPath());
}
l.add("-cp");
l.add(String.join(File.pathSeparator, selfJars));
l.add("mill.main.MillServerMain");
l.add(lockBase);
- new java.lang.ProcessBuilder()
+ new ProcessBuilder()
.command(l)
.redirectOutput(new java.io.File(lockBase + "/logs"))
.redirectError(new java.io.File(lockBase + "/logs"))