Update to upstream version 3.9.0

This commit is contained in:
Marian Koncek 2023-08-16 11:55:35 +02:00
parent dff4a2897c
commit 668ea21a2e
6 changed files with 202 additions and 161 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@
/maven-plugin-tools-3.5.1-source-release.zip
/maven-plugin-tools-3.6.0-source-release.zip
/maven-plugin-tools-3.6.4-source-release.zip
/maven-plugin-tools-3.9.0-source-release.zip

View File

@ -3,25 +3,28 @@ From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Mon, 27 Apr 2020 12:52:15 +0200
Subject: [PATCH 1/3] Disable help MOJO generation
Forwarded: not-needed
---
.../plugin/plugin/HelpGeneratorMojo.java | 20 +------------------
.../generator/PluginDescriptorGenerator.java | 11 ----------
2 files changed, 1 insertion(+), 30 deletions(-)
.../plugin/plugin/HelpGeneratorMojo.java | 23 ----------------
.../plugin/generator/PluginHelpGenerator.java | 27 -------------------
2 files changed, 50 deletions(-)
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/HelpGeneratorMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/HelpGeneratorMojo.java
index 7cc472e5..a51430d1 100644
index eeadd65e..a7220d71 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/HelpGeneratorMojo.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/HelpGeneratorMojo.java
@@ -28,8 +28,6 @@ import org.apache.maven.plugins.annotations.Mojo;
@@ -31,9 +31,7 @@ import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.tools.plugin.generator.Generator;
import org.apache.maven.tools.plugin.generator.GeneratorException;
-import org.apache.maven.tools.plugin.generator.PluginHelpGenerator;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.velocity.VelocityComponent;
/**
* Generates a <code>HelpMojo</code> class.
@@ -58,12 +56,6 @@ public class HelpGeneratorMojo
@@ -68,12 +66,6 @@ public class HelpGeneratorMojo extends AbstractGeneratorMojo {
@Parameter
private String helpPackageName;
@ -31,62 +34,95 @@ index 7cc472e5..a51430d1 100644
- @Component
- private VelocityComponent velocity;
-
/**
* {@inheritDoc}
*/
@@ -79,7 +71,7 @@ public class HelpGeneratorMojo
@Override
protected Generator createGenerator()
{
- return new PluginHelpGenerator().setHelpPackageName( helpPackageName ).setVelocityComponent( this.velocity );
+ return null;
}
String getHelpPackageName() {
String packageName = null;
if (StringUtils.isNotBlank(helpPackageName)) {
@@ -101,20 +93,5 @@ public class HelpGeneratorMojo extends AbstractGeneratorMojo {
/**
@@ -89,16 +81,6 @@ public class HelpGeneratorMojo
public void execute()
throws MojoExecutionException
{
- // force value for this plugin
- skipErrorNoDescriptorsFound = true;
@Override
protected void generate() throws MojoExecutionException {
- PluginHelpGenerator pluginHelpGenerator = new PluginHelpGenerator()
- .setMavenProject(project)
- .setHelpPackageName(getHelpPackageName())
- .setGoalPrefix(goalPrefix)
- .setVelocityComponent(velocity);
-
- super.execute();
-
- if ( !project.getCompileSourceRoots().contains( outputDirectory.getAbsolutePath() ) && !skip )
- {
- project.addCompileSourceRoot( outputDirectory.getAbsolutePath() );
- try {
- pluginHelpGenerator.execute(outputDirectory);
- } catch (GeneratorException e) {
- throw new MojoExecutionException(e.getMessage(), e);
- }
-
- if (!project.getCompileSourceRoots().contains(outputDirectory.getAbsolutePath())) {
- project.addCompileSourceRoot(outputDirectory.getAbsolutePath());
- }
}
}
diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java
index 474a92d6..4d706332 100644
--- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java
+++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java
@@ -27,12 +27,10 @@ import java.io.StringWriter;
import java.io.Writer;
import org.apache.maven.project.MavenProject;
-import org.apache.velocity.VelocityContext;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
import org.codehaus.plexus.util.io.CachingOutputStream;
-import org.codehaus.plexus.velocity.VelocityComponent;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -54,7 +52,6 @@ public class PluginHelpGenerator extends AbstractLogEnabled {
private String goalPrefix;
private MavenProject mavenProject;
private boolean useMaven4Api;
- private VelocityComponent velocityComponent;
/**
* Default constructor
@@ -95,11 +92,6 @@ public class PluginHelpGenerator extends AbstractLogEnabled {
return this;
}
}
diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
index 6e777c08..3d3f8c59 100644
--- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
+++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
@@ -65,22 +65,11 @@ public class PluginDescriptorGenerator
public void execute( File destinationDirectory, PluginToolsRequest request )
throws GeneratorException
{
- // eventually rewrite help mojo class to match actual package name
- PluginHelpGenerator.rewriteHelpMojo( request, log );
- public PluginHelpGenerator setVelocityComponent(VelocityComponent velocityComponent) {
- this.velocityComponent = velocityComponent;
- return this;
- }
-
try
{
// write complete plugin.xml descriptor
File f = new File( destinationDirectory, "plugin.xml" );
writeDescriptor( f, request, false );
public PluginHelpGenerator setGoalPrefix(String goalPrefix) {
this.goalPrefix = goalPrefix;
return this;
@@ -115,27 +107,8 @@ public class PluginHelpGenerator extends AbstractLogEnabled {
// ----------------------------------------------------------------------
private String getHelpClassSources(String pluginHelpPath) throws IOException {
- VelocityContext context = new VelocityContext();
- boolean useAnnotations =
- mavenProject.getArtifactMap().containsKey("org.apache.maven.plugin-tools:maven-plugin-annotations");
-
- // write plugin-help.xml help-descriptor
- MavenProject mavenProject = request.getProject();
- context.put("helpPackageName", helpPackageName);
- context.put("pluginHelpPath", pluginHelpPath);
- context.put("artifactId", mavenProject.getArtifactId());
- // TODO: evaluate prefix from deserialized plugin
- context.put("goalPrefix", goalPrefix);
- context.put("useAnnotations", useAnnotations);
-
- f = new File( destinationDirectory,
- PluginHelpGenerator.getPluginHelpPath( mavenProject ) );
-
- writeDescriptor( f, request, true );
}
catch ( IOException e )
{
StringWriter stringWriter = new StringWriter();
- // plugin-tools sources are UTF-8 (and even ASCII in this case))
- try (InputStream is = Thread.currentThread()
- .getContextClassLoader()
- .getResourceAsStream(useMaven4Api ? "help-class-source-v4.vm" : "help-class-source.vm"); //
- InputStreamReader isReader = new InputStreamReader(is, UTF_8)) {
- // isReader =
- velocityComponent.getEngine().evaluate(context, stringWriter, "", isReader);
- }
// Apply OS lineSeparator instead of template's lineSeparator to have consistent separators for
// all source files.
return stringWriter.toString().replaceAll("(\r\n|\n|\r)", System.lineSeparator());
--
2.35.1
2.41.0

View File

@ -3,23 +3,26 @@ From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Mon, 27 Apr 2020 12:56:04 +0200
Subject: [PATCH 2/3] Remove dependency on jtidy
Forwarded: not-needed
---
.../plugin/generator/GeneratorUtils.java | 55 +------------------
1 file changed, 1 insertion(+), 54 deletions(-)
.../plugin/generator/GeneratorUtils.java | 49 +------------------
.../PluginDescriptorFilesGenerator.java | 7 +--
2 files changed, 2 insertions(+), 54 deletions(-)
diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
index e9ec47fe..1393b507 100644
index 99aa7965..f05fb876 100644
--- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
+++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
@@ -52,7 +52,6 @@ import org.apache.maven.reporting.MavenReport;
@@ -51,7 +51,6 @@ import org.apache.maven.reporting.MavenReport;
import org.codehaus.plexus.component.repository.ComponentDependency;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.XMLWriter;
-import org.w3c.tidy.Tidy;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -262,58 +261,6 @@ public final class GeneratorUtils
/**
* Convenience methods to play with Maven plugins.
@@ -225,52 +224,6 @@ public final class GeneratorUtils {
return decoded.toString();
}
@ -28,49 +31,43 @@ index e9ec47fe..1393b507 100644
- *
- * @param description Javadoc description with HTML tags, may be <code>null</code>.
- * @return The description with valid XHTML tags, never <code>null</code>.
- * @deprecated Redundant for java extractor
- */
- public static String makeHtmlValid( String description )
- {
- if ( StringUtils.isEmpty( description ) )
- {
- @Deprecated
- public static String makeHtmlValid(String description) {
-
- if (description == null || description.isEmpty()) {
- return "";
- }
-
- String commentCleaned = decodeJavadocTags( description );
- String commentCleaned = decodeJavadocTags(description);
-
- // Using jTidy to clean comment
- Tidy tidy = new Tidy();
- tidy.setDocType( "loose" );
- tidy.setXHTML( true );
- tidy.setXmlOut( true );
- tidy.setInputEncoding( "UTF-8" );
- tidy.setOutputEncoding( "UTF-8" );
- tidy.setMakeClean( true );
- tidy.setNumEntities( true );
- tidy.setQuoteNbsp( false );
- tidy.setQuiet( true );
- tidy.setShowWarnings( false );
- try
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream( commentCleaned.length() + 256 );
- tidy.parse( new ByteArrayInputStream( commentCleaned.getBytes( UTF_8 ) ), out );
- commentCleaned = out.toString( "UTF-8" );
- }
- catch ( UnsupportedEncodingException e )
- {
- // cannot happen as every JVM must support UTF-8, see also class javadoc for java.nio.charset.Charset
- }
- tidy.setDocType("loose");
- tidy.setXHTML(true);
- tidy.setXmlOut(true);
- tidy.setInputEncoding("UTF-8");
- tidy.setOutputEncoding("UTF-8");
- tidy.setMakeClean(true);
- tidy.setNumEntities(true);
- tidy.setQuoteNbsp(false);
- tidy.setQuiet(true);
- tidy.setShowWarnings(true);
-
- if ( StringUtils.isEmpty( commentCleaned ) )
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream(commentCleaned.length() + 256);
- tidy.parse(new ByteArrayInputStream(commentCleaned.getBytes(StandardCharsets.UTF_8)), out);
- commentCleaned = new String(out.toByteArray(), StandardCharsets.UTF_8);
-
- if (commentCleaned == null || commentCleaned.isEmpty()) {
- return "";
- }
-
- // strip the header/body stuff
- String ls = System.getProperty( "line.separator" );
- int startPos = commentCleaned.indexOf( "<body>" + ls ) + 6 + ls.length();
- int endPos = commentCleaned.indexOf( ls + "</body>" );
- commentCleaned = commentCleaned.substring( startPos, endPos );
- String ls = System.getProperty("line.separator");
- int startPos = commentCleaned.indexOf("<body>" + ls) + 6 + ls.length();
- int endPos = commentCleaned.indexOf(ls + "</body>");
- commentCleaned = commentCleaned.substring(startPos, endPos);
-
- return commentCleaned;
- }
@ -78,15 +75,33 @@ index e9ec47fe..1393b507 100644
/**
* Converts a HTML fragment as extracted from a javadoc comment to a plain text string. This method tries to retain
* as much of the text formatting as possible by means of the following transformations:
@@ -345,7 +292,7 @@ public final class GeneratorUtils
@@ -301,7 +254,7 @@ public final class GeneratorUtils {
HTMLEditorKit.ParserCallback htmlCallback = new MojoParserCallback(sb);
try
{
- parser.parse( new StringReader( makeHtmlValid( html ) ), htmlCallback, true );
+ parser.parse( new StringReader( html ), htmlCallback, true );
try {
- parser.parse(new StringReader(makeHtmlValid(html)), htmlCallback, true);
+ parser.parse(new StringReader(html), htmlCallback, true);
} catch (IOException e) {
throw new RuntimeException(e);
}
catch ( IOException e )
{
diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java
index cf5c5c48..9f435f0e 100644
--- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java
+++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java
@@ -201,12 +201,7 @@ public class PluginDescriptorFilesGenerator implements Generator {
*/
private static String getTextValue(DescriptorType type, boolean containsXhtmlValue, String text) {
final String xhtmlText;
- if (!containsXhtmlValue) // text comes from legacy extractor
- {
- xhtmlText = GeneratorUtils.makeHtmlValid(text);
- } else {
- xhtmlText = text;
- }
+ xhtmlText = text;
if (type != DescriptorType.XHTML) {
return new HtmlToPlainTextConverter().convert(text);
} else {
--
2.35.1
2.41.0

View File

@ -3,15 +3,17 @@ From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Mon, 27 Apr 2020 12:57:13 +0200
Subject: [PATCH 3/3] Disable reporting
Forwarded: not-needed
---
.../plugin/generator/GeneratorUtils.java | 62 -------------------
1 file changed, 62 deletions(-)
.../plugin/generator/GeneratorUtils.java | 47 -------------------
1 file changed, 47 deletions(-)
diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
index 1393b507..3f8d05e4 100644
index f05fb876..c4664769 100644
--- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
+++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
@@ -48,7 +48,6 @@ import org.apache.maven.artifact.DependencyResolutionRequiredException;
@@ -47,7 +47,6 @@ import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
@ -19,10 +21,11 @@ index 1393b507..3f8d05e4 100644
import org.codehaus.plexus.component.repository.ComponentDependency;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.XMLWriter;
@@ -605,65 +604,4 @@ public final class GeneratorUtils
@@ -503,50 +502,4 @@ public final class GeneratorUtils {
return packageName;
}
-
- /**
- * @param impl a Mojo implementation, not null
- * @param project a MavenProject instance, could be null
@ -30,61 +33,45 @@ index 1393b507..3f8d05e4 100644
- * <code>false</code> otherwise.
- * @throws IllegalArgumentException if any
- */
- @SuppressWarnings( "unchecked" )
- public static boolean isMavenReport( String impl, MavenProject project )
- throws IllegalArgumentException
- {
- if ( impl == null )
- {
- throw new IllegalArgumentException( "mojo implementation should be declared" );
- @SuppressWarnings("unchecked")
- public static boolean isMavenReport(String impl, MavenProject project) throws IllegalArgumentException {
- if (impl == null) {
- throw new IllegalArgumentException("mojo implementation should be declared");
- }
-
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- if ( project != null )
- {
- if (project != null) {
- List<String> classPathStrings;
- try
- {
- try {
- classPathStrings = project.getCompileClasspathElements();
- if ( project.getExecutionProject() != null )
- {
- classPathStrings.addAll( project.getExecutionProject().getCompileClasspathElements() );
- if (project.getExecutionProject() != null) {
- classPathStrings.addAll(project.getExecutionProject().getCompileClasspathElements());
- }
- }
- catch ( DependencyResolutionRequiredException e )
- {
- throw new IllegalArgumentException( e );
- } catch (DependencyResolutionRequiredException e) {
- throw new IllegalArgumentException(e);
- }
-
- List<URL> urls = new ArrayList<>( classPathStrings.size() );
- for ( String classPathString : classPathStrings )
- {
- try
- {
- urls.add( new File( classPathString ).toURL() );
- }
- catch ( MalformedURLException e )
- {
- throw new IllegalArgumentException( e );
- List<URL> urls = new ArrayList<>(classPathStrings.size());
- for (String classPathString : classPathStrings) {
- try {
- urls.add(new File(classPathString).toURL());
- } catch (MalformedURLException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- classLoader = new URLClassLoader( urls.toArray( new URL[urls.size()] ), classLoader );
- classLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]), classLoader);
- }
-
- try
- {
- Class<?> clazz = Class.forName( impl, false, classLoader );
- try {
- Class<?> clazz = Class.forName(impl, false, classLoader);
-
- return MavenReport.class.isAssignableFrom( clazz );
- }
- catch ( ClassNotFoundException e )
- {
- return MavenReport.class.isAssignableFrom(clazz);
- } catch (ClassNotFoundException e) {
- return false;
- }
- }
-
}
--
2.35.1
2.41.0

View File

@ -1,11 +1,11 @@
%bcond_with bootstrap
Name: maven-plugin-tools
Version: 3.6.4
Release: 5%{?dist}
Version: 3.9.0
Release: 1%{?dist}
Summary: Maven Plugin Tools
License: Apache-2.0
URL: http://maven.apache.org/plugin-tools/
URL: https://maven.apache.org/plugin-tools/
BuildArch: noarch
ExclusiveArch: %{java_arches} noarch
@ -39,6 +39,8 @@ BuildRequires: mvn(org.eclipse.sisu:org.eclipse.sisu.plexus)
BuildRequires: mvn(org.ow2.asm:asm)
BuildRequires: mvn(org.ow2.asm:asm-commons)
BuildRequires: mvn(org.sonatype.plexus:plexus-build-api)
BuildRequires: mvn(org.eclipse.sisu:sisu-maven-plugin)
BuildRequires: mvn(org.jsoup:jsoup)
%endif
%description
@ -97,14 +99,14 @@ Obsoletes: %{name}-javadocs < 3.6.4-3
%description javadoc
API documentation for %{name}.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
find -name '*.java' -exec sed -i 's/\r//' {} +
%patch 1 -p1
%patch 2 -p1
%patch 3 -p1
%pom_remove_plugin :maven-enforcer-plugin
rm -r maven-plugin-tools-api/src/test/resources/javadoc
%pom_xpath_inject "pom:project/pom:properties" "
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -113,21 +115,20 @@ API documentation for %{name}.
%pom_xpath_remove "pom:execution[pom:id='generated-helpmojo']" maven-plugin-plugin
%pom_disable_module maven-script
%pom_disable_module maven-plugin-report-plugin
%pom_remove_dep -r :maven-reporting-impl
%pom_remove_dep -r :maven-reporting-api
%pom_remove_dep -r :plexus-velocity
%pom_remove_dep -r :velocity
%pom_remove_dep -r :jtidy
%pom_remove_dep -r :doxia-sink-api
%pom_remove_dep -r :doxia-site-renderer
%pom_remove_plugin -r :spotless-maven-plugin
%pom_remove_dep org.junit:junit-bom
%pom_remove_dep :maven-plugin-tools-ant maven-plugin-plugin
%pom_remove_dep :maven-plugin-tools-beanshell maven-plugin-plugin
rm maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/Plugin{Help,Xdoc}Generator.java
rm maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java
rm maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java
%build
%mvn_build -s -f
@ -135,7 +136,6 @@ rm maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport
%install
%mvn_install
%files -f .mfiles-maven-plugin-tools
%license LICENSE NOTICE
@ -157,8 +157,10 @@ rm maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport
%files javadoc -f .mfiles-javadoc
%license LICENSE NOTICE
%changelog
* Wed Aug 16 2023 Marian Koncek <mkoncek@redhat.com> - 3.9.0-1
- Update to upstream version 3.9.0
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (maven-plugin-tools-3.6.4-source-release.zip) = d6a9c46ad324d77258cb2ccdddf7d3673734f9412c2863d21cde10a3853c1bcd1d15427851b49660d19c2707e2116d10aace13876c656d23c178998717970c07
SHA512 (maven-plugin-tools-3.9.0-source-release.zip) = b4cc3345875c80f74fee4a854b80792880719dfbd733fc150c1875d16953a31875e3cec5cde81e196fb13105dd77a770ace720cd2c982dcc8d6c6b99ac12c196