diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index e69de29..c020996 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,14 @@ +/results_* +/*.src.rpm + +/maven-plugin-tools-2.1-src.tar.gz +/maven-plugin-tools-2.6.tar.xz +/maven-plugin-tools-2.7-source-release.zip +/maven-plugin-tools-3.1-source-release.zip +/maven-plugin-tools-3.3-source-release.zip +/maven-plugin-tools-3.4-source-release.zip +/maven-plugin-tools-3.5-source-release.zip +/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 diff --git a/0001-Disable-help-MOJO-generation.patch b/0001-Disable-help-MOJO-generation.patch new file mode 100644 index 0000000..b920c7d --- /dev/null +++ b/0001-Disable-help-MOJO-generation.patch @@ -0,0 +1,214 @@ +From bb0c2f36de5d9c85d00b3549ec9cef6074edd950 Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Mon, 27 Apr 2020 12:52:15 +0200 +Subject: [PATCH 1/3] Disable help MOJO generation + +Forwarded: not-needed +--- + .../plugin/plugin/HelpGeneratorMojo.java | 59 ++++--------- + .../plugin/generator/PluginHelpGenerator.java | 87 +++++++------------ + 2 files changed, 48 insertions(+), 98 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 c5f82ce..9f5c61d 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,15 +28,13 @@ import org.apache.maven.plugin.MojoExecutionException; + import org.apache.maven.plugins.annotations.Component; + import org.apache.maven.plugins.annotations.LifecyclePhase; + 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.GeneratorException; +-import org.apache.maven.tools.plugin.generator.PluginHelpGenerator; +-import org.codehaus.plexus.util.StringUtils; +-import org.codehaus.plexus.velocity.VelocityComponent; +- +-/** +- * Generates a HelpMojo class. ++import org.apache.maven.plugins.annotations.Parameter; ++import org.apache.maven.plugins.annotations.ResolutionScope; ++import org.apache.maven.tools.plugin.generator.GeneratorException; ++import org.codehaus.plexus.util.StringUtils; ++ ++/** ++ * Generates a HelpMojo class. + * Relies at runtime on one output file from {@link DescriptorGeneratorMojo}. + * + * @author Vincent Siveton +@@ -65,18 +63,12 @@ public class HelpGeneratorMojo extends AbstractGeneratorMojo { + * + * @since 2.6 + */ +- @Parameter +- private String helpPackageName; +- +- /** +- * Velocity component. +- */ +- @Component +- private VelocityComponent velocity; +- +- String getHelpPackageName() { +- String packageName = null; +- if (StringUtils.isNotBlank(helpPackageName)) { ++ @Parameter ++ private String helpPackageName; ++ ++ String getHelpPackageName() { ++ String packageName = null; ++ if (StringUtils.isNotBlank(helpPackageName)) { + packageName = helpPackageName; + } + +@@ -98,23 +90,8 @@ public class HelpGeneratorMojo extends AbstractGeneratorMojo { + } + return name; + } +- +- @Override +- protected void generate() throws MojoExecutionException { +- PluginHelpGenerator pluginHelpGenerator = new PluginHelpGenerator() +- .setMavenProject(project) +- .setHelpPackageName(getHelpPackageName()) +- .setGoalPrefix(goalPrefix) +- .setVelocityComponent(velocity); +- +- try { +- pluginHelpGenerator.execute(outputDirectory); +- } catch (GeneratorException e) { +- throw new MojoExecutionException(e.getMessage(), e); +- } +- +- if (!project.getCompileSourceRoots().contains(outputDirectory.getAbsolutePath())) { +- project.addCompileSourceRoot(outputDirectory.getAbsolutePath()); +- } +- } +-} ++ ++ @Override ++ protected void generate() throws MojoExecutionException { ++ } ++} +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 c3806af..9772df9 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 +@@ -24,18 +24,16 @@ import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.OutputStreamWriter; + 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; +- ++import java.io.Writer; ++ ++import org.apache.maven.project.MavenProject; ++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 static java.nio.charset.StandardCharsets.UTF_8; ++ + /** + * Generates an HelpMojo class from help-class-source.vm template. + * The generated mojo reads help content from META-INF/maven/${groupId}/${artifactId}/plugin-help.xml +@@ -51,13 +49,12 @@ public class PluginHelpGenerator extends AbstractLogEnabled { + private static final String HELP_MOJO_CLASS_NAME = "HelpMojo"; + + private String helpPackageName; +- private String goalPrefix; +- private MavenProject mavenProject; +- private boolean useMaven4Api; +- private VelocityComponent velocityComponent; +- +- /** +- * Default constructor ++ private String goalPrefix; ++ private MavenProject mavenProject; ++ private boolean useMaven4Api; ++ ++ /** ++ * Default constructor + */ + public PluginHelpGenerator() { + this.enableLogging(new ConsoleLogger(Logger.LEVEL_INFO, "PluginHelpGenerator")); +@@ -92,17 +89,12 @@ public class PluginHelpGenerator extends AbstractLogEnabled { + + public PluginHelpGenerator setHelpPackageName(String helpPackageName) { + this.helpPackageName = helpPackageName; +- return this; +- } +- +- public PluginHelpGenerator setVelocityComponent(VelocityComponent velocityComponent) { +- this.velocityComponent = velocityComponent; +- return this; +- } +- +- public PluginHelpGenerator setGoalPrefix(String goalPrefix) { +- this.goalPrefix = goalPrefix; +- return this; ++ return this; ++ } ++ ++ public PluginHelpGenerator setGoalPrefix(String goalPrefix) { ++ this.goalPrefix = goalPrefix; ++ return this; + } + + public PluginHelpGenerator setMavenProject(MavenProject mavenProject) { +@@ -112,33 +104,14 @@ public class PluginHelpGenerator extends AbstractLogEnabled { + + // ---------------------------------------------------------------------- + // Private methods +- // ---------------------------------------------------------------------- +- +- private String getHelpClassSources(String pluginHelpPath) throws IOException { +- VelocityContext context = new VelocityContext(); +- boolean useAnnotations = +- mavenProject.getArtifactMap().containsKey("org.apache.maven.plugin-tools:maven-plugin-annotations"); +- +- 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); +- +- 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()); ++ // ---------------------------------------------------------------------- ++ ++ private String getHelpClassSources(String pluginHelpPath) throws IOException { ++ StringWriter stringWriter = new StringWriter(); ++ ++ // 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.46.0 + diff --git a/0002-Remove-dependency-on-jtidy.patch b/0002-Remove-dependency-on-jtidy.patch new file mode 100644 index 0000000..cc8a8f7 --- /dev/null +++ b/0002-Remove-dependency-on-jtidy.patch @@ -0,0 +1,154 @@ +From fd02c57beb987437b4fb10066e22831a17119873 Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Mon, 27 Apr 2020 12:56:04 +0200 +Subject: [PATCH 2/3] Remove dependency on jtidy + +Forwarded: not-needed +--- + .../plugin/generator/GeneratorUtils.java | 85 +++++-------------- + .../PluginDescriptorFilesGenerator.java | 19 ++--- + 2 files changed, 26 insertions(+), 78 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 8b04522..2621b9f 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,13 +48,12 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor; + import org.apache.maven.plugin.descriptor.PluginDescriptor; + import org.apache.maven.project.MavenProject; + 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; +- +-/** +- * Convenience methods to play with Maven plugins. ++import org.codehaus.plexus.component.repository.ComponentDependency; ++import org.codehaus.plexus.util.StringUtils; ++import org.codehaus.plexus.util.xml.XMLWriter; ++ ++/** ++ * Convenience methods to play with Maven plugins. + * + * @author jdcasey + */ +@@ -222,58 +221,12 @@ public final class GeneratorUtils { + } + matcher.appendTail(decoded); + +- return decoded.toString(); +- } +- +- /** +- * Fixes some javadoc comment to become a valid XHTML snippet. +- * +- * @param description Javadoc description with HTML tags, may be null. +- * @return The description with valid XHTML tags, never null. +- * @deprecated Redundant for java extractor +- */ +- @Deprecated +- public static String makeHtmlValid(String description) { +- +- if (description == null || description.isEmpty()) { +- return ""; +- } +- +- 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(true); +- +- 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("" + ls) + 6 + ls.length(); +- int endPos = commentCleaned.indexOf(ls + ""); +- commentCleaned = commentCleaned.substring(startPos, endPos); +- +- return commentCleaned; +- } +- +- /** +- * 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: ++ return decoded.toString(); ++ } ++ ++ /** ++ * 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: + *