branch develop updated (38fa00f -> 7db9b2e)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository i18n. See https://gitlab.nuiton.org/nuiton/i18n.git from 38fa00f [jgitflow-maven-plugin]Updating develop poms back to pre merge state new 7db9b2e Split failsIfWarning flag into two new flags failsIfAnyKeyMissingValue and failsIfAnyKeyMissingInBundle Fixes #4009 The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 7db9b2ecf402b35d092960d16c8f085427a507a6 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Sep 1 16:16:02 2016 +0200 Split failsIfWarning flag into two new flags failsIfAnyKeyMissingValue and failsIfAnyKeyMissingInBundle Fixes #4009 Summary of changes: .../org/nuiton/i18n/plugin/AbstractI18nMojo.java | 23 +++++++++++++++--- .../java/org/nuiton/i18n/plugin/GenerateMojo.java | 27 ++++++++++++++++------ .../org/nuiton/i18n/plugin/bundle/BundleMojo.java | 26 +++++++++++++++++++-- 3 files changed, 64 insertions(+), 12 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository i18n. See https://gitlab.nuiton.org/nuiton/i18n.git commit 7db9b2ecf402b35d092960d16c8f085427a507a6 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Sep 1 16:16:02 2016 +0200 Split failsIfWarning flag into two new flags failsIfAnyKeyMissingValue and failsIfAnyKeyMissingInBundle Fixes #4009 --- .../org/nuiton/i18n/plugin/AbstractI18nMojo.java | 23 +++++++++++++++--- .../java/org/nuiton/i18n/plugin/GenerateMojo.java | 27 ++++++++++++++++------ .../org/nuiton/i18n/plugin/bundle/BundleMojo.java | 26 +++++++++++++++++++-- 3 files changed, 64 insertions(+), 12 deletions(-) diff --git a/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java b/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java index 8dccd47..9b8e25a 100644 --- a/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java +++ b/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java @@ -216,20 +216,37 @@ public abstract class AbstractI18nMojo extends AbstractPlugin implements PluginW this.encoding = encoding; } - protected void failsIfWarning(boolean failsIfWarning, BundleValidation bundleValidation) throws MojoFailureException { + protected void failsIfAnyKeyMissingValue(boolean failsIfWarning, BundleValidation bundleValidation) throws MojoFailureException { if (!failsIfWarning) { // no check return; } - if (bundleValidation != null && bundleValidation.isFail()) { + if (bundleValidation != null && bundleValidation.isAnyKeyMissingValue()) { - // there is at least one not complete bundle, faisl the build + // there is at least one not complete bundle, fails the build throw new MojoFailureException( "Bundles for locale(s) " + bundleValidation.getKeysMissingValues().keySet() + " are not complete. Use the -Di18n.showEmpty to see " + "missing translations."); } } + + protected void failsIfAnyKeyMissingInBundle(boolean failsIfWarning, BundleValidation bundleValidation) throws MojoFailureException { + if (!failsIfWarning) { + + // no check + return; + } + + if (bundleValidation != null && bundleValidation.isAnyKeyMissingInBundle()) { + + // there is at least one not complete bundle, fails the build + throw new MojoFailureException( + "Bundles for locale(s) " + bundleValidation.getMissingKeysPerLocale().keySet() + + " are not complete. Use the -Di18n.showEmpty to see " + + "missing keys."); + } + } } diff --git a/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java b/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java index 766a9ff..a38a435 100644 --- a/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java +++ b/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java @@ -88,17 +88,29 @@ public class GenerateMojo extends AbstractI18nGenerateMojo { @Parameter(property = "i18n.showEmpty", defaultValue = "false", required = true) protected boolean showEmpty; + @Parameter(property = "i18n.failsIfWarning", defaultValue = "false") + @Deprecated + protected boolean failsIfWarning; + /** - * A flag to make the build fails if there is some warnings happens while generating bundle - * (says when it misses some translations). + * A flag to make the build fails if there is some missing key values. * - * <b>Note :</b> This parameter should be used in a release profile to - * ensure bundles are complete. + * <b>Note :</b> This parameter should be used in a release profile to ensure bundles are complete. * * @since 3.5.1 */ - @Parameter(property = "i18n.failsIfWarning", defaultValue = "false") - protected boolean failsIfWarning; + @Parameter(property = "i18n.failsIfAnyKeyMissingValue", defaultValue = "false") + protected boolean failsIfAnyKeyMissingValue; + + /** + * A flag to make the build fails if there is some missing keys. + * + * <b>Note :</b> This parameter should be used in a release profile to ensure bundles are complete. + * + * @since 3.5.1 + */ + @Parameter(property = "i18n.failsIfAnyKeyMissingInBundle", defaultValue = "false") + protected boolean failsIfAnyKeyMissingInBundle; /** * To keep a backup of old i18n bundles (suffiex by a {@code ~}). @@ -218,7 +230,8 @@ public class GenerateMojo extends AbstractI18nGenerateMojo { } } - failsIfWarning(failsIfWarning, bundleValidation); + failsIfAnyKeyMissingValue(failsIfWarning || failsIfAnyKeyMissingValue, bundleValidation); + failsIfAnyKeyMissingInBundle(failsIfAnyKeyMissingInBundle, bundleValidation); } } diff --git a/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java b/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java index 69c2925..bbdfd0e 100644 --- a/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java +++ b/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java @@ -29,7 +29,6 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -179,11 +178,33 @@ public class BundleMojo extends AbstractI18nBundleMojo { * ensure bundles are complete. * * @since 2.0 + * @deprecated since 3.6.1, prefer use now {@link #failsIfAnyKeyMissingValue} or {@link #failsIfAnyKeyMissingInBundle}. */ @Parameter(property = "i18n.failsIfWarning", defaultValue = "false") + @Deprecated protected boolean failsIfWarning; /** + * A flag to make the build fails if there is some missing key values. + * + * <b>Note :</b> This parameter should be used in a release profile to ensure bundles are complete. + * + * @since 3.6.1 + */ + @Parameter(property = "i18n.failsIfAnyKeyMissingValue", defaultValue = "false") + protected boolean failsIfAnyKeyMissingValue; + + /** + * A flag to make the build fails if there is some missing keys. + * + * <b>Note :</b> This parameter should be used in a release profile to ensure bundles are complete. + * + * @since 3.6.1 + */ + @Parameter(property = "i18n.failsIfAnyKeyMissingInBundle", defaultValue = "false") + protected boolean failsIfAnyKeyMissingInBundle; + + /** * Contains validation result after {@link #checkBundle(Locale, Properties, boolean, BundleValidation)}. * * May be null if validation is disabled. @@ -443,7 +464,8 @@ public class BundleMojo extends AbstractI18nBundleMojo { } } - failsIfWarning(failsIfWarning, bundleValidation); + failsIfAnyKeyMissingValue(failsIfWarning || failsIfAnyKeyMissingValue, bundleValidation); + failsIfAnyKeyMissingInBundle(failsIfAnyKeyMissingInBundle, bundleValidation); if (generateDefaultLocale) { generateDefaultBundle(); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm