DemoBench: enable emoji in the terminal when built with a JetBrains JRE.

This commit is contained in:
Mike Hearn 2017-05-19 12:58:48 +02:00
parent af1a68da67
commit f4321affad
6 changed files with 18 additions and 15 deletions

View File

@ -7,8 +7,12 @@ import net.corda.core.codePointsString
*/
object Emoji {
// Unfortunately only Apple has a terminal that can do colour emoji AND an emoji font installed by default.
// However the JediTerm java terminal emulator can also do emoji on OS X when using the JetBrains JRE.
// Check for that here. DemoBench sets TERM_PROGRAM appropriately.
val hasEmojiTerminal by lazy {
System.getenv("CORDA_FORCE_EMOJI") != null || System.getenv("TERM_PROGRAM") in listOf("Apple_Terminal", "iTerm.app")
System.getenv("CORDA_FORCE_EMOJI") != null ||
System.getenv("TERM_PROGRAM") in listOf("Apple_Terminal", "iTerm.app") ||
(System.getenv("TERM_PROGRAM") == "JediTerm" && System.getProperty("java.vendor") == "JetBrains s.r.o")
}
@JvmStatic val CODE_SANTA_CLAUS: String = codePointsString(0x1F385)

View File

@ -89,7 +89,6 @@ Developers wishing to run DemoBench *without* building a new installer each time
..
Unfortunately, DemoBench's ``$CLASSPATH`` may be too long for the Windows shell . In which case you can still run DemoBench as follows:
.. parsed-literal::
@ -98,7 +97,9 @@ Unfortunately, DemoBench's ``$CLASSPATH`` may be too long for the Windows shell
..
While DemoBench *can* be executed within an IDE, it would be up to the Developer to install all of its runtime dependencies beforehand into their correct locations relative to the value of the ``user.dir`` system property (i.e. the current working directory of the JVM):
While DemoBench *can* be executed within an IDE, it would be up to the Developer to install all of its runtime
dependencies beforehand into their correct locations relative to the value of the ``user.dir`` system property (i.e. the
current working directory of the JVM):
.. parsed-literal::
@ -112,3 +113,9 @@ While DemoBench *can* be executed within an IDE, it would be up to the Developer
..
Mac users should note that the best way to build a DemoBench DMG is with the `JetBrains JDK <https://github.com/JetBrains/jdk8u>`_
which has `binary downloads available from BinTray <https://bintray.com/jetbrains/intellij-jdk>`_.
This JDK has some useful GUI fixes, most notably, when built with this JDK the DemoBench terminal will support emoji
and as such, the nicer coloured ANSI progress renderer. It also resolves some issues with hidpi rendering on
Windows.

View File

@ -18,9 +18,6 @@ import static net.corda.node.shell.InteractiveShell.*;
)
@Usage("Start a (work)flow on the node. This is how you can change the ledger.")
public class FlowShellCommand extends InteractiveShellCommand {
// Note that the class name is deliberately lower case, because we want the command the user types to be
// lower case. CRaSH should ideally lowercase the command names for us, but it doesn't.
@Command
public void start(
@Usage("The class name of the flow to run, or an unambiguous substring") @Argument String name,

View File

@ -62,12 +62,8 @@ dependencies {
// FontAwesomeFX: icons in the form of a font.
compile "de.jensd:fontawesomefx-fontawesome:4.7.0-5"
// These libraries don't exist in any Maven repository I can find.
// See: https://github.com/JetBrains/jediterm
//
// The terminal JAR here has also been tweaked:
// See: https://github.com/JetBrains/jediterm/issues/144
compile ':jediterm-terminal-2.5'
// JediTerm: the terminal emulator used in IntelliJ. We have forked it and tweaked it, see https://github.com/corda/jediterm
compile ':terminal-331a005d6793e52cefc9e2cec6774e62d5a546b1'
compile ':pty4j-0.7.2'
testCompile project(':node')

View File

@ -49,9 +49,8 @@ class R3Pty(val name: X500Name, settings: SettingsProvider, dimension: Dimension
val environment = envs.toMutableMap()
if (!UIUtil.isWindows) {
environment["TERM"] = "xterm"
// This environment variable is specific to MacOSX.
environment.remove("TERM_PROGRAM")
// This, in combination with running on a Mac JetBrains JRE, enables emoji in Mac demobench.
environment["TERM_PROGRAM"] = "JediTerm"
}
val connector = createTtyConnector(args, environment, workingDir)