Package name.jurgenei.gradle.xml
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
ConstructorsConstructorDescriptionCreates a validation task with default conventions. -
Method Summary
Modifier and TypeMethodDescriptionvoidfileset(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.DirectoryPropertyReturns 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.DirectoryPropertyReturns the destination directory for generated SVRL files.abstract org.gradle.api.provider.Property<String> Returns the output extension used when writing SVRL files.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.FileTreeabstract org.gradle.api.provider.Property<Integer> Returns the number of workers used for concurrent validation.voidAdds a validation parameter available to concrete engines.protected abstract ValidationResultValidates a single input file and returns normalized findings.voidExecutes 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, sourceMethods inherited from class org.gradle.api.internal.ConventionTask
conventionMapping, conventionMapping, getConventionMappingMethods 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, usesServiceMethods 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, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ValidationTaskSpecReturns the destination directory for generated SVRL files.- Specified by:
getOutputDirin interfaceValidationTaskSpec- Returns:
- destination directory for SVRL outputs
-
getOutputExtension
Description copied from interface:ValidationTaskSpecReturns the output extension used when writing SVRL files.- Specified by:
getOutputExtensionin interfaceValidationTaskSpec- Returns:
- output extension used for SVRL file mapping
-
getWorkers
Description copied from interface:ValidationTaskSpecReturns the number of workers used for concurrent validation.- Specified by:
getWorkersin interfaceValidationTaskSpec- Returns:
- number of parallel workers for multi-file validation
-
getFailOnError
Description copied from interface:ValidationTaskSpecReturns whether validation findings fail the build.- Specified by:
getFailOnErrorin interfaceValidationTaskSpec- Returns:
- whether validation findings should fail the build
-
getMaxFailures
Description copied from interface:ValidationTaskSpecReturns the maximum number of failures to aggregate.- Specified by:
getMaxFailuresin interfaceValidationTaskSpec- Returns:
- maximum number of failures to aggregate before stopping
-
getReportFormat
Description copied from interface:ValidationTaskSpecReturns the configured report format.- Specified by:
getReportFormatin interfaceValidationTaskSpec- Returns:
- selected report format(s)
-
getJunitOutputDir
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getJunitOutputDir()Description copied from interface:ValidationTaskSpecReturns the directory used for generated JUnit XML files.- Specified by:
getJunitOutputDirin interfaceValidationTaskSpec- Returns:
- destination directory for generated JUnit XML reports
-
getJunitSuiteName
Description copied from interface:ValidationTaskSpecReturns the testsuite name used in JUnit report generation.- Specified by:
getJunitSuiteNamein interfaceValidationTaskSpec- Returns:
- JUnit suite name used for generated reports
-
getParams
Description copied from interface:ValidationTaskSpecReturns task parameters passed to the active validation engine.- Specified by:
getParamsin interfaceValidationTaskSpec- Returns:
- task-level parameters consumed by validation engines
-
param
Adds a validation parameter available to concrete engines.- Parameters:
name- parameter name, must not benullvalue- 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 byProject.fileTreeconfigureAction- include/exclude configuration action
-
getSource
@PathSensitive(RELATIVE) public org.gradle.api.file.FileTree getSource()- Overrides:
getSourcein classorg.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 ExceptionValidates a single input file and returns normalized findings.- Parameters:
inputFile- file to validateparams- task-level validation parameters- Returns:
- normalized validation result
- Throws:
Exception- when validation cannot be performed
-