2929 * #L%
3030 */
3131
32+ debug = System . getenv(' DEBUG' )
33+ def debug (msg ) {
34+ if (debug) System . err. println (" [DEBUG] $msg " )
35+ }
36+
3237@Grab (' org.apache.velocity:velocity:1.7' )
3338import org.apache.velocity.app.VelocityEngine
3439
@@ -48,6 +53,8 @@ def timestamp(dir, file) {
4853
4954/* Processes a template using Apache Velocity. */
5055def processTemplate (engine , context , templateFile , outFilename ) {
56+ debug(" processTemplate('$engine ', '$context ', '$templateFile ', '$outFilename ')" )
57+
5158 if (outFilename == null ) return ; // nothing to do
5259
5360 // create output directory if it does not already exist
@@ -89,6 +96,8 @@ def parseValue(sh, translationsFile, key, expression) {
8996 * ...
9097 */
9198def translate (templateSubdirectory , templateFile , translationsFile ) {
99+ debug(" translate('$templateSubdirectory ', '$templateFile ', '$translationsFile ')" )
100+
92101 // initialize the Velocity engine
93102 engine = new org.apache.velocity.app.VelocityEngine ();
94103 p = new java.util.Properties ();
@@ -181,6 +190,8 @@ def translate(templateSubdirectory, templateFile, translationsFile) {
181190
182191/* Recursively translates all templates in the given directory. */
183192def translateDirectory (templateSubdirectory ) {
193+ debug(" translateDirectory('$templateSubdirectory ')" )
194+
184195 for (file in new java.io.File (templateSubdirectory). listFiles()) {
185196 if (file. isDirectory()) {
186197 // process subdirectories recursively
0 commit comments