Class AbstractMigrationTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.patbaumgartner.spring.migrator.gradle.AbstractMigrationTask
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>
Direct Known Subclasses:
AnalyzeTask, MigrateTask

@DisableCachingByDefault(because="The task reads and rewrites source files rather than producing a cacheable output") public abstract class AbstractMigrationTask extends org.gradle.api.DefaultTask
Shared behaviour of the analyze and migrate tasks.

Every input is a lazy Gradle property populated at configuration time. Nothing reaches for Task.project while executing, which is what makes the tasks usable with the configuration cache.

  • 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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.gradle.api.file.ConfigurableFileCollection
    Returns the classpath whose entries are searched for configuration metadata.
    abstract org.gradle.api.provider.Property<Boolean>
    Returns whether the migrate task should report without writing anything.
    abstract org.gradle.api.provider.Property<String>
    Returns when the build should fail: never, manual or any.
    abstract org.gradle.api.provider.ListProperty<String>
    Returns the glob patterns selecting the configuration files to inspect.
    abstract org.gradle.api.file.DirectoryProperty
    Returns the project directory that include patterns are relative to.
    abstract org.gradle.api.provider.Property<String>
    Returns the optional report path, relative to the project directory.
    abstract org.gradle.api.provider.Property<String>
    Returns the Spring Boot version shown in the report.
    abstract org.gradle.api.provider.ListProperty<String>
    Returns the exact keys or prefixes never to report as unrecognised.
    abstract org.gradle.api.provider.ListProperty<String>
    Returns the namespaces to inspect for unrecognised keys instead of the defaults.
    abstract org.gradle.api.provider.Property<String>
    Returns whether to report configuration keys that no metadata describes: off, report or fail.
    protected void
    runMigration(boolean apply)
    Analyses the project and, when asked to and allowed to, writes the result.

    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

    • AbstractMigrationTask

      public AbstractMigrationTask()
  • Method Details

    • getIncludes

      @Input public abstract org.gradle.api.provider.ListProperty<String> getIncludes()
      Returns the glob patterns selecting the configuration files to inspect.
      Returns:
      the include patterns
    • getFailOn

      @Input public abstract org.gradle.api.provider.Property<String> getFailOn()
      Returns when the build should fail: never, manual or any.
      Returns:
      the failure policy name
    • getDryRun

      @Input public abstract org.gradle.api.provider.Property<Boolean> getDryRun()
      Returns whether the migrate task should report without writing anything.
      Returns:
      whether to run dry
    • getSpringBootVersion

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getSpringBootVersion()
      Returns the Spring Boot version shown in the report.
      Returns:
      the version override
    • getReportFile

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getReportFile()
      Returns the optional report path, relative to the project directory.
      Returns:
      the report path
    • getUnknownKeys

      @Input public abstract org.gradle.api.provider.Property<String> getUnknownKeys()
      Returns whether to report configuration keys that no metadata describes: off, report or fail.
      Returns:
      the unknown key policy name
    • getUnknownKeyIncludes

      @Input public abstract org.gradle.api.provider.ListProperty<String> getUnknownKeyIncludes()
      Returns the namespaces to inspect for unrecognised keys instead of the defaults.
      Returns:
      the namespaces to inspect
    • getUnknownKeyExcludes

      @Input public abstract org.gradle.api.provider.ListProperty<String> getUnknownKeyExcludes()
      Returns the exact keys or prefixes never to report as unrecognised.
      Returns:
      the suppressed keys and prefixes
    • getClasspath

      @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getClasspath()
      Returns the classpath whose entries are searched for configuration metadata.
      Returns:
      the resolved project classpath
    • getProjectDirectory

      @Internal public abstract org.gradle.api.file.DirectoryProperty getProjectDirectory()
      Returns the project directory that include patterns are relative to.
      Returns:
      the project directory
    • runMigration

      protected void runMigration(boolean apply)
      Analyses the project and, when asked to and allowed to, writes the result.
      Parameters:
      apply - whether this task is permitted to rewrite files