Skip to content

Commit

Permalink
Display if server is a native binary in init message
Browse files Browse the repository at this point in the history
Adds a 'Native Image' entry to the initialization information.
If LemMinX is running as a `native-image` binary, it is set to true.

Closes eclipse#949

Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 committed Jan 4, 2021
1 parent 5908306 commit c645785
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class ServerInfo {

static final String MASTER = "master";

// https:/oracle/graal/blob/master/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SystemPropertiesSupport.java#L97
private static final boolean IS_NATIVE_IMAGE = "Substrate VM".equals(System.getProperty("java.vm.name"));

private ResourceBundle rb = ResourceBundle.getBundle("git");

public ServerInfo() {
Expand Down Expand Up @@ -80,14 +83,19 @@ public String toString() {
* - Java : (path to java.home])
* - Git : ([Branch] short commit id - commit message)
* </pre>
*
*
* @return the formatted server details
*/
public String details() {
StringBuilder details = new StringBuilder();
details.append("LemMinX Server info:");
append(details, "Version", getVersion());
append(details, "Java", getJava());
if (IS_NATIVE_IMAGE) {
append(details, "Native Image", null);
} else {
append(details, "Java", getJava());
}
append(details, "VM Version", System.getProperty("java.vm.version"));
append(details, "Git", null);
String branch = getBranch();
if (!MASTER.equals(branch)) {
Expand All @@ -111,4 +119,4 @@ private void append(StringBuilder sb, String key, String value){
.append(value);
}
}
}
}

0 comments on commit c645785

Please sign in to comment.