Class JzapTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
io.github.huyz0.jzap.gradle.JzapTask
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="reports embed phase timings, and a diff-scoped run\'s scope depends on git state that is not a declared input") public abstract class JzapTask extends org.gradle.api.DefaultTask
Writes a project model and runs the engine against it.

Declares its inputs and outputs so Gradle can skip it when nothing has changed. That is up-to-date checking rather than build caching, and the two are worth keeping apart here, because this task is deliberately not cacheable for two reasons.

The reports embed phase timings, which differ between runs by design, so an output reused from another machine would present that machine's durations as this run's.

The reason that would actually bite is the second. A diff-scoped run takes its scope from the git repository, and the repository's state is not a declared input -- only the ref names are. Two runs with identical classes and an identical from can therefore need different scopes: commit the change that HEAD..-Local- was selecting, and the correct answer becomes "nothing in scope" while every declared input is unchanged. That already makes up-to-date checking optimistic for the diff task, and sharing outputs between machines would spread it further. Closing it means declaring the resolved commits as an input through a ValueSource, so that resolving them does not itself break 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
    void
     
    abstract org.gradle.api.file.ConfigurableFileCollection
    Every class and classpath entry the aggregate covers, so up-to-date checks still work.
    abstract org.gradle.api.file.DirectoryProperty
    The incremental cache directory, if caching is on.
    abstract org.gradle.api.file.ConfigurableFileCollection
    The engine to run.
    abstract org.gradle.api.provider.ListProperty<String>
     
    protected abstract org.gradle.process.ExecOperations
     
    abstract org.gradle.api.provider.Property<Boolean>
     
    abstract org.gradle.api.provider.Property<String>
     
    abstract org.gradle.api.provider.ListProperty<String>
     
    abstract org.gradle.api.provider.Property<String>
     
    abstract org.gradle.api.provider.ListProperty<String>
     
    abstract org.gradle.api.provider.ListProperty<String>
    Pre-rendered module fragments for an aggregate run, one per project.
    abstract org.gradle.api.provider.Property<String>
     
    abstract org.gradle.api.file.ConfigurableFileCollection
    Compiled classes to mutate.
    abstract org.gradle.api.provider.Property<Boolean>
     
    abstract org.gradle.api.provider.ListProperty<String>
     
    protected abstract org.gradle.api.model.ObjectFactory
     
    abstract org.gradle.api.file.DirectoryProperty
     
    abstract org.gradle.api.provider.ListProperty<String>
     
    abstract org.gradle.api.provider.Property<String>
     
    abstract org.gradle.api.file.ConfigurableFileCollection
    Source directories, used to map lines to files and to render reports.
    abstract org.gradle.api.file.ConfigurableFileCollection
    Everything needed to run the tests, including the test and main output.
    abstract org.gradle.api.file.ConfigurableFileCollection
    Compiled test classes, scanned for test discovery.
    abstract org.gradle.api.provider.Property<Integer>
     
    abstract org.gradle.api.provider.Property<Double>
     
    abstract org.gradle.api.provider.Property<String>
     

    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

    • JzapTask

      public JzapTask()
  • Method Details

    • getEngineClasspath

      @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getEngineClasspath()
      The engine to run. Kept off the buildscript classpath on purpose.

      A single tracked input, so changing the engine re-runs the analysis and the task stays configuration-cache compatible. An unresolvable engine therefore fails during input snapshotting, with Gradle's own message rather than one of ours.

      That is a deliberate choice, recorded here because it is not the obvious one and three attempts at beating it all failed: wrapping the resolution in the action does not help because @Classpath inputs are snapshotted first; an @Internal file collection still gains an implicit task dependency that Gradle resolves before executing; and a non-file Property fed by a provider is finalised, and therefore queried, before the action too. Each workaround would have traded configuration-cache compatibility for a better sentence. Gradle's message already names the configuration and the missing coordinate, which is the message Gradle users are trained to read; the escape hatch is documented on JzapExtension.getEngineClasspath() instead.

    • getMutableCodePaths

      @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getMutableCodePaths()
      Compiled classes to mutate.
    • getTestClassPaths

      @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getTestClassPaths()
      Compiled test classes, scanned for test discovery.
    • getTestClasspath

      @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getTestClasspath()
      Everything needed to run the tests, including the test and main output.
    • getSourceRoots

      @InputFiles @PathSensitive(RELATIVE) public abstract org.gradle.api.file.ConfigurableFileCollection getSourceRoots()
      Source directories, used to map lines to files and to render reports.
    • getModuleId

      @Input public abstract org.gradle.api.provider.Property<String> getModuleId()
    • getJavaExecutable

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getJavaExecutable()
    • getThreads

      @Input @Optional public abstract org.gradle.api.provider.Property<Integer> getThreads()
    • getReporters

      @Input public abstract org.gradle.api.provider.ListProperty<String> getReporters()
    • getFrom

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getFrom()
    • getTo

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getTo()
    • getScope

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getScope()
    • getIncludeClasses

      @Input public abstract org.gradle.api.provider.ListProperty<String> getIncludeClasses()
    • getExcludeClasses

      @Input public abstract org.gradle.api.provider.ListProperty<String> getExcludeClasses()
    • getMutators

      @Input public abstract org.gradle.api.provider.ListProperty<String> getMutators()
    • getMutateLoopCounters

      @Input @Optional public abstract org.gradle.api.provider.Property<Boolean> getMutateLoopCounters()
    • getThreshold

      @Input @Optional public abstract org.gradle.api.provider.Property<Double> getThreshold()
    • getFailOnSurvivors

      @Input @Optional public abstract org.gradle.api.provider.Property<Boolean> getFailOnSurvivors()
    • getJvmArgs

      @Input public abstract org.gradle.api.provider.ListProperty<String> getJvmArgs()
    • getModuleFragments

      @Input public abstract org.gradle.api.provider.ListProperty<String> getModuleFragments()
      Pre-rendered module fragments for an aggregate run, one per project.

      Rendered when the build is configured and carried as strings, because a task cannot hold a variable number of file collections and reaching across to another project at execution time is what breaks the configuration cache.

    • getAggregateInputs

      @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getAggregateInputs()
      Every class and classpath entry the aggregate covers, so up-to-date checks still work.
    • getReportDir

      @OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getReportDir()
    • getCacheDir

      @Internal public abstract org.gradle.api.file.DirectoryProperty getCacheDir()
      The incremental cache directory, if caching is on.

      Deliberately not declared as an output: it is read-write state that survives a clean of the report directory, and declaring it as an output would let Gradle delete it as stale.

    • getExecOperations

      @Inject protected abstract org.gradle.process.ExecOperations getExecOperations()
    • getObjects

      @Inject protected abstract org.gradle.api.model.ObjectFactory getObjects()
    • analyse

      public void analyse()