Class GenerateContractSourcesTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.arc_e_tect.gradle.apionly.transcriberj.GenerateContractSourcesTask
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>

@CacheableTask public abstract class GenerateContractSourcesTask extends org.gradle.api.DefaultTask
Generates one contract's class tree.

Its inputs are the fetched document's content and the lockfile, not only the document's path: a new contract version regenerates the tree however alike the two documents' files look (D20). Emitters run in a class loader of their own, built from the transcriberjEmitters configuration.

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

    Modifier and Type
    Method
    Description
    void
    Generates the sources and reports what could not be generated in full.
    abstract org.gradle.api.file.ConfigurableFileCollection
    The contract's AsyncAPI document, where it has one.
    abstract org.gradle.api.provider.Property<String>
    The package the core classes go in.
    abstract org.gradle.api.file.RegularFileProperty
    The fetched contract document.
    abstract org.gradle.api.provider.Property<String>
    The contract's name.
    abstract org.gradle.api.provider.Property<String>
    The base name of the ResourceBundle the generated classes resolve their descriptions through, or absent when the project supplies none.
    abstract org.gradle.api.provider.Property<String>
    The description every field carries.
    abstract org.gradle.api.file.ConfigurableFileCollection
    The emitter libraries, and everything they need.
    abstract org.gradle.api.file.RegularFileProperty
    Where the path of every generated operation and inline schema class goes, keyed ClassName.PATH: a properties file for tools that read test sources without a classpath, such as the API-Only Suite's contract-evidence scan.
    abstract org.gradle.api.provider.Property<Boolean>
    Whether descriptions come from the contract.
    abstract org.gradle.api.file.RegularFileProperty
    The Subscriber's lockfile, which names the contract's version and hash.
    abstract org.gradle.api.file.DirectoryProperty
    Where the sources go.
    abstract org.gradle.api.provider.Property<Integer>
    How often a recursive reference is followed.
    abstract org.gradle.api.file.RegularFileProperty
    Where the report of what could not be generated in full goes.
    protected abstract org.gradle.workers.WorkerExecutor
    Gradle's worker API.

    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

    • GenerateContractSourcesTask

      public GenerateContractSourcesTask()
      Creates the task.
  • Method Details

    • getContract

      @InputFile @PathSensitive(NONE) public abstract org.gradle.api.file.RegularFileProperty getContract()
      The fetched contract document.
      Returns:
      the document
    • getAsyncContract

      @InputFiles @PathSensitive(NONE) public abstract org.gradle.api.file.ConfigurableFileCollection getAsyncContract()
      The contract's AsyncAPI document, where it has one. Both documents are read into one model, so a fragment they share is one generated class.

      A file collection rather than a file: whether the contract has an AsyncAPI document is only known once it has been fetched, and a collection tolerates the absence where an input file would fail the build.

      Returns:
      the document, empty when the contract describes no events
    • getDescriptionBundle

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getDescriptionBundle()
      The base name of the ResourceBundle the generated classes resolve their descriptions through, or absent when the project supplies none.
      Returns:
      the bundle's base name
    • getLockfile

      @InputFile @PathSensitive(NONE) public abstract org.gradle.api.file.RegularFileProperty getLockfile()
      The Subscriber's lockfile, which names the contract's version and hash.
      Returns:
      the lockfile
    • getContractName

      @Input public abstract org.gradle.api.provider.Property<String> getContractName()
      The contract's name.
      Returns:
      the name
    • getBasePackage

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getBasePackage()
      The package the core classes go in. Optional only so that its absence is reported by this task, naming the subscription, rather than by Gradle.
      Returns:
      the package
    • getRecursionDepth

      @Input public abstract org.gradle.api.provider.Property<Integer> getRecursionDepth()
      How often a recursive reference is followed.
      Returns:
      the depth
    • getGenerateDocs

      @Input public abstract org.gradle.api.provider.Property<Boolean> getGenerateDocs()
      Whether descriptions come from the contract.
      Returns:
      the setting
    • getDescriptionPlaceholder

      @Input public abstract org.gradle.api.provider.Property<String> getDescriptionPlaceholder()
      The description every field carries.
      Returns:
      the placeholder
    • getEmitterClasspath

      @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getEmitterClasspath()
      The emitter libraries, and everything they need.
      Returns:
      the classpath
    • getOutputDirectory

      @OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDirectory()
      Where the sources go.
      Returns:
      the directory
    • getEndpointIndex

      @OutputFile public abstract org.gradle.api.file.RegularFileProperty getEndpointIndex()
      Where the path of every generated operation and inline schema class goes, keyed ClassName.PATH: a properties file for tools that read test sources without a classpath, such as the API-Only Suite's contract-evidence scan.
      Returns:
      the index
    • getReportFile

      @OutputFile public abstract org.gradle.api.file.RegularFileProperty getReportFile()
      Where the report of what could not be generated in full goes.
      Returns:
      the report
    • getWorkerExecutor

      @Inject protected abstract org.gradle.workers.WorkerExecutor getWorkerExecutor()
      Gradle's worker API.
      Returns:
      the executor
    • generate

      public void generate()
      Generates the sources and reports what could not be generated in full.