Skip to content

Commit c38fe80

Browse files
authored
Make --bsp Mill process launch from MillBspMain class (#5896)
This should make the `MillBspMain` processes easier to distinguish from the command line from the `MillDaemonMain` or `MillNoDaemonMain` processes launched by users when you run `jps`. Tested manually via `./mill dist.installLocalCache` and using the new version in a Mill project I load into Intellij. `jps` then shows the `MillBspMain` clearly separate from the other user-created Mill processes: ```console $ jps 4930 MillNoDaemonMain 1717 7063 MillLauncherMain 7080 Jps 5835 MillDaemonMain 749 Main 7070 MillBspMain 4927 NailgunRunner ```
1 parent 084e27b commit c38fe80

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package mill.daemon
2+
3+
object MillBspMain {
4+
def main(args0: Array[String]): Unit = MillNoDaemonMain.main(args0)
5+
}

runner/launcher/src/mill/launcher/MillLauncherMain.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,11 @@ public static void main(String[] args) throws Exception {
8888
});
8989

9090
if (runNoDaemon) {
91+
String mainClass = bspMode ? "mill.daemon.MillBspMain" : "mill.daemon.MillNoDaemonMain";
9192
// start in no-server mode
92-
System.exit(MillProcessLauncher.launchMillNoDaemon(args, outMode, runnerClasspath));
93+
int exitCode =
94+
MillProcessLauncher.launchMillNoDaemon(args, outMode, runnerClasspath, mainClass);
95+
System.exit(exitCode);
9396
} else {
9497
var logs = new java.util.ArrayList<String>();
9598
try {

runner/launcher/src/mill/launcher/MillProcessLauncher.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
public class MillProcessLauncher {
2121

22-
static int launchMillNoDaemon(String[] args, OutFolderMode outMode, String[] runnerClasspath)
22+
static int launchMillNoDaemon(
23+
String[] args, OutFolderMode outMode, String[] runnerClasspath, String mainClass)
2324
throws Exception {
2425
final String sig = String.format("%08x", UUID.randomUUID().hashCode());
2526
final Path processDir =
@@ -29,7 +30,7 @@ static int launchMillNoDaemon(String[] args, OutFolderMode outMode, String[] run
2930
l.addAll(millLaunchJvmCommand(outMode, runnerClasspath));
3031
Map<String, String> propsMap = ClientUtil.getUserSetProperties();
3132
for (String key : propsMap.keySet()) l.add("-D" + key + "=" + propsMap.get(key));
32-
l.add("mill.daemon.MillNoDaemonMain");
33+
l.add(mainClass);
3334
l.add(processDir.toAbsolutePath().toString());
3435
l.add(outMode.asString());
3536
l.addAll(millOpts(outMode));

0 commit comments

Comments
 (0)