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/02 12:32:33 UTC

[sling-htl-maven-plugin] branch SLING-10696-phase-generate-sources created (now 95529cb)

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a change to branch SLING-10696-phase-generate-sources
in repository https://gitbox.apache.org/repos/asf/sling-htl-maven-plugin.git.


      at 95529cb  SLING-10696 switch to phase "generate-sources"

This branch includes the following new commits:

     new 95529cb  SLING-10696 switch to phase "generate-sources"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[sling-htl-maven-plugin] 01/01: SLING-10696 switch to phase "generate-sources"

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch SLING-10696-phase-generate-sources
in repository https://gitbox.apache.org/repos/asf/sling-htl-maven-plugin.git

commit 95529cbbf3b5abb085edc63f5a7e8721eb437fb1
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Mon Aug 2 14:32:19 2021 +0200

    SLING-10696 switch to phase "generate-sources"
    
    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;
     }