Add jline package version 2.14.6 (#4618)

* jline: Add package version 2.14.6

- Use javapackages-local-bootstrap to avoid build cycle

* jline: cgmanifest add package entry

* jline: licenses add package entry

* jline: cgmanifest fix lexical position of package entry
This commit is contained in:
Sumynwa 2023-01-30 17:23:30 +05:30 committed by GitHub
parent 715b00ddc1
commit d47378ae4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 535 additions and 1 deletions

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>

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();
}
/**

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 {

View File

@ -0,0 +1,6 @@
{
"Signatures": {
"jline-2.14.6.tar.gz": "c6205afb214288cd8ef53f1ea1243ba9388c84b55c929f0b9e6cee7757c6efac",
"jline-build.xml": "1b608dba93ef299f0a54bceed80e3be5dba4a6c8486eaf236832af438ad90dae"
}
}

View File

@ -0,0 +1,155 @@
Summary: Java library for reading and editing user input in console applications
Name: jline
Version: 2.14.6
Release: 1%{?dist}
License: BSD-3-Clause
Vendor: Microsoft Corporation
Distribution: Mariner
Group: Development/Libraries/Java
URL: https://github.com/jline/jline2
Source0: https://github.com/jline/jline2/archive/refs/tags/%{name}-%{version}.tar.gz
Source1: %{name}-build.xml
Patch0: jline-java8compat.patch
Patch1: jline-jansi2.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: jansi
BuildRequires: javapackages-local-bootstrap
Requires: 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
%autosetup -p1 -n jline2-%{name}-%{version}
%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
* Tue Jan 17 2023 Sumedh Sharma <sumsharma@microsoft.com> - 2.14.6-1
- Initial CBL-Mariner import from openSUSE Tumbleweed (license: same as "License" tag).
- Use javapackages-local-bootstrap to avoid build cycle.
- Converting the 'Release' tag to the '[number].[distribution]' format.
- License verified
* Mon May 16 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 2022 Fridrich Strba <fstrba@suse.com>
- Build with source and target levels 8
* Fri Sep 27 2019 Fridrich Strba <fstrba@suse.com>
- Added patch:
* jline-java8compat.patch
+ build binaries compatible with Java 8
* Thu Jun 27 2019 Fridrich Strba <fstrba@suse.com>
- Work around a problem with dependency resolution, where variables
are not resolved
* Tue Mar 5 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 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 2017 tchvatal@suse.com
- Reduce depgraph and drop maven fragment to allow bootstrap
* Fri May 19 2017 mpluskal@suse.com
- Update dependencies
* Wed Mar 18 2015 tchvatal@suse.com
- Fix build with new javapackages-tools
* Mon Sep 9 2013 tchvatal@suse.com
- Move from jpackage-utils to javapackage-tools
* Mon Aug 26 2013 mvyskocil@suse.com
- use new add_maven_depmap from javapackages-utils
* Thu Apr 25 2013 mvyskocil@suse.com
- add findutils dependency (bnc#816314)
* Thu Sep 2 2010 mvyskocil@suse.cz
- ignore antlr(-java) to reduce build cycles
* Wed Nov 18 2009 mvyskocil@suse.cz
- Build using gcj - needed by rhino 1.7R2 - bnc#554532
* Thu May 7 2009 mvyskocil@suse.cz
- Initial SUSE packaging 0.9.94 from jpp 5.0

File diff suppressed because one or more lines are too long

View File

@ -2391,6 +2391,7 @@
"jflex",
"jflex-bootstrap",
"jlex",
"jline",
"jna",
"jsch",
"jsch-agent-proxy",

View File

@ -7486,6 +7486,16 @@
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "jline",
"version": "2.14.6",
"downloadUrl": "https://github.com/jline/jline2/archive/refs/tags/jline-2.14.6.tar.gz"
}
}
},
{
"component": {
"type": "other",