Skip to content

Commit

Permalink
FFM support
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 6, 2023
1 parent a11001a commit 38df01e
Show file tree
Hide file tree
Showing 23 changed files with 3,240 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
java: [ '11', '21' ]
java: [ '21' ]
steps:
- uses: actions/checkout@v2

Expand Down
22 changes: 0 additions & 22 deletions builtins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,34 +62,12 @@
<execution>
<id>default-compile</id>
<configuration>
<includes>
<include>**/ConsoleEngineImpl.java</include>
<include>**/TTop.java</include>
</includes>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>compact</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>**/ConsoleEngineImpl.java</exclude>
<exclude>**/TTop.java</exclude>
</excludes>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
<arg>-profile</arg>
<arg>compact1</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
22 changes: 0 additions & 22 deletions console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,34 +62,12 @@
<execution>
<id>default-compile</id>
<configuration>
<includes>
<include>**/ConsoleEngineImpl.java</include>
<include>**/TTop.java</include>
</includes>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>compact</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>**/ConsoleEngineImpl.java</exclude>
<exclude>**/TTop.java</exclude>
</excludes>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
<arg>-profile</arg>
<arg>compact1</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
6 changes: 6 additions & 0 deletions demo/jline-gogo.bat
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ set "logconf=%DIRNAME%etc\logging.properties"
if "%1" == "debug" goto :EXECUTE_DEBUG
if "%1" == "debugs" goto :EXECUTE_DEBUGS
if "%1" == "verbose" goto :EXECUTE_VERBOSE
if "%1" == "ffm" goto :EXECUTE_FFM
if "%1" == "" goto :EXECUTE_MAIN
set "opts=%opts% %~1"
shift
Expand Down Expand Up @@ -76,6 +77,11 @@ set "logconf=%DIRNAME%etc\logging.properties"
shift
goto :RUN_LOOP

:EXECUTE_FFM
set "opts=%opts% --enable-preview --enable-native-access=ALL-UNNAMED"
shift
goto :RUN_LOOP

:EXECUTE_MAIN
popd

Expand Down
5 changes: 5 additions & 0 deletions demo/jline-gogo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ while [ "${1}" != "" ]; do
logconf="${DIRNAME}/etc/logging-verbose.properties"
shift
;;
'ffm')
opts="${opts} --enable-preview --enable-native-access=ALL-UNNAMED"
shift
;;
*)
opts="${opts} ${1}"
shift
Expand Down Expand Up @@ -98,6 +102,7 @@ echo "Launching Gogo JLine..."
echo "Classpath: $cp"
set mouse=a
java -cp $cp \
--enable-preview \
$opts \
-Dgosh.home="${DIRNAME}" \
-Djava.util.logging.config.file="${logconf}" \
Expand Down
21 changes: 10 additions & 11 deletions jline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<properties>
<automatic.module.name>org.jline</automatic.module.name>
<javadocOptions>--enable-preview --release 21</javadocOptions>
</properties>

<dependencies>
Expand Down Expand Up @@ -316,31 +317,29 @@
<execution>
<id>default-compile</id>
<configuration>
<includes>
<include>**/TTop.java</include>
<include>**/ConsoleEngineImpl.java</include>
</includes>
<excludes>
<exclude>**/ffm/*.java</exclude>
</excludes>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>compact</id>
<id>jdk21</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>**/TTop.java</exclude>
<exclude>**/ConsoleEngineImpl.java</exclude>
</excludes>
<includes>
<include>**/ffm/*.java</include>
</includes>
<release>21</release>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
<arg>-profile</arg>
<arg>compact1</arg>
<arg>--enable-preview</arg>
</compilerArgs>
</configuration>
</execution>
Expand Down
3 changes: 2 additions & 1 deletion native/src/main/java/org/jline/nativ/OSInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class OSInfo {
public static final String PPC64 = "ppc64";
public static final String ARM64 = "arm64";

private static final HashMap<String, String> archMapping = new HashMap<String, String>();
private static final HashMap<String, String> archMapping = new HashMap<>();

static {
// x86 mappings
Expand Down Expand Up @@ -116,6 +116,7 @@ public static boolean isAndroid() {
return System.getProperty("java.runtime.name", "").toLowerCase().contains("android");
}

@SuppressWarnings("unused")
public static boolean isAlpine() {
try {
Process p = Runtime.getRuntime().exec(new String[] {"cat", "/etc/os-release", "|", "grep", "^ID"});
Expand Down
4 changes: 1 addition & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputTimestamp>2023-03-08T19:46:51Z</project.build.outputTimestamp>

<java.build.version>11</java.build.version>
<java.build.version>21</java.build.version>
<java.target.version>1.8</java.target.version>
<maven.version>3.5.0</maven.version>

Expand Down Expand Up @@ -407,8 +407,6 @@
<compilerArgs>
<arg>-Xlint:all,-options,-processing</arg>
<arg>-Werror</arg>
<arg>-profile</arg>
<arg>compact1</arg>
</compilerArgs>
<fork>true</fork>
</configuration>
Expand Down
1 change: 1 addition & 0 deletions reader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<properties>
<automatic.module.name>org.jline.reader</automatic.module.name>
<surefire.argLine>--add-opens java.base/java.io=ALL-UNNAMED --enable-preview</surefire.argLine>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -181,7 +183,9 @@ public void testPreferAppNameFromConstructor() throws IOException {

@Test
public void terminalLineInfiniteLoop() throws IOException {
ByteArrayInputStream in = new ByteArrayInputStream("hello\nworld\n".getBytes(StandardCharsets.UTF_8));
PipedInputStream in = new PipedInputStream();
PipedOutputStream outIn = new PipedOutputStream(in);
outIn.write("hello\nworld\n".getBytes(StandardCharsets.UTF_8));
ByteArrayOutputStream out = new ByteArrayOutputStream(1024);

Terminal terminal = TerminalBuilder.builder().streams(in, out).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import org.jline.terminal.Cursor;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

Expand All @@ -39,6 +41,16 @@

public class ExternalTerminalTest {

@BeforeEach
public void setup() {
System.setProperty(TerminalBuilder.PROP_PROVIDERS, "exec");
}

@AfterEach
public void tearDown() {
System.clearProperty(TerminalBuilder.PROP_PROVIDERS);
}

@Test
public void testInput() throws IOException, InterruptedException {
PipedInputStream in = new PipedInputStream();
Expand Down
86 changes: 86 additions & 0 deletions terminal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<properties>
<automatic.module.name>org.jline.terminal</automatic.module.name>
<javadocOptions>--enable-preview --release 21</javadocOptions>
</properties>

<dependencies>
Expand All @@ -47,6 +48,91 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<excludes>
<exclude>**/ffm/*.java</exclude>
</excludes>
<release>8</release>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>jdk21-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<includes>
<include>**/ffm/*.java</include>
</includes>
<release>21</release>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
<arg>--enable-preview</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<configuration>
<testExcludes>
<exclude>**/ffm/*.java</exclude>
</testExcludes>
<release>8</release>
</configuration>
</execution>
<execution>
<id>jdk21-testCompile</id>
<configuration>
<testIncludes>
<include>**/ffm/*.java</include>
</testIncludes>
<release>21</release>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>--enable-preview</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<configuration>
<excludes>
<exclude>**/ffm/*.java</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>jdk21-test</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/ffm/*.java</include>
</includes>
<argLine>--enable-preview</argLine>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
Expand Down
Loading

0 comments on commit 38df01e

Please sign in to comment.