Class AbstractXmlValidationTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.SourceTask
name.jurgenei.gradle.xml.AbstractXmlValidationTask
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, ValidationTaskSpec, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.api.tasks.util.PatternFilterable, org.gradle.util.Configurable<org.gradle.api.Task>
Direct Known Subclasses:
SchematronTask, XsdTask

@DisableCachingByDefault(because="Validation is I/O heavy and depends on external schema resources") public abstract class AbstractXmlValidationTask extends org.gradle.api.tasks.SourceTask implements ValidationTaskSpec
Shared base task for XSD and Schematron validations producing SVRL and optional JUnit reports.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a validation task with default conventions.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    fileset(Object baseDir, org.gradle.api.Action<? super org.gradle.api.file.ConfigurableFileTree> configureAction)
    Adds an Ant-like fileset rooted at baseDir.
    abstract org.gradle.api.provider.Property<Boolean>
    Returns whether validation findings fail the build.
    abstract org.gradle.api.file.DirectoryProperty
    Returns the directory used for generated JUnit XML files.
    abstract org.gradle.api.provider.Property<String>
    Returns the testsuite name used in JUnit report generation.
    abstract org.gradle.api.provider.Property<Integer>
    Returns the maximum number of failures to aggregate.
    abstract org.gradle.api.file.DirectoryProperty
    Returns the destination directory for generated SVRL files.
    abstract org.gradle.api.provider.Property<String>
    Returns the output extension used when writing SVRL files.
    abstract org.gradle.api.provider.MapProperty<String,String>
    Returns task parameters passed to the active validation engine.
    abstract org.gradle.api.provider.Property<ReportFormat>
    Returns the configured report format.
    org.gradle.api.file.FileTree
     
    abstract org.gradle.api.provider.Property<Integer>
    Returns the number of workers used for concurrent validation.
    void
    param(String name, Object value)
    Adds a validation parameter available to concrete engines.
    protected abstract ValidationResult
    validate(File inputFile, Map<String,String> params)
    Validates a single input file and returns normalized findings.
    void
    Executes validation for all resolved source files.

    Methods inherited from class org.gradle.api.tasks.SourceTask

    exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSet, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSource, source

    Methods inherited from class org.gradle.api.internal.ConventionTask

    conventionMapping, conventionMapping, getConventionMapping

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • AbstractXmlValidationTask

      public AbstractXmlValidationTask()
      Creates a validation task with default conventions.
  • Method Details

    • getOutputDir

      @OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDir()
      Description copied from interface: ValidationTaskSpec
      Returns the destination directory for generated SVRL files.
      Specified by:
      getOutputDir in interface ValidationTaskSpec
      Returns:
      destination directory for SVRL outputs
    • getOutputExtension

      @Input public abstract org.gradle.api.provider.Property<String> getOutputExtension()
      Description copied from interface: ValidationTaskSpec
      Returns the output extension used when writing SVRL files.
      Specified by:
      getOutputExtension in interface ValidationTaskSpec
      Returns:
      output extension used for SVRL file mapping
    • getWorkers

      @Input public abstract org.gradle.api.provider.Property<Integer> getWorkers()
      Description copied from interface: ValidationTaskSpec
      Returns the number of workers used for concurrent validation.
      Specified by:
      getWorkers in interface ValidationTaskSpec
      Returns:
      number of parallel workers for multi-file validation
    • getFailOnError

      @Input public abstract org.gradle.api.provider.Property<Boolean> getFailOnError()
      Description copied from interface: ValidationTaskSpec
      Returns whether validation findings fail the build.
      Specified by:
      getFailOnError in interface ValidationTaskSpec
      Returns:
      whether validation findings should fail the build
    • getMaxFailures

      @Input public abstract org.gradle.api.provider.Property<Integer> getMaxFailures()
      Description copied from interface: ValidationTaskSpec
      Returns the maximum number of failures to aggregate.
      Specified by:
      getMaxFailures in interface ValidationTaskSpec
      Returns:
      maximum number of failures to aggregate before stopping
    • getReportFormat

      @Input public abstract org.gradle.api.provider.Property<ReportFormat> getReportFormat()
      Description copied from interface: ValidationTaskSpec
      Returns the configured report format.
      Specified by:
      getReportFormat in interface ValidationTaskSpec
      Returns:
      selected report format(s)
    • getJunitOutputDir

      @OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getJunitOutputDir()
      Description copied from interface: ValidationTaskSpec
      Returns the directory used for generated JUnit XML files.
      Specified by:
      getJunitOutputDir in interface ValidationTaskSpec
      Returns:
      destination directory for generated JUnit XML reports
    • getJunitSuiteName

      @Input public abstract org.gradle.api.provider.Property<String> getJunitSuiteName()
      Description copied from interface: ValidationTaskSpec
      Returns the testsuite name used in JUnit report generation.
      Specified by:
      getJunitSuiteName in interface ValidationTaskSpec
      Returns:
      JUnit suite name used for generated reports
    • getParams

      @Input public abstract org.gradle.api.provider.MapProperty<String,String> getParams()
      Description copied from interface: ValidationTaskSpec
      Returns task parameters passed to the active validation engine.
      Specified by:
      getParams in interface ValidationTaskSpec
      Returns:
      task-level parameters consumed by validation engines
    • param

      public void param(String name, Object value)
      Adds a validation parameter available to concrete engines.
      Parameters:
      name - parameter name, must not be null
      value - parameter value converted to string
    • fileset

      public void fileset(Object baseDir, org.gradle.api.Action<? super org.gradle.api.file.ConfigurableFileTree> configureAction)
      Adds an Ant-like fileset rooted at baseDir.
      Parameters:
      baseDir - base directory object accepted by Project.fileTree
      configureAction - include/exclude configuration action
    • getSource

      @PathSensitive(RELATIVE) public org.gradle.api.file.FileTree getSource()
      Overrides:
      getSource in class org.gradle.api.tasks.SourceTask
    • validateAll

      public void validateAll()
      Executes validation for all resolved source files.
    • validate

      protected abstract ValidationResult validate(File inputFile, Map<String,String> params) throws Exception
      Validates a single input file and returns normalized findings.
      Parameters:
      inputFile - file to validate
      params - task-level validation parameters
      Returns:
      normalized validation result
      Throws:
      Exception - when validation cannot be performed