Class RwconfigCheck

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
net.rabbitware.config.gradle.RwconfigCheck
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

@DisableCachingByDefault(because="the check is quick next to the build it guards, and its report names absolute paths") public abstract class RwconfigCheck extends org.gradle.api.DefaultTask
Checks a project's Java sources against its rwconfig file.

The analyzer runs in a JVM of its own, from the project's Java toolchain. It needs Java 21 and Gradle 9 runs on 17, and running it apart also keeps its dependencies - slf4j among them - out of Gradle's own class path.

  • 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
    Created by Gradle, which supplies the abstract properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Runs the analyzer, reports what it found, and fails the build if asked to and anything it found is an error.
    abstract org.gradle.api.file.ConfigurableFileCollection
    The analyzer and everything it needs.
    protected abstract org.gradle.process.ExecOperations
    Runs the analyzer.
    abstract org.gradle.api.provider.Property<Boolean>
    Whether a finding of error severity fails the build.
    abstract org.gradle.api.provider.Property<org.gradle.jvm.toolchain.JavaLauncher>
    The JVM the analyzer runs in.
    abstract org.gradle.api.file.RegularFileProperty
    The findings reported, one per line - what the task last said, kept so that Gradle can tell when nothing has changed.
    abstract org.gradle.api.provider.Property<Boolean>
    Whether to report properties that are declared but never read.
    abstract org.gradle.api.file.ConfigurableFileCollection
    Where the rwconfig file may be, in order.
    abstract org.gradle.api.provider.Property<Boolean>
    Whether the check is skipped.
    abstract org.gradle.api.provider.ListProperty<String>
    Rules to ignore, by id.
    abstract org.gradle.api.file.ConfigurableFileCollection
    The source directories, handed to the analyzer.
    abstract org.gradle.api.file.ConfigurableFileCollection
    The Java sources, tracked so that a change to any of them runs the check again.

    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 Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RwconfigCheck

      public RwconfigCheck()
      Created by Gradle, which supplies the abstract properties.
  • Method Details

    • getAnalyzerClasspath

      @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getAnalyzerClasspath()
      The analyzer and everything it needs.
      Returns:
      the class path
    • getRwconfigCandidates

      @InputFiles @PathSensitive(RELATIVE) public abstract org.gradle.api.file.ConfigurableFileCollection getRwconfigCandidates()
      Where the rwconfig file may be, in order. The first that exists is checked, and a project with none is not - which is decided when the task runs, so a file added later is noticed.
      Returns:
      the candidates
    • getSourceDirectories

      @Internal public abstract org.gradle.api.file.ConfigurableFileCollection getSourceDirectories()
      The source directories, handed to the analyzer. Their contents are tracked through getSources().
      Returns:
      the directories
    • getSources

      @InputFiles @PathSensitive(RELATIVE) @IgnoreEmptyDirectories public abstract org.gradle.api.file.ConfigurableFileCollection getSources()
      The Java sources, tracked so that a change to any of them runs the check again.
      Returns:
      the sources
    • getFailOnError

      @Input public abstract org.gradle.api.provider.Property<Boolean> getFailOnError()
      Whether a finding of error severity fails the build.
      Returns:
      the property
    • getReportUnread

      @Input public abstract org.gradle.api.provider.Property<Boolean> getReportUnread()
      Whether to report properties that are declared but never read.
      Returns:
      the property
    • getSkipRules

      @Input public abstract org.gradle.api.provider.ListProperty<String> getSkipRules()
      Rules to ignore, by id.
      Returns:
      the property
    • getSkip

      @Internal public abstract org.gradle.api.provider.Property<Boolean> getSkip()
      Whether the check is skipped. Not an input: a skipped task does not run.
      Returns:
      the property
    • getJavaLauncher

      public abstract org.gradle.api.provider.Property<org.gradle.jvm.toolchain.JavaLauncher> getJavaLauncher()
      The JVM the analyzer runs in.
      Returns:
      the property
    • getReport

      @OutputFile public abstract org.gradle.api.file.RegularFileProperty getReport()
      The findings reported, one per line - what the task last said, kept so that Gradle can tell when nothing has changed.
      Returns:
      the property
    • getExecOperations

      @Inject protected abstract org.gradle.process.ExecOperations getExecOperations()
      Runs the analyzer.
      Returns:
      the service
    • check

      public void check()
      Runs the analyzer, reports what it found, and fails the build if asked to and anything it found is an error.