Sync from SUSE:SLFO:Main plexus-cli revision b53deadca7a1d354e7f617526d1f6008

This commit is contained in:
Adrian Schröter 2024-07-01 14:24:22 +02:00
parent fcd3ffd631
commit 0e49a8c239
8 changed files with 118 additions and 186 deletions

View File

@ -1,18 +1,18 @@
From 50b6e1d26fdcecbfa40302d6b8f4ea6dbecb3e93 Mon Sep 17 00:00:00 2001
From c35c0ecf6be620469b50cc904efc2152ba3d7dbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Thu, 19 May 2022 09:30:24 +0200
Subject: [PATCH 1/2] Do not use commons-cli deprecated classes
---
.../plexus/tools/cli/AbstractCli.java | 32 +++++++++----------
.../codehaus/plexus/tools/cli/TestCli.java | 4 +--
2 files changed, 17 insertions(+), 19 deletions(-)
.../plexus/tools/cli/AbstractCli.java | 60 ++++++++++---------
.../codehaus/plexus/tools/cli/TestCli.java | 9 +--
2 files changed, 38 insertions(+), 31 deletions(-)
diff --git a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
index 1763c5a..e173774 100644
index 505c128..7e72f08 100644
--- a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
+++ b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
@@ -18,9 +18,9 @@ package org.codehaus.plexus.tools.cli;
@@ -24,9 +24,9 @@ import java.util.Properties;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
@ -24,7 +24,7 @@ index 1763c5a..e173774 100644
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.codehaus.plexus.ContainerConfiguration;
@@ -49,17 +49,17 @@ public abstract class AbstractCli
@@ -45,17 +45,17 @@ public abstract class AbstractCli implements Cli {
// These are standard options that we would want to use for all our projects.
// ----------------------------------------------------------------------------
@ -48,63 +48,93 @@ index 1763c5a..e173774 100644
// ----------------------------------------------------------------------------
// Abstract methods
@@ -346,19 +346,17 @@ public abstract class AbstractCli
@@ -284,25 +284,31 @@ public abstract class AbstractCli implements Cli {
public Options buildDefaultCliOptions() {
options = new Options();
options.addOption(
- OptionBuilder.withLongOpt( "define" ).hasArg().withDescription( "Define a system property" ).create(
- SET_SYSTEM_PROPERTY ) );
+ Option.builder( SET_SYSTEM_PROPERTY ).longOpt( "define" ).hasArg().desc( "Define a system property" ).build() );
options.addOption(
- OptionBuilder.withLongOpt( "help" ).withDescription( "Display help information" ).create( HELP ) );
+ Option.builder( HELP ).longOpt( "help" ).desc( "Display help information" ).build() );
options.addOption(
- OptionBuilder.withLongOpt( "version" ).withDescription( "Display version information" ).create( VERSION ) );
+ Option.builder( VERSION ).longOpt( "version" ).desc( "Display version information" ).build() );
options.addOption(
- OptionBuilder.withLongOpt( "quiet" ).withDescription( "Quiet output - only show errors" ).create( QUIET ) );
+ Option.builder( QUIET ).longOpt( "quiet" ).desc( "Quiet output - only show errors" ).build() );
options.addOption(
- OptionBuilder.withLongOpt( "debug" ).withDescription( "Produce execution debug output" ).create( DEBUG ) );
+ Option.builder( DEBUG ).longOpt( "debug" ).desc( "Produce execution debug output" ).build() );
options.addOption(
- OptionBuilder.withLongOpt( "errors" ).withDescription( "Produce execution error messages" ).create(
- ERRORS ) );
+ Option.builder( ERRORS ).longOpt( "errors" ).desc( "Produce execution error messages" ).build() );
- options.addOption(OptionBuilder.withLongOpt("define")
+ options.addOption(Option.builder( SET_SYSTEM_PROPERTY )
+ .longOpt( "define" )
.hasArg()
- .withDescription("Define a system property")
- .create(SET_SYSTEM_PROPERTY));
- options.addOption(OptionBuilder.withLongOpt("help")
- .withDescription("Display help information")
- .create(HELP));
- options.addOption(OptionBuilder.withLongOpt("version")
- .withDescription("Display version information")
- .create(VERSION));
- options.addOption(OptionBuilder.withLongOpt("quiet")
- .withDescription("Quiet output - only show errors")
- .create(QUIET));
- options.addOption(OptionBuilder.withLongOpt("debug")
- .withDescription("Produce execution debug output")
- .create(DEBUG));
- options.addOption(OptionBuilder.withLongOpt("errors")
- .withDescription("Produce execution error messages")
- .create(ERRORS));
+ .desc( "Define a system property" )
+ .build() );
+ options.addOption(Option.builder( HELP )
+ .longOpt( "help" )
+ .desc( "Display help information" )
+ .build() );
+ options.addOption(Option.builder( VERSION )
+ .longOpt( "version" )
+ .desc( "Display version information" )
+ .build() );
+ options.addOption(Option.builder( QUIET )
+ .longOpt( "quiet" )
+ .desc( "Quiet output - only show errors" )
+ .build() );
+ options.addOption(Option.builder( DEBUG )
+ .longOpt( "debug" )
+ .desc( "Produce execution debug output" )
+ .build() );
+ options.addOption(Option.builder( ERRORS )
+ .longOpt( "errors" )
+ .desc( "Produce execution error messages" )
+ .build() );
return buildCliOptions( options );
return buildCliOptions(options);
}
@@ -369,7 +367,7 @@ public abstract class AbstractCli
@@ -311,7 +317,7 @@ public abstract class AbstractCli implements Cli {
// We need to eat any quotes surrounding arguments...
String[] cleanArgs = cleanArgs( args );
String[] cleanArgs = cleanArgs(args);
- CommandLineParser parser = new GnuParser();
+ CommandLineParser parser = new DefaultParser();
return parser.parse( buildDefaultCliOptions(), cleanArgs );
return parser.parse(buildDefaultCliOptions(), cleanArgs);
}
diff --git a/src/test/java/org/codehaus/plexus/tools/cli/TestCli.java b/src/test/java/org/codehaus/plexus/tools/cli/TestCli.java
index 35b1a31..416edcc 100644
index 90f487c..9e2b318 100644
--- a/src/test/java/org/codehaus/plexus/tools/cli/TestCli.java
+++ b/src/test/java/org/codehaus/plexus/tools/cli/TestCli.java
@@ -20,7 +20,7 @@ import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.util.FileUtils;
import org.apache.commons.cli.Options;
@@ -19,7 +19,7 @@ package org.codehaus.plexus.tools.cli;
import java.io.File;
import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.util.FileUtils;
@@ -33,10 +33,11 @@ public class TestCli extends AbstractCli {
}
import java.io.File;
@@ -39,7 +39,7 @@ public class TestCli
public Options buildCliOptions( Options options )
{
options.addOption(
- OptionBuilder.withLongOpt( "name" ).withDescription( "Display name." ).hasArg().create( 'n' ) );
+ Option.builder( "n" ).longOpt( "name" ).desc( "Display name." ).hasArg().build() );
public Options buildCliOptions(Options options) {
- options.addOption(OptionBuilder.withLongOpt("name")
- .withDescription("Display name.")
+ options.addOption(Option.builder( "n" )
+ .longOpt( "name" )
+ .desc( "Display name." )
.hasArg()
- .create('n'));
+ .build() );
return options;
}
--
2.36.1
2.45.2

View File

@ -1,4 +1,4 @@
From ebc5470ee49188a0bdf07aa39138fc78c76f3698 Mon Sep 17 00:00:00 2001
From d737f134f7a93b2443db04031fb4f5949ccb3de3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Thu, 19 May 2022 09:30:58 +0200
Subject: [PATCH 2/2] No unchecked operations
@ -8,18 +8,18 @@ Subject: [PATCH 2/2] No unchecked operations
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
index e173774..575c539 100644
index 7e72f08..9619836 100644
--- a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
+++ b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
@@ -374,7 +374,7 @@ public abstract class AbstractCli
@@ -323,7 +323,7 @@ public abstract class AbstractCli implements Cli {
}
private static String[] cleanArgs( String[] args )
{
private static String[] cleanArgs(String[] args) {
- List cleaned = new ArrayList();
+ List<String> cleaned = new ArrayList<String>();
StringBuffer currentArg = null;
--
2.36.1
2.45.2

View File

@ -2,9 +2,10 @@
<service name="tar_scm" mode="disabled">
<param name="scm">git</param>
<param name="url">https://github.com/codehaus-plexus/plexus-cli.git</param>
<param name="revision">8927458e81</param>
<param name="versionformat">1.6</param>
<param name="filename">plexus-cli</param>
<param name="revision">plexus-cli-1.7</param>
<param name="match-tag">plexus-cli-*</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">plexus-cli-(.*)</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>

BIN
plexus-cli-1.6.tar.xz (Stored with Git LFS)

Binary file not shown.

BIN
plexus-cli-1.7.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,20 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- ===================== - DO NOT EDIT THIS FILE! - ===================== -->
<!-- ====================================================================== -->
<!-- -->
<!-- Any modifications will be overwritten. -->
<!-- -->
<!-- Generated by Maven Ant Plugin on 2/21/19 7:19 AM -->
<!-- See: http://apache.org/plugins/maven-ant-plugin/ -->
<!-- -->
<!-- ====================================================================== -->
<project name="plexus-cli" default="package" basedir=".">
<!-- ====================================================================== -->
@ -25,9 +10,10 @@
<property name="project.groupId" value="org.codehaus.plexus"/>
<property name="project.artifactId" value="plexus-cli"/>
<property name="project.version" value="1.6"/>
<property name="project.version" value="1.7"/>
<property name="compiler.source" value="1.8"/>
<property name="compiler.release" value="8"/>
<property name="compiler.source" value="1.${compiler.release}"/>
<property name="compiler.target" value="${compiler.source}"/>
<property name="build.finalName" value="${project.artifactId}-${project.version}"/>
@ -35,10 +21,7 @@
<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="build.testOutputDir" value="${build.dir}/test-classes"/>
<property name="build.testDir" value="src/test/java"/>
<property name="build.testResourceDir" value="src/test/resources"/>
<property name="test.reports" value="${build.dir}/test-reports"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<!-- ====================================================================== -->
@ -47,15 +30,11 @@
<path id="build.classpath">
<fileset dir="lib">
<!-- plexus-container-default-1.0-alpha-34 plexus-classworlds-2.4
plexus-utils-3.0 commons-cli-1.0 -->
<include name="**/*"/>
</fileset>
</path>
<path id="build.test.classpath">
<fileset dir="lib">
<!-- plexus-container-default-1.0-alpha-34 plexus-classworlds-2.4
plexus-utils-3.0 commons-cli-1.0 junit-3.8.2 guava-20.0 -->
<include name="**/*"/>
</fileset>
</path>
@ -79,6 +58,7 @@
debug="true"
optimize="false"
deprecation="true"
release="${compiler.release}"
target="${compiler.target}"
verbose="false"
fork="false"
@ -90,95 +70,6 @@
</javac>
</target>
<!-- ====================================================================== -->
<!-- Test-compilation target -->
<!-- ====================================================================== -->
<target name="compile-tests"
depends="compile"
description="Compile the test code"
unless="test.skip">
<mkdir dir="${build.testOutputDir}"/>
<javac destdir="${build.testOutputDir}"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.testDir}"/>
</src>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${build.outputDir}"/>
</classpath>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Run all tests -->
<!-- ====================================================================== -->
<target name="test"
depends="compile-tests, junit-missing"
unless="junit.skipped"
description="Run the test cases">
<mkdir dir="${test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${build.outputDir}"/>
<pathelement location="${build.testOutputDir}"/>
</classpath>
<batchtest todir="${test.reports}" unless="test">
<fileset dir="${build.testDir}">
<include name="**/CliTest.java"/>
<exclude name="**/TestCli.java"/>
</fileset>
</batchtest>
<batchtest todir="${test.reports}" if="test">
<fileset dir="${build.testDir}">
<include name="**/${test}.java"/>
<exclude name="**/TestCli.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present" classpathref="build.test.classpath"/>
</target>
<target name="test-junit-status"
depends="test-junit-present">
<condition property="junit.missing">
<and>
<isfalse value="${junit.present}"/>
<isfalse value="${test.skip}"/>
</and>
</condition>
<condition property="junit.skipped">
<or>
<isfalse value="${junit.present}"/>
<istrue value="${test.skip}"/>
</or>
</condition>
</target>
<target name="junit-missing"
depends="test-junit-status"
if="junit.missing">
<echo>=================================== WARNING ===================================</echo>
<echo> JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not executed.</echo>
<echo>===============================================================================</echo>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
@ -211,7 +102,7 @@
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile,test" description="Package the application">
<target name="package" depends="compile" description="Package the application">
<jar jarfile="${build.dir}/${build.finalName}.jar"
compress="true"
index="false"

View File

@ -1,3 +1,26 @@
-------------------------------------------------------------------
Thu Jun 13 17:03:16 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Update to version 1.7
* Changes
+ Bump plexus-components from 6.5 to 10.0
+ Bump checkstyle from 9.2 to 9.2.1
+ Bump plexus-container-default from 1.0-alpha-34 to 2.1.1
+ Bump checkstyle from 9.2.1 to 9.3
+ Bump commons-cli from 1.0 to 1.5.0
+ Bump maven-checkstyle-plugin from 3.1.2 to 3.3.0
+ Bump maven-shared-resources from 4 to 5
+ Bump apache/maven-gh-actions-shared from 1 to 3
+ Update to Parent pom 15
+ Bump commons-cli:commons-cli from 1.5.0 to 1.6.0
+ Reuse plexus-pom action for CI
+ Bump org.codehaus.plexus:plexus from 15 to 16
+ Replace plexus-container-default with Sisu Plexus
+ Bump org.codehaus.plexus:plexus-testing from 1.2.0 to 1.3.0
- Rebased patches:
* 0001-Do-not-use-commons-cli-deprecated-classes.patch
* 0002-No-unchecked-operations.patch
-------------------------------------------------------------------
Sun May 26 22:38:13 UTC 2024 - Fridrich Strba <fstrba@suse.com>

View File

@ -16,9 +16,8 @@
#
%bcond_with tests
Name: plexus-cli
Version: 1.6
Version: 1.7
Release: 0
Summary: Command Line Interface facilitator for Plexus
License: Apache-2.0
@ -38,10 +37,6 @@ BuildRequires: plexus-utils
BuildRequires: sisu-plexus
BuildRequires: xz
BuildArch: noarch
%if %{with tests}
BuildRequires: ant-junit
BuildRequires: guava
%endif
%description
Plexus contains end-to-end developer tools for writing applications.
@ -64,19 +59,11 @@ Javadoc for %{name}.
cp -p %{SOURCE1} .
cp -p %{SOURCE100} build.xml
%pom_change_dep :plexus-container-default org.eclipse.sisu:org.eclipse.sisu.plexus:0.9.0.M2
mkdir -p lib
build-jar-repository -s lib commons-cli plexus/utils plexus/classworlds org.eclipse.sisu.plexus
%if %{with tests}
build-jar-repository -s lib guava/guava
%endif
%build
ant \
%if %{without tests}
-Dtest.skip=true \
%endif
jar javadoc
%install