diff --git a/native/Makefile b/native/Makefile index 4b42b1bbc..91595d609 100644 --- a/native/Makefile +++ b/native/Makefile @@ -83,7 +83,7 @@ NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME) # For cross-compilation, install docker. See also https://github.com/dockcross/dockcross # Disabled linux-armv6 build because of this issue; https://github.com/dockcross/dockcross/issues/190 native-all: \ - linux-x86 linux-x86_64 linux-arm linux-armv6 linux-armv7 linux-arm64 linux-ppc64 linux-riscv64 \ + linux-x86 linux-x86_64 linux-arm linux-armv6 linux-armv7 linux-arm64 linux-ppc64 \ win-x86 win-x86_64 win-arm64 \ mac-x86 mac-x86_64 mac-arm64 \ freebsd-x86 freebsd-x86_64 diff --git a/native/Makefile.common b/native/Makefile.common index 5e7030575..f9ba200db 100644 --- a/native/Makefile.common +++ b/native/Makefile.common @@ -36,43 +36,43 @@ Default_LIBNAME := libjlinenative.so Linux-x86_CC := $(CROSS_PREFIX)gcc Linux-x86_STRIP := $(CROSS_PREFIX)strip Linux-x86_CCFLAGS := -I$(JAVA_HOME)/include -Itarget/inc -Itarget/inc/unix -Os -fPIC -m32 -fvisibility=hidden -Linux-x86_LINKFLAGS := -shared -static-libgcc +Linux-x86_LINKFLAGS := -shared -static-libgcc -lutil Linux-x86_LIBNAME := libjlinenative.so Linux-x86_64_CC := $(CROSS_PREFIX)gcc Linux-x86_64_STRIP := $(CROSS_PREFIX)strip Linux-x86_64_CCFLAGS := -I$(JAVA_HOME)/include -Itarget/inc -Itarget/inc/unix -Os -fPIC -m64 -fvisibility=hidden -Linux-x86_64_LINKFLAGS := -shared -static-libgcc +Linux-x86_64_LINKFLAGS := -shared -static-libgcc -lutil Linux-x86_64_LIBNAME := libjlinenative.so Linux-arm_CC := $(CROSS_PREFIX)gcc Linux-arm_STRIP := $(CROSS_PREFIX)strip Linux-arm_CCFLAGS := -I$(JAVA_HOME)/include -Itarget/inc -Itarget/inc/unix -Os -fPIC -mfloat-abi=softfp -mfpu=vfp -fvisibility=hidden -Linux-arm_LINKFLAGS := -shared -static-libgcc +Linux-arm_LINKFLAGS := -shared -static-libgcc -lutil Linux-arm_LIBNAME := libjlinenative.so Linux-armv6_CC := $(CROSS_PREFIX)gcc Linux-armv6_STRIP := $(CROSS_PREFIX)strip Linux-armv6_CCFLAGS := -I$(JAVA_HOME)/include -Itarget/inc -Itarget/inc/unix -Os -mfloat-abi=hard -mfpu=vfp -fPIC -fvisibility=hidden -Linux-armv6_LINKFLAGS := -shared -static-libgcc +Linux-armv6_LINKFLAGS := -shared -static-libgcc -lutil Linux-armv6_LIBNAME := libjlinenative.so Linux-armv7_CC := $(CROSS_PREFIX)gcc Linux-armv7_STRIP := $(CROSS_PREFIX)strip Linux-armv7_CCFLAGS := -I$(JAVA_HOME)/include -Itarget/inc -Itarget/inc/unix -Os -mfloat-abi=hard -mfpu=vfp -fPIC -fvisibility=hidden -Linux-armv7_LINKFLAGS := -shared -static-libgcc +Linux-armv7_LINKFLAGS := -shared -static-libgcc -lutil Linux-armv7_LIBNAME := libjlinenative.so Linux-arm64_CC := $(CROSS_PREFIX)gcc Linux-arm64_STRIP := $(CROSS_PREFIX)strip Linux-arm64_CCFLAGS := -I$(JAVA_HOME)/include -Itarget/inc -Itarget/inc/unix -Os -march=armv8-a -fPIC -fvisibility=hidden -Linux-arm64_LINKFLAGS := -shared -static-libgcc +Linux-arm64_LINKFLAGS := -shared -static-libgcc -lutil Linux-arm64_LIBNAME := libjlinenative.so Linux-ppc64_CC := $(CROSS_PREFIX)gcc Linux-ppc64_STRIP := $(CROSS_PREFIX)strip Linux-ppc64_CCFLAGS := -I$(JAVA_HOME)/include -Itarget/inc -Itarget/inc/unix -Os -fPIC -fvisibility=hidden -Linux-ppc64_LINKFLAGS := -shared -static-libgcc +Linux-ppc64_LINKFLAGS := -shared -static-libgcc -lutil Linux-ppc64_LIBNAME := libjlinenative.so Linux-riscv64_CC := $(CROSS_PREFIX)gcc @@ -130,7 +130,7 @@ ifeq ($(wildcard MAC_SDK),) MAC_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk endif Mac-x86_64_CCFLAGS := -I$(MAC_SDK)/System/Library/Frameworks/JavaVM.framework/Headers -Itarget/inc -Itarget/inc/unix -Os -fPIC -mmacosx-version-min=10.6 -fvisibility=hidden -Mac-x86_64_LINKFLAGS := -dynamiclib +Mac-x86_64_LINKFLAGS := -dynamiclib Mac-x86_64_LIBNAME := libjlinenative.jnilib Mac-arm64_CC := $(CROSS_PREFIX)clang -v diff --git a/native/src/main/resources/org/jline/nativ/Linux/arm/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/arm/libjlinenative.so index 6791f478d..bc9415fad 100755 Binary files a/native/src/main/resources/org/jline/nativ/Linux/arm/libjlinenative.so and b/native/src/main/resources/org/jline/nativ/Linux/arm/libjlinenative.so differ diff --git a/native/src/main/resources/org/jline/nativ/Linux/arm64/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/arm64/libjlinenative.so index de656faad..a5953000f 100755 Binary files a/native/src/main/resources/org/jline/nativ/Linux/arm64/libjlinenative.so and b/native/src/main/resources/org/jline/nativ/Linux/arm64/libjlinenative.so differ diff --git a/native/src/main/resources/org/jline/nativ/Linux/armv7/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/armv7/libjlinenative.so index d546f10ca..ae3fa0c8a 100755 Binary files a/native/src/main/resources/org/jline/nativ/Linux/armv7/libjlinenative.so and b/native/src/main/resources/org/jline/nativ/Linux/armv7/libjlinenative.so differ diff --git a/native/src/main/resources/org/jline/nativ/Linux/ppc64/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/ppc64/libjlinenative.so index e79106572..b5808f346 100755 Binary files a/native/src/main/resources/org/jline/nativ/Linux/ppc64/libjlinenative.so and b/native/src/main/resources/org/jline/nativ/Linux/ppc64/libjlinenative.so differ diff --git a/native/src/main/resources/org/jline/nativ/Linux/x86/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/x86/libjlinenative.so index 932849e3d..028d71c1e 100755 Binary files a/native/src/main/resources/org/jline/nativ/Linux/x86/libjlinenative.so and b/native/src/main/resources/org/jline/nativ/Linux/x86/libjlinenative.so differ diff --git a/native/src/main/resources/org/jline/nativ/Linux/x86_64/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/x86_64/libjlinenative.so index 5772a2538..5feade71d 100755 Binary files a/native/src/main/resources/org/jline/nativ/Linux/x86_64/libjlinenative.so and b/native/src/main/resources/org/jline/nativ/Linux/x86_64/libjlinenative.so differ diff --git a/terminal-jansi/src/test/java/org/jline/terminal/impl/jansi/JansiTerminalProviderTest.java b/terminal-jansi/src/test/java/org/jline/terminal/impl/jansi/JansiTerminalProviderTest.java index c4258c9cc..de8416eb7 100644 --- a/terminal-jansi/src/test/java/org/jline/terminal/impl/jansi/JansiTerminalProviderTest.java +++ b/terminal-jansi/src/test/java/org/jline/terminal/impl/jansi/JansiTerminalProviderTest.java @@ -8,9 +8,20 @@ */ package org.jline.terminal.impl.jansi; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.nio.charset.Charset; + +import org.jline.terminal.Terminal; +import org.jline.terminal.spi.SystemStream; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; public class JansiTerminalProviderTest { @@ -19,4 +30,30 @@ public void testJansiVersion() { assertEquals(2, JansiTerminalProvider.JANSI_MAJOR_VERSION); assertEquals(4, JansiTerminalProvider.JANSI_MINOR_VERSION); } + + @Test + void testIsSystemStream() { + assertDoesNotThrow(() -> new JansiTerminalProvider().isSystemStream(SystemStream.Output)); + } + + @Test + @Disabled + void testNewTerminal() throws IOException { + PipedOutputStream pos = new PipedOutputStream(); + PipedInputStream pis = new PipedInputStream(pos); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + Terminal terminal = new JansiTerminalProvider() + .newTerminal( + "name", + "xterm", + pis, + baos, + Charset.defaultCharset(), + Terminal.SignalHandler.SIG_DFL, + true, + null, + null); + assertNotNull(terminal); + } } diff --git a/terminal-jna/src/test/java/org/jline/terminal/impl/jna/JnaTerminalProviderTest.java b/terminal-jna/src/test/java/org/jline/terminal/impl/jna/JnaTerminalProviderTest.java new file mode 100644 index 000000000..42363339c --- /dev/null +++ b/terminal-jna/src/test/java/org/jline/terminal/impl/jna/JnaTerminalProviderTest.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2002-2021, the original author(s). + * + * This software is distributable under the BSD license. See the terms of the + * BSD license in the documentation provided with this software. + * + * https://opensource.org/licenses/BSD-3-Clause + */ +package org.jline.terminal.impl.jna; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.nio.charset.Charset; + +import org.jline.terminal.Terminal; +import org.jline.terminal.spi.SystemStream; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; + +import com.sun.jna.Platform; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assumptions.assumeFalse; + +public class JnaTerminalProviderTest { + + @Test + void testIsSystemStream() { + assumeFalse(Platform.isMac() && Platform.is64Bit() && Platform.isARM()); + + assertDoesNotThrow(() -> new JnaTerminalProvider().isSystemStream(SystemStream.Output)); + } + + @Test + @DisabledOnOs(OS.WINDOWS) + void testNewTerminal() throws IOException { + assumeFalse(Platform.isMac() && Platform.is64Bit() && Platform.isARM()); + + PipedOutputStream pos = new PipedOutputStream(); + PipedInputStream pis = new PipedInputStream(pos); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + Terminal terminal = new JnaTerminalProvider() + .newTerminal( + "name", + "xterm", + pis, + baos, + Charset.defaultCharset(), + Terminal.SignalHandler.SIG_DFL, + true, + null, + null); + assertNotNull(terminal); + } +} diff --git a/terminal-jni/src/test/java/org/jline/terminal/impl/jni/JniTerminalProviderTest.java b/terminal-jni/src/test/java/org/jline/terminal/impl/jni/JniTerminalProviderTest.java new file mode 100644 index 000000000..e08a4024b --- /dev/null +++ b/terminal-jni/src/test/java/org/jline/terminal/impl/jni/JniTerminalProviderTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2002-2021, the original author(s). + * + * This software is distributable under the BSD license. See the terms of the + * BSD license in the documentation provided with this software. + * + * https://opensource.org/licenses/BSD-3-Clause + */ +package org.jline.terminal.impl.jni; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.nio.charset.Charset; + +import org.jline.terminal.Terminal; +import org.jline.terminal.spi.SystemStream; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class JniTerminalProviderTest { + + @Test + void testIsSystemStream() { + assertDoesNotThrow(() -> new JniTerminalProvider().isSystemStream(SystemStream.Output)); + } + + @Test + @DisabledOnOs(OS.WINDOWS) + void testNewTerminal() throws IOException { + PipedOutputStream pos = new PipedOutputStream(); + PipedInputStream pis = new PipedInputStream(pos); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + Terminal terminal = new JniTerminalProvider() + .newTerminal( + "name", + "xterm", + pis, + baos, + Charset.defaultCharset(), + Terminal.SignalHandler.SIG_DFL, + true, + null, + null); + assertNotNull(terminal); + } +}