-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Numerous times I wasn't sure when running the IDE if I'm running the bundled engine or a development build. Usually this depends on if I launch the standalone IDE or use a development build of project-manager. Still it's not always obvious, and making sure that your IDE is running the right engine version is very often the first step when debugging issues with e.g. engine changes not showing up properly. Thus I thought it may be worth to add this method (currently hidden to users in component browser by marking as `PRIVATE`, one has to type it in manually): ![image](https://github.com/user-attachments/assets/13af3df4-49ff-49bb-9b19-601258a8ca02) I think it should be a helpful tool for debugging.
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...main/java/org/enso/interpreter/node/expression/builtin/meta/CurrentEngineVersionNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.enso.interpreter.node.expression.builtin.meta; | ||
|
||
import com.oracle.truffle.api.CompilerDirectives; | ||
import com.oracle.truffle.api.nodes.Node; | ||
import org.enso.interpreter.dsl.BuiltinMethod; | ||
import org.enso.interpreter.runtime.data.text.Text; | ||
import org.enso.version.BuildVersion; | ||
|
||
@BuiltinMethod( | ||
type = "Meta", | ||
name = "engine_version", | ||
description = "Returns the version of the currently running Enso engine.", | ||
autoRegister = false) | ||
public class CurrentEngineVersionNode extends Node { | ||
|
||
public Text execute() { | ||
return getCurrentVersion(); | ||
} | ||
|
||
@CompilerDirectives.TruffleBoundary | ||
private Text getCurrentVersion() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("Enso Engine Version: "); | ||
sb.append(BuildVersion.ensoVersion()); | ||
sb.append("\nDefault Edition: "); | ||
sb.append(BuildVersion.currentEdition()); | ||
|
||
sb.append("\nCompiled with GraalVM "); | ||
sb.append(BuildVersion.graalVersion()); | ||
sb.append(", Scalac "); | ||
sb.append(BuildVersion.scalacVersion()); | ||
|
||
sb.append("\nBased on commit "); | ||
sb.append(BuildVersion.commit()); | ||
sb.append(" (at "); | ||
sb.append(BuildVersion.latestCommitDate()); | ||
sb.append(")\non ref "); | ||
sb.append(BuildVersion.ref()); | ||
if (BuildVersion.isDirty()) { | ||
sb.append("\n(with uncommitted changes)"); | ||
} | ||
|
||
return Text.create(sb.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters