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 -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate()Generates the sources and reports what could not be generated in full.abstract org.gradle.api.file.ConfigurableFileCollectionThe 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.RegularFilePropertyThe 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 theResourceBundlethe 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.ConfigurableFileCollectionThe emitter libraries, and everything they need.abstract org.gradle.api.file.RegularFilePropertyWhere the path of every generated operation and inline schema class goes, keyedClassName.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.RegularFilePropertyThe Subscriber's lockfile, which names the contract's version and hash.abstract org.gradle.api.file.DirectoryPropertyWhere the sources go.abstract org.gradle.api.provider.Property<Integer> How often a recursive reference is followed.abstract org.gradle.api.file.RegularFilePropertyWhere the report of what could not be generated in full goes.abstract org.gradle.api.file.DirectoryPropertyWhere a resource an emitter writes goes.abstract org.gradle.api.file.RegularFilePropertyWhere the machine-readable report of every generated valid value goes: JSON, beside the report.protected abstract org.gradle.workers.WorkerExecutorGradle'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, usesServiceMethods 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, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
The base name of theResourceBundlethe 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
The contract's name.- Returns:
- the name
-
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
How often a recursive reference is followed.- Returns:
- the depth
-
getGenerateDocs
Whether descriptions come from the contract.- Returns:
- the setting
-
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
-
getResourceDirectory
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getResourceDirectory()Where a resource an emitter writes goes.- 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, keyedClassName.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
-
getValidValuesReport
@OutputFile @Optional public abstract org.gradle.api.file.RegularFileProperty getValidValuesReport()Where the machine-readable report of every generated valid value goes: JSON, beside the report. Nothing is written when it is not set.- 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.
-