You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/08/01 14:42:09 UTC

[camel] 02/02: CAMEL-12702: Enable validation during built that all the spring boot auto configuration option has documentation for camel-spring-boot module

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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d614666de206146a2c1453434b398cf282d3e6ae
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Aug 1 16:18:45 2018 +0200

    CAMEL-12702: Enable validation during built that all the spring boot auto configuration option has documentation for camel-spring-boot module
---
 components/camel-spring-boot/pom.xml                    |  2 +-
 .../UpdateSpringBootAutoConfigurationReadmeMojo.java    | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml
index 182bf27..b1a0676 100644
--- a/components/camel-spring-boot/pom.xml
+++ b/components/camel-spring-boot/pom.xml
@@ -140,7 +140,7 @@
         <version>${project.version}</version>
         <configuration>
           <!-- set to true to make build fail fast if missing documentation in docs files -->
-          <failFast>false</failFast>
+          <failFast>true</failFast>
           <!-- set to true to make build fail if an option has no description -->
           <failOnMissingDescription>true</failOnMissingDescription>
         </configuration>
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java
index 4473509..d3089a6 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java
@@ -161,7 +161,7 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
                     }
 
                     if (files.size() == 1) {
-                        List models = parseSpringBootAutoConfigureModels(jsonFile, null);
+                        List<SpringBootAutoConfigureOptionModel> models = parseSpringBootAutoConfigureModels(jsonFile, null);
 
                         // special for other kind of JARs that is not a regular Camel component,dataformat,language
                         boolean onlyOther = files.size() == 1 && !hasComponentDataFormatOrLanguage;
@@ -170,6 +170,19 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
                             return;
                         }
                         File docFile = files.get(0);
+
+                        // check for missing description on options
+                        boolean noDescription = false;
+                        for (SpringBootAutoConfigureOptionModel o : models) {
+                            if (StringHelper.isEmpty(o.getDescription())) {
+                                noDescription = true;
+                                getLog().warn("Option " + o.getName() + " has no description");
+                            }
+                        }
+                        if (noDescription && isFailOnNoDescription()) {
+                            throw new MojoExecutionException("Failed build due failOnMissingDescription=true");
+                        }
+
                         String options = templateAutoConfigurationOptions(models);
                         boolean updated = updateAutoConfigureOptions(docFile, options);
                         if (updated) {
@@ -281,7 +294,7 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
 
     private static boolean isValidStarter(String name) {
         // skip these
-        if ("camel-core-starter".equals(name) || "camel-spring-boot-starter".equals(name)) {
+        if ("camel-core-starter".equals(name)) {
             return false;
         }
         return true;