Class JzapExtension

java.lang.Object
io.github.huyz0.jzap.gradle.JzapExtension

public abstract class JzapExtension extends Object
Build-script configuration for jzap.

Everything here describes what to analyse and how to report. Nothing here describes how analysis works: that belongs to the engine, and keeping the line clear is what stops this plugin from slowly accumulating a second copy of the tool.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.gradle.api.file.DirectoryProperty
    Directory holding the incremental cache.
    abstract org.gradle.api.file.ConfigurableFileCollection
    Explicit engine classpath, overriding getEngineVersion().
    abstract org.gradle.api.provider.Property<String>
    Engine version to run.
    abstract org.gradle.api.provider.ListProperty<String>
    Class-name globs never to mutate.
    abstract org.gradle.api.provider.Property<Boolean>
    Fail the build if any mutant survives.
    abstract org.gradle.api.provider.Property<String>
    Base git ref for diff scoping.
    abstract org.gradle.api.provider.ListProperty<String>
    Class-name globs to mutate.
    abstract org.gradle.api.provider.ListProperty<String>
    Extra JVM arguments for the analysis JVMs that run the tests.
    abstract org.gradle.api.provider.Property<Boolean>
    Also mutate loop counters, which are suppressed by default.
    abstract org.gradle.api.provider.ListProperty<String>
    Mutator ids.
    abstract org.gradle.api.provider.ListProperty<String>
    Reporter ids: console, json, elements, html, annotations.
    abstract org.gradle.api.provider.Property<String>
    line to mutate only changed lines, class to widen to changed classes.
    abstract org.gradle.api.provider.Property<Integer>
    Analysis JVMs.
    Fail the build if the mutation score falls below this percentage.
    abstract org.gradle.api.provider.Property<String>
    Tip git ref for diff scoping.
    void
    A plain scalar rather than a Property<Double>, and typed as Number.

    Methods inherited from class java.lang.Object

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

    • JzapExtension

      public JzapExtension()
  • Method Details

    • getEngineVersion

      public abstract org.gradle.api.provider.Property<String> getEngineVersion()
      Engine version to run. Defaults to the plugin's own version.
    • getEngineClasspath

      public abstract org.gradle.api.file.ConfigurableFileCollection getEngineClasspath()
      Explicit engine classpath, overriding getEngineVersion().

      Set this to run a locally built engine, which is also how this plugin's own tests work:

      
       jzap {
           engineClasspath.setFrom(fileTree("path/to/jzap/lib") { include("*.jar") })
       }
       

      This is the answer when the engine cannot be resolved from a repository. The failure in that case comes from Gradle's dependency resolution rather than from jzap; see JzapTask.getEngineClasspath() for why it is left that way.

    • getThreads

      public abstract org.gradle.api.provider.Property<Integer> getThreads()
      Analysis JVMs. Defaults to one.

      Raise it when the test suite is slow or spends its time waiting, where an extra analysis JVM gains almost linearly. On a suite of fast CPU-bound tests it can cost more than it saves, which is why the default does not guess; see ProjectModel.DEFAULT_THREADS.

    • getReporters

      public abstract org.gradle.api.provider.ListProperty<String> getReporters()
      Reporter ids: console, json, elements, html, annotations.
    • getFrom

      public abstract org.gradle.api.provider.Property<String> getFrom()
      Base git ref for diff scoping.

      Honoured by mutationTestDiff, which falls back to HEAD, and by mutationTestAll, which has no fallback and analyses every module when no range is given. mutationTest is a full run by definition and ignores it.

      Setting it here wins over the JZAP_FROM environment variable, which exists for CI that knows the base branch and cannot edit the build script.

    • getTo

      public abstract org.gradle.api.provider.Property<String> getTo()
      Tip git ref for diff scoping. -Local- means uncommitted changes and -Empty- the empty tree.

      Same precedence and the same tasks as getFrom(); the environment variable is JZAP_TO.

    • getScope

      public abstract org.gradle.api.provider.Property<String> getScope()
      line to mutate only changed lines, class to widen to changed classes.
    • getIncludeClasses

      public abstract org.gradle.api.provider.ListProperty<String> getIncludeClasses()
      Class-name globs to mutate. Empty means everything in the module's output.
    • getExcludeClasses

      public abstract org.gradle.api.provider.ListProperty<String> getExcludeClasses()
      Class-name globs never to mutate.
    • getMutators

      public abstract org.gradle.api.provider.ListProperty<String> getMutators()
      Mutator ids. Empty means the default set.
    • getMutateLoopCounters

      public abstract org.gradle.api.provider.Property<Boolean> getMutateLoopCounters()
      Also mutate loop counters, which are suppressed by default.
    • getFailOnSurvivors

      public abstract org.gradle.api.provider.Property<Boolean> getFailOnSurvivors()
      Fail the build if any mutant survives.
    • getJvmArgs

      public abstract org.gradle.api.provider.ListProperty<String> getJvmArgs()
      Extra JVM arguments for the analysis JVMs that run the tests.
    • getCacheDir

      public abstract org.gradle.api.file.DirectoryProperty getCacheDir()
      Directory holding the incremental cache. Unset means no caching.

      Off by default, including here. A cache whose whole question is whether reuse is sound should not start reusing without being asked, and a build that silently reuses verdicts is hard to reason about the first time one looks wrong.

    • getThreshold

      public Double getThreshold()
      Fail the build if the mutation score falls below this percentage.
    • setThreshold

      public void setThreshold(Number value)
      A plain scalar rather than a Property<Double>, and typed as Number.

      In a Groovy build script threshold = 80.0 produces a BigDecimal, which Gradle will not assign to a Property<Double>; and Gradle forbids declaring a setter next to an abstract property getter, so the two cannot be combined. Without this, the obvious way to write the obvious thing fails with a type error.