You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2021/08/08 10:26:59 UTC
[sling-htl-maven-plugin] branch master updated: SLING-10696 switch
to phase "generate-sources" (#3)
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-htl-maven-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 233560a SLING-10696 switch to phase "generate-sources" (#3)
233560a is described below
commit 233560ada6b761814bd3801041d3bdcfbbcadd7c
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Sun Aug 8 12:26:56 2021 +0200
SLING-10696 switch to phase "generate-sources" (#3)
add debug log information per processed HTL script
clarify description of validate mojo
---
src/main/java/org/apache/sling/maven/htl/ValidateMojo.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/htl/ValidateMojo.java b/src/main/java/org/apache/sling/maven/htl/ValidateMojo.java
index 02f1f8a..1378f29 100644
--- a/src/main/java/org/apache/sling/maven/htl/ValidateMojo.java
+++ b/src/main/java/org/apache/sling/maven/htl/ValidateMojo.java
@@ -53,11 +53,11 @@ import org.codehaus.plexus.util.Scanner;
import org.sonatype.plexus.build.incremental.BuildContext;
/**
- * Validates HTL scripts.
+ * Validates HTL scripts and optionally transpiles them to Java classes.
*/
@Mojo(
name = "validate",
- defaultPhase = LifecyclePhase.COMPILE,
+ defaultPhase = LifecyclePhase.GENERATE_SOURCES,
threadSafe = true
)
public class ValidateMojo extends AbstractMojo {
@@ -291,6 +291,7 @@ public class ValidateMojo extends AbstractMojo {
FileUtils.forceMkdirParent(generatedClassFile);
IOUtils.write(javaSourceCode, new FileOutputStream(generatedClassFile), StandardCharsets.UTF_8);
compilationUnit.dispose();
+ getLog().debug(String.format("Transpiled HTL '%s' to Java class '%s'", script, generatedClassFile));
}
return compilationResult;
}
@@ -301,6 +302,7 @@ public class ValidateMojo extends AbstractMojo {
ScriptCompilationUnit scriptCompilationUnit = new ScriptCompilationUnit(sourceDirectory, script);
compilationResult.put(script, compiler.compile(scriptCompilationUnit));
scriptCompilationUnit.dispose();
+ getLog().debug(String.format("Compiled HTL script '%s'", script));
}
return compilationResult;
}