Class UpdateMirageApiDetectorDslTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.arc_e_tect.gradle.mirage.UpdateMirageApiDetectorDslTask
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="Rewrites a source file in place; a cache restore would bypass that entirely") public abstract class UpdateMirageApiDetectorDslTask extends org.gradle.api.DefaultTask
Adds any mirageApiDetector DSL properties missing from this project's build file, set to their default values - see com.arc_e_tect.gradle.dslupdater.DslUpdater and MirageApiDetectorDslSchema. Setting an added property explicitly afterwards is a no-op, so running this task after upgrading the plugin is always safe.

Groovy DSL (build.gradle) only - see dsl-updater-core's own documentation for why.

  • 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 new task instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyCleanupDsl(boolean value)
    Sets getCleanupDsl() for this run only.
    void
    applyGenerateDsl(boolean value)
    Sets getGenerateDsl() for this run only.
    abstract org.gradle.api.file.RegularFileProperty
    The build file to update - the project's own build.gradle.
    abstract org.gradle.api.provider.Property<Boolean>
    Strips every comment line from inside the managed block - both pre-existing ones and any doc comment this run would otherwise add - leaving only properties.
    abstract org.gradle.api.provider.Property<Boolean>
    When the mirageApiDetector block is entirely absent, synthesize a full new one from the schema and append it to the end of the build file; when false (the default), a missing block is left alone.
    void
    Reads the build file, adds any missing DSL properties, and writes it back if anything changed - after first copying the original, untouched file alongside it as build.gradle.bak, so there's always a plain-file fallback even for a project not using version control (or one that just hasn't committed the file yet).

    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

    • UpdateMirageApiDetectorDslTask

      @Inject public UpdateMirageApiDetectorDslTask()
      Creates a new task instance. Instantiated by Gradle infrastructure.
  • Method Details

    • getBuildFile

      @Internal public abstract org.gradle.api.file.RegularFileProperty getBuildFile()
      The build file to update - the project's own build.gradle.
      Returns:
      read-only file property for the build file
    • getGenerateDsl

      @Internal public abstract org.gradle.api.provider.Property<Boolean> getGenerateDsl()
      When the mirageApiDetector block is entirely absent, synthesize a full new one from the schema and append it to the end of the build file; when false (the default), a missing block is left alone.
      Returns:
      mutable property for the generate-DSL flag
    • applyGenerateDsl

      public void applyGenerateDsl(boolean value)
      Sets getGenerateDsl() for this run only.
      Parameters:
      value - the value to set getGenerateDsl() to
    • getCleanupDsl

      @Internal public abstract org.gradle.api.provider.Property<Boolean> getCleanupDsl()
      Strips every comment line from inside the managed block - both pre-existing ones and any doc comment this run would otherwise add - leaving only properties.
      Returns:
      mutable property for the cleanup-DSL flag
    • applyCleanupDsl

      public void applyCleanupDsl(boolean value)
      Sets getCleanupDsl() for this run only.
      Parameters:
      value - the value to set getCleanupDsl() to
    • updateDsl

      public void updateDsl()
      Reads the build file, adds any missing DSL properties, and writes it back if anything changed - after first copying the original, untouched file alongside it as build.gradle.bak, so there's always a plain-file fallback even for a project not using version control (or one that just hasn't committed the file yet).