File 0002-Handle-also-the-velocity-stuff-in-ModelloCli.patch of Package modello
From bd8485edf7adec243890deaaeb20f45bd539e8b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Sat, 15 Mar 2025 08:04:34 +0100
Subject: [PATCH 2/2] Handle also the velocity stuff in ModelloCli
---
.../java/org/codehaus/modello/ModelloCli.java | 22 +++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/modello-core/src/main/java/org/codehaus/modello/ModelloCli.java b/modello-core/src/main/java/org/codehaus/modello/ModelloCli.java
index db40052ce..7bed3863a 100644
--- a/modello-core/src/main/java/org/codehaus/modello/ModelloCli.java
+++ b/modello-core/src/main/java/org/codehaus/modello/ModelloCli.java
@@ -23,8 +23,10 @@ package org.codehaus.modello;
*/
import java.io.File;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import java.util.stream.Collectors;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.XmlStreamReader;
@@ -124,6 +126,21 @@ public class ModelloCli {
if (args.length > 7) {
parameters.put(ModelloParameterConstants.DOM_AS_XPP3, args[7]);
}
+
+ if (args.length > 8 && StringUtils.equalsIgnoreCase(outputType, "velocity")) {
+ parameters.put("modello.velocity.basedir", args[8]);
+ }
+
+ if (args.length > 9 && StringUtils.equalsIgnoreCase(outputType, "velocity")) {
+ parameters.put("modello.velocity.templates", args[9]);
+ }
+
+ if (args.length > 10 && StringUtils.equalsIgnoreCase(outputType, "velocity")) {
+ parameters.put(
+ "modello.velocity.parameters", (HashMap<String, String>) Arrays.asList(args[10].split(",")).stream()
+ .map(s -> s.split("="))
+ .collect(Collectors.toMap(e -> e[0], e -> e[1])));
+ }
}
// ----------------------------------------------------------------------
@@ -131,7 +148,8 @@ public class ModelloCli {
// ----------------------------------------------------------------------
private static void usage() {
- System.err.println("Usage: modello <model> <outputType> <output directory> <modelVersion> <packageWithVersion>"
- + " <javaSource> [<encoding> [<domAsXpp3>]]");
+ System.err.println(
+ "Usage: modello <model> <outputType> <output directory> <modelVersion> <packageWithVersion>"
+ + " <javaSource> [<encoding> [<domAsXpp3> [<velocityBaseDir> <velocityTemplates> <velocityParameters>]]] ");
}
}
--
2.49.0