camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/9] camel git commit: Add goal to mvn plugin to validate if component docs is present when building each component.
Date Fri, 19 Jun 2015 15:32:37 GMT
Add goal to mvn plugin to validate if component docs is present when building each component.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8c0039b3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8c0039b3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8c0039b3

Branch: refs/heads/master
Commit: 8c0039b3d7b93750586b7c2c099eda9b5ca7720d
Parents: 572f9e2
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Jun 19 16:23:43 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jun 19 17:38:08 2015 +0200

----------------------------------------------------------------------
 components/camel-salesforce/pom.xml             | 30 ++++++++++++++++++++
 .../maven/packaging/PrepareCatalogMojo.java     |  2 ++
 .../maven/packaging/ValidateComponentMojo.java  | 26 ++++++++++-------
 .../camel/maven/packaging/ValidateHelper.java   |  4 +--
 4 files changed, 48 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8c0039b3/components/camel-salesforce/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/pom.xml b/components/camel-salesforce/pom.xml
index 61ccca7..b110ff0 100644
--- a/components/camel-salesforce/pom.xml
+++ b/components/camel-salesforce/pom.xml
@@ -35,6 +35,36 @@
         <module>camel-salesforce-maven-plugin</module>
     </modules>
 
+ <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <!-- TODO: remove all this when we have salesforce documented -->
+          <validate>false</validate>
+        </configuration>
+        <executions>
+          <execution>
+            <id>prepare</id>
+            <goals>
+              <goal>prepare-components</goal>
+            </goals>
+            <phase>generate-resources</phase>
+         </execution>
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate-components</goal>
+            </goals>
+            <phase>prepare-package</phase>
+         </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
     <profiles>
 
       <profile>

http://git-wip-us.apache.org/repos/asf/camel/blob/8c0039b3/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
index 8405781..169486b 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
@@ -169,6 +169,8 @@ public class PrepareCatalogMojo extends AbstractMojo {
         executeXmlSchemas();
     }
 
+    // TODO: Remove some of the missing check as we should have that out of the box with
the validate goal
+
     protected void executeModel() throws MojoExecutionException, MojoFailureException {
         getLog().info("Copying all Camel model json descriptors");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/8c0039b3/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
index 58b3b11..79b30ab 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
@@ -93,27 +93,29 @@ public class ValidateComponentMojo extends AbstractMojo {
      */
     public void execute() throws MojoExecutionException, MojoFailureException {
 
-        final Set<File> jsonFiles = new TreeSet<>();
-        PackageHelper.findJsonFiles(outDir, jsonFiles, new PackageHelper.CamelComponentsModelFilter());
+        if (!validate) {
+            getLog().info("Validation disabled");
+        } else {
 
-        boolean failed = false;
-        if (validate) {
-            getLog().info("Validating ...");
+            final Set<File> jsonFiles = new TreeSet<File>();
+            PackageHelper.findJsonFiles(outDir, jsonFiles, new PackageHelper.CamelComponentsModelFilter());
+            boolean failed = false;
 
             for (File file : jsonFiles) {
                 final String name = asName(file);
                 final ErrorDetail detail = new ErrorDetail();
 
+                getLog().debug("Validating file " + file);
                 validate(file, detail);
 
                 if (detail.hasErrors()) {
                     failed = true;
-                    getLog().warn("The " + detail.getKind() + ": " + name + " has errors!");
+                    getLog().warn("The " + detail.getKind() + ": " + name + " has validation
errors");
                     if (detail.isMissingDescription()) {
-                        getLog().warn("Missing description on " + detail.getKind());
+                        getLog().warn("Missing description on: " + detail.getKind());
                     }
                     if (detail.isMissingLabel()) {
-                        getLog().warn("Missing label on " + detail.getKind());
+                        getLog().warn("Missing label on: " + detail.getKind());
                     }
                     if (detail.isMissingSyntax()) {
                         getLog().warn("Missing syntax on endpoint");
@@ -129,10 +131,12 @@ public class ValidateComponentMojo extends AbstractMojo {
                     }
                 }
             }
-        }
 
-        if (failed) {
-            throw new MojoFailureException("There are validation errors, see above!");
+            if (failed) {
+                throw new MojoFailureException("Validating failed, see errors above!");
+            } else {
+                getLog().info("Validation complete");
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/8c0039b3/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
index 4db0e73..ac52996 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
@@ -39,8 +39,6 @@ public final class ValidateHelper {
      * @param errorDetail details to add errors
      */
     public static void validate(File file, ErrorDetail errorDetail) {
-        String name = asName(file);
-
         try {
             String json = loadText(new FileInputStream(file));
 
@@ -86,7 +84,7 @@ public final class ValidateHelper {
                 errorDetail.setMissingDescription(true);
             }
             if (!syntax) {
-                errorDetail.setMissingDescription(true);
+                errorDetail.setMissingSyntax(true);
             }
 
             if (isComponent) {


Mime
View raw message