Sync from SUSE:SLFO:Main jline revision b1d913699ff3c60d6248fce9b67879dc

This commit is contained in:
Adrian Schröter 2024-05-03 14:03:58 +02:00
commit a205c5d0db
7 changed files with 587 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
jline-2.14.6.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

133
jline-build.xml Normal file
View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="jline" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="build.properties"/>
<property name="project.groupId" value="jline"/>
<property name="project.artifactId" value="jline"/>
<property name="project.name" value="JLine"/>
<property name="project.version" value="2.14.6"/>
<property name="compiler.source" value="1.8"/>
<property name="compiler.target" value="${compiler.source}"/>
<property name="build.finalName" value="${project.artifactId}-${project.version}"/>
<property name="build.dir" value="target"/>
<property name="build.outputDir" value="${build.dir}/classes"/>
<property name="build.srcDir" value="src/main/java"/>
<property name="build.resourceDir" value="src/main/resources"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<!-- ====================================================================== -->
<!-- Defining classpaths -->
<!-- ====================================================================== -->
<path id="build.classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
<target name="clean" description="Clean the output directory">
<delete dir="${build.dir}"/>
</target>
<!-- ====================================================================== -->
<!-- Compilation target -->
<!-- ====================================================================== -->
<target name="compile" description="Compile the code">
<mkdir dir="${build.outputDir}"/>
<javac destdir="${build.outputDir}"
nowarn="true"
debug="true"
optimize="false"
deprecation="true"
encoding="UTF-8"
target="${compiler.target}"
verbose="false"
fork="true"
source="${compiler.source}">
<src>
<pathelement location="${build.srcDir}"/>
</src>
<classpath refid="build.classpath"/>
</javac>
<copy todir="${build.outputDir}">
<fileset dir="${build.resourceDir}">
<include name="**/*"/>
</fileset>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${build.srcDir}"
packagenames="*"
destdir="${reporting.outputDirectory}/apidocs"
access="protected"
source="${compiler.source}"
verbose="false"
version="true"
use="true"
author="true"
splitindex="false"
nodeprecated="false"
nodeprecatedlist="false"
notree="false"
noindex="false"
nohelp="false"
nonavbar="false"
serialwarn="false"
encoding="UTF-8"
linksource="false"
breakiterator="false">
<classpath refid="build.classpath"/>
</javadoc>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile" description="Package the application">
<jar jarfile="${build.dir}/${build.finalName}.jar"
compress="true"
index="false"
basedir="${build.outputDir}"
excludes="**/package.html">
<manifest>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="${project.name}"/>
<attribute name="Bundle-SymbolicName" value="${project.artifactId}"/>
<attribute name="Bundle-Version" value="${project.version}"/>
<attribute name="Export-Package" value="jline;uses:=&quot;jline.internal&quot;;version=&quot;${project.version}&quot;,jline.console;uses:=&quot;jline,jline.console.completer,jline.console.history&quot;;version=&quot;${project.version}&quot;,jline.console.completer;uses:=&quot;jline.console&quot;;version=&quot;${project.version}&quot;,jline.console.history;version=&quot;${project.version}&quot;,jline.console.internal;version=&quot;${project.version}&quot;,jline.internal;version=&quot;${project.version}&quot;"/>
<attribute name="Import-Package" value="org.fusesource.jansi;version=&quot;[1.17,2)&quot;,javax.swing;resolution:=optional"/>
<attribute name="JavaPackages-ArtifactId" value="${project.artifactId}"/>
<attribute name="JavaPackages-GroupId" value="${project.groupId}"/>
<attribute name="JavaPackages-Version" value="${project.version}"/>
<attribute name="Require-Capability" value="osgi.ee;filter:=&quot;(&amp;(osgi.ee=JavaSE)(version=${compiler.target}))&quot;"/>
</manifest>
</jar>
</target>
<!-- ====================================================================== -->
<!-- A dummy target for the package named after the type it creates -->
<!-- ====================================================================== -->
<target name="jar" depends="package" description="Builds the jar for the application"/>
</project>

162
jline-jansi2.patch Normal file
View File

@ -0,0 +1,162 @@
--- jline2-jline-2.14.6/src/main/java/jline/AnsiWindowsTerminal.java 2022-05-13 06:20:11.713726341 +0200
+++ jline2-jline-2.14.6/src/main/java/jline/AnsiWindowsTerminal.java 2022-05-13 07:21:11.191259791 +0200
@@ -9,12 +9,17 @@
package jline;
import jline.internal.Configuration;
+import org.fusesource.jansi.AnsiColors;
import org.fusesource.jansi.AnsiConsole;
-import org.fusesource.jansi.AnsiOutputStream;
-import org.fusesource.jansi.WindowsAnsiOutputStream;
+import org.fusesource.jansi.AnsiMode;
+import org.fusesource.jansi.AnsiType;
+
+import org.fusesource.jansi.io.AnsiOutputStream;
+import org.fusesource.jansi.io.WindowsAnsiProcessor;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
+import java.nio.charset.Charset;
/**
* ANSI-supported {@link WindowsTerminal}.
@@ -42,26 +47,26 @@
if (Configuration.isWindows()) {
// On windows we know the console does not interpret ANSI codes..
try {
- return new WindowsAnsiOutputStream(stream);
+ return new AnsiOutputStream(stream, null, AnsiMode.Default, new WindowsAnsiProcessor(stream), AnsiType.Emulation, AnsiColors.Colors16, Charset.defaultCharset(), null, null, false );
} catch (Throwable ignore) {
// this happens when JNA is not in the path.. or
// this happens when the stdout is being redirected to a file.
}
// Use the ANSIOutputStream to strip out the ANSI escape sequences.
- return new AnsiOutputStream(stream);
+ return new AnsiOutputStream(stream, null, AnsiMode.Strip, null, AnsiType.Unsupported, AnsiColors.TrueColor, Charset.defaultCharset(), null, null, false);
}
return stream;
}
private static boolean detectAnsiSupport() {
- OutputStream out = AnsiConsole.wrapOutputStream(new ByteArrayOutputStream());
try {
- out.close();
+ new WindowsAnsiProcessor(new ByteArrayOutputStream());
+ return true;
}
catch (Exception e) {
// ignore;
}
- return out instanceof WindowsAnsiOutputStream;
+ return false;
}
public AnsiWindowsTerminal() throws Exception {
--- jline2-jline-2.14.6/src/main/java/jline/internal/Ansi.java 2022-05-13 06:20:11.749726581 +0200
+++ jline2-jline-2.14.6/src/main/java/jline/internal/Ansi.java 2022-05-13 06:20:28.793840511 +0200
@@ -10,8 +10,12 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.nio.charset.Charset;
-import org.fusesource.jansi.AnsiOutputStream;
+import org.fusesource.jansi.io.AnsiOutputStream;
+import org.fusesource.jansi.AnsiColors;
+import org.fusesource.jansi.AnsiMode;
+import org.fusesource.jansi.AnsiType;
/**
* Ansi support.
@@ -25,7 +29,18 @@
if (str == null) return "";
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- AnsiOutputStream aos = new AnsiOutputStream(baos);
+ AnsiOutputStream aos = new AnsiOutputStream(
+ baos,
+ null,
+ AnsiMode.Strip,
+ null,
+ AnsiType.Emulation,
+ AnsiColors.TrueColor,
+ Charset.defaultCharset(),
+ null,
+ null,
+ false
+ );
aos.write(str.getBytes());
aos.close();
return baos.toString();
--- jline2-jline-2.14.6/src/main/java/jline/WindowsTerminal.java 2022-05-13 06:20:11.717726368 +0200
+++ jline2-jline-2.14.6/src/main/java/jline/WindowsTerminal.java 2022-05-13 06:34:46.083425194 +0200
@@ -15,9 +15,10 @@
import jline.internal.Configuration;
import jline.internal.Log;
-import org.fusesource.jansi.internal.WindowsSupport;
+
import org.fusesource.jansi.internal.Kernel32;
import static org.fusesource.jansi.internal.Kernel32.*;
+import org.fusesource.jansi.internal.Kernel32.CONSOLE_SCREEN_BUFFER_INFO;
import static jline.WindowsTerminal.ConsoleMode.ENABLE_ECHO_INPUT;
import static jline.WindowsTerminal.ConsoleMode.ENABLE_LINE_INPUT;
@@ -208,18 +209,34 @@
// Native Bits
//
private static int getConsoleMode() {
- return WindowsSupport.getConsoleMode();
+ long hConsole = GetStdHandle (STD_INPUT_HANDLE);
+ if (hConsole == INVALID_HANDLE_VALUE)
+ return -1;
+ int mode[] = new int[1];
+ if (GetConsoleMode (hConsole, mode)==0)
+ return -1;
+ return mode[0];
}
private static void setConsoleMode(int mode) {
- WindowsSupport.setConsoleMode(mode);
+ long hConsole = GetStdHandle (STD_INPUT_HANDLE);
+ if (hConsole == INVALID_HANDLE_VALUE)
+ return;
+ SetConsoleMode (hConsole, mode);
+ }
+
+ private static INPUT_RECORD[] readConsoleInput(int count) throws IOException {
+ long hConsole = GetStdHandle (STD_INPUT_HANDLE);
+ if (hConsole == INVALID_HANDLE_VALUE)
+ return null;
+ return readConsoleKeyInput(hConsole, count, false);
}
private byte[] readConsoleInput() {
// XXX does how many events to read in one call matter?
INPUT_RECORD[] events = null;
try {
- events = WindowsSupport.readConsoleInput(1);
+ events = readConsoleInput(1);
} catch (IOException e) {
Log.debug("read Windows console input error: ", e);
}
@@ -304,11 +321,17 @@
}
private static int getWindowsTerminalWidth() {
- return WindowsSupport.getWindowsTerminalWidth();
+ long outputHandle = GetStdHandle (STD_OUTPUT_HANDLE);
+ CONSOLE_SCREEN_BUFFER_INFO info = new CONSOLE_SCREEN_BUFFER_INFO();
+ GetConsoleScreenBufferInfo (outputHandle, info);
+ return info.windowWidth();
}
private static int getWindowsTerminalHeight() {
- return WindowsSupport.getWindowsTerminalHeight();
+ long outputHandle = GetStdHandle (STD_OUTPUT_HANDLE);
+ CONSOLE_SCREEN_BUFFER_INFO info = new CONSOLE_SCREEN_BUFFER_INFO();
+ GetConsoleScreenBufferInfo (outputHandle, info);
+ return info.windowHeight();
}
/**

67
jline-java8compat.patch Normal file
View File

@ -0,0 +1,67 @@
diff -urEbwB jline2-jline-2.14.6/src/main/java/jline/internal/InputStreamReader.java jline2-jline-2.14.6.new/src/main/java/jline/internal/InputStreamReader.java
--- jline2-jline-2.14.6/src/main/java/jline/internal/InputStreamReader.java 2018-03-26 11:14:37.000000000 +0200
+++ jline2-jline-2.14.6.new/src/main/java/jline/internal/InputStreamReader.java 2019-09-27 09:31:17.518979605 +0200
@@ -13,6 +13,7 @@
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
@@ -68,7 +69,7 @@
decoder = Charset.defaultCharset().newDecoder().onMalformedInput(
CodingErrorAction.REPLACE).onUnmappableCharacter(
CodingErrorAction.REPLACE);
- bytes.limit(0);
+ ((Buffer)bytes).limit(0);
}
/**
@@ -101,7 +102,7 @@
throw (UnsupportedEncodingException)
new UnsupportedEncodingException(enc).initCause(e);
}
- bytes.limit(0);
+ ((Buffer)bytes).limit(0);
}
/**
@@ -118,7 +119,7 @@
dec.averageCharsPerByte();
this.in = in;
decoder = dec;
- bytes.limit(0);
+ ((Buffer)bytes).limit(0);
}
/**
@@ -136,7 +137,7 @@
decoder = charset.newDecoder().onMalformedInput(
CodingErrorAction.REPLACE).onUnmappableCharacter(
CodingErrorAction.REPLACE);
- bytes.limit(0);
+ ((Buffer)bytes).limit(0);
}
/**
@@ -262,7 +263,7 @@
} else if (was_red == 0) {
break;
}
- bytes.limit(bytes.limit() + was_red);
+ ((Buffer)bytes).limit(bytes.limit() + was_red);
needInput = false;
}
@@ -273,8 +274,8 @@
// compact the buffer if no space left
if (bytes.limit() == bytes.capacity()) {
bytes.compact();
- bytes.limit(bytes.position());
- bytes.position(0);
+ ((Buffer)bytes).limit(bytes.position());
+ ((Buffer)bytes).position(0);
}
needInput = true;
} else {

105
jline.changes Normal file
View File

@ -0,0 +1,105 @@
-------------------------------------------------------------------
Mon May 16 11:09:38 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* jline-jansi2.patch
+ fix jline build against jansi 2.4.x
- Remove dependency on jansi-native and hawtjni-runtime
-------------------------------------------------------------------
Sun Mar 20 13:12:08 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Build with source and target levels 8
-------------------------------------------------------------------
Fri Sep 27 07:34:45 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* jline-java8compat.patch
+ build binaries compatible with Java 8
-------------------------------------------------------------------
Thu Jun 27 09:06:19 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- Work around a problem with dependency resolution, where variables
are not resolved
-------------------------------------------------------------------
Tue Mar 5 15:08:16 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- Upgrade to version 2.14.6
* NOT backward compatible with jline 1.x
* Depend on jansi 2.9+
* #277: Allow setting max history-size. 'FileHistory' allows
delayed init (to allow setMaxSize to take effect) and
'ConsoleReader' exposes ability to read inputrc settings.
* Ability to control terminal encoding
* Backward history searching
* Handle EOF / Ctrl-D on unsupported terminals
* Distinguish carriage return from newline
* Correcting Manifest to make jline work as a bundle in OSGi
* Handle TERM=dumb as an UnsupportedTerminal
* Updated license headers to be consistent BSD version
* Added support for vi keymap. Most major vi features should work.
* The "jline.esc.timeout" configuration option (in your
$HOME/.jline.rc) controls the number of millisesconds that
jline will wait after seeing an ESC key to see if another
character arrives.
* The JVM shutdown hook that restores the terminal settings when
the JVM exits (jline.shutdownhook) is now turned on by default.
- Generate and customize the ant build file in order to be able
to build without maven.
-------------------------------------------------------------------
Wed Sep 27 16:55:31 UTC 2017 - fstrba@suse.com
- Don't require java-1_5_0-gcj-compat, but build with any
java-devel provider
- Specify java source and target level 1.6: fixes build with
jdk9
-------------------------------------------------------------------
Fri Jun 9 09:35:59 UTC 2017 - tchvatal@suse.com
- Reduce depgraph and drop maven fragment to allow bootstrap
-------------------------------------------------------------------
Fri May 19 09:23:12 UTC 2017 - mpluskal@suse.com
- Update dependencies
-------------------------------------------------------------------
Wed Mar 18 09:46:13 UTC 2015 - tchvatal@suse.com
- Fix build with new javapackages-tools
-------------------------------------------------------------------
Mon Sep 9 11:06:04 UTC 2013 - tchvatal@suse.com
- Move from jpackage-utils to javapackage-tools
-------------------------------------------------------------------
Mon Aug 26 07:57:51 UTC 2013 - mvyskocil@suse.com
- use new add_maven_depmap from javapackages-utils
-------------------------------------------------------------------
Thu Apr 25 09:21:43 UTC 2013 - mvyskocil@suse.com
- add findutils dependency (bnc#816314)
-------------------------------------------------------------------
Thu Sep 2 12:32:48 UTC 2010 - mvyskocil@suse.cz
- ignore antlr(-java) to reduce build cycles
-------------------------------------------------------------------
Wed Nov 18 12:27:34 UTC 2009 - mvyskocil@suse.cz
- Build using gcj - needed by rhino 1.7R2 - bnc#554532
-------------------------------------------------------------------
Thu May 7 11:04:53 CEST 2009 - mvyskocil@suse.cz
- Initial SUSE packaging 0.9.94 from jpp 5.0

94
jline.spec Normal file
View File

@ -0,0 +1,94 @@
#
# spec file for package jline
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: jline
Version: 2.14.6
Release: 0
Summary: Java library for reading and editing user input in console applications
License: BSD-3-Clause
Group: Development/Libraries/Java
URL: https://github.com/jline/jline2
Source0: https://github.com/jline/jline2/archive/jline-%{version}.tar.gz
Source1: %{name}-build.xml
Patch0: jline-java8compat.patch
Patch1: jline-jansi2.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: jansi
BuildRequires: javapackages-local
#!BuildIgnore: ant-antlr
Requires: mvn(org.fusesource.jansi:jansi)
BuildArch: noarch
%description
JLine is a java library for reading and editing user input in console
applications. It features tab-completion, command history, password
masking, customizable keybindings, and pass-through handlers to use to
chain to other console applications.
%package javadoc
Summary: Javadocs for %{name}
Group: Documentation/HTML
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n jline2-jline-%{version}
%patch0 -p1
%patch1 -p1
%pom_change_dep org.fusesource.jansi:jansi org.fusesource.jansi:jansi:1.12
cp %{SOURCE1} build.xml
mkdir -p lib
# Remove maven-shade-plugin usage
%pom_remove_plugin "org.apache.maven.plugins:maven-shade-plugin"
# Remove animal sniffer plugin in order to reduce deps
%pom_remove_plugin "org.codehaus.mojo:animal-sniffer-maven-plugin"
# Remove unavailable and unneeded deps
%pom_xpath_remove "pom:build/pom:extensions"
%pom_remove_plugin :maven-site-plugin
%pom_remove_plugin :maven-enforcer-plugin
%pom_remove_plugin :maven-javadoc-plugin
%pom_remove_parent
%build
build-jar-repository -s lib jansi
%{ant} package javadoc
%install
# jar
install -dm 0755 %{buildroot}%{_javadir}/%{name}
install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}/%{name}.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{name}
install -pm 0644 pom.xml %{buildroot}%{_mavenpomdir}/%{name}/%{name}.pom
%add_maven_depmap %{name}/%{name}.pom %{name}/%{name}.jar
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}/
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles
%files javadoc
%{_javadocdir}/%{name}
%changelog