Class GenerateJsonSchema
- 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>
-
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 TypeMethodDescriptionabstract org.gradle.api.file.ConfigurableFileCollectionabstract org.gradle.api.provider.ListProperty<String>abstract org.gradle.api.file.ConfigurableFileCollectionThe schema generator itself, and its dependencies.abstract org.gradle.api.provider.Property<String>Optionally, provide a specific directory to generate schemas into.abstract org.gradle.api.file.ConfigurableFileCollectionThe dependencies the project needs at runtime, which are on the generator's classpath so it can resolve the types it scans.abstract org.gradle.api.file.DirectoryPropertyThe resource root where generated schemas should be storedabstract org.gradle.api.provider.ListProperty<String>An optional list of module name used to limit the search for subtypes to only those types under the supplied module.abstract org.gradle.api.provider.ListProperty<String>An optional list of package name used to limit the search for subtypes to only those types under the supplied packages.abstract org.gradle.api.provider.ListProperty<String>An optional list of module names used to limit the generation of schemas to only those@GeneratesSchemaannotated types within the named modules.abstract org.gradle.api.provider.ListProperty<String>An optional list of package name used to limit the generation of schemas to only those@GeneratesSchemaannotated types under the supplied packages.voidrun()The task action.voidMethod to allow setting extra arguments from the command line.voidMethod to allow setting allowed subtype packages from the command line.voidMethod to allow setting allowed subtype modules from the command line.voidMethod to allow setting allowed subtype packages from the command line.voidMethod to allow setting allowed subtype packages from the command line.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, getLoggingManager, 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
-
GenerateJsonSchema
@Inject public GenerateJsonSchema(org.gradle.process.ExecOperations execOps) Constructor- Parameters:
execOps- Gradle exec operations service for executing JVM processes.
-
-
Method Details
-
getTypeScanningModuleWhiteList
@Input public abstract org.gradle.api.provider.ListProperty<String> getTypeScanningModuleWhiteList()An optional list of module names used to limit the generation of schemas to only those@GeneratesSchemaannotated types within the named modules.Allowed module names can include the glob wildcard
*character.Setting this will speed up schema generation.
Default: empty, meaning all modules.
- Returns:
- type scanning module white list property.
-
setTypeScanningModuleWhiteListFromOption
Method to allow setting allowed subtype packages from the command line.- Parameters:
args- the modules to whitelist
-
getTypeScanningPackageWhiteList
@Input public abstract org.gradle.api.provider.ListProperty<String> getTypeScanningPackageWhiteList()An optional list of package name used to limit the generation of schemas to only those@GeneratesSchemaannotated types under the supplied packages.Allowed package names can include the glob wildcard
*character.Setting this will speed up schema generation.
Default: empty, meaning all packages.
- Returns:
- type scanning packaging white list property.
-
setTypeScanningPackageWhiteListFromOption
Method to allow setting allowed subtype packages from the command line.- Parameters:
args- the packages to whitelist
-
getSubtypeScanningModuleWhiteList
@Input public abstract org.gradle.api.provider.ListProperty<String> getSubtypeScanningModuleWhiteList()An optional list of module name used to limit the search for subtypes to only those types under the supplied module.Allowed module names can include the glob wildcard
*character.Setting this will speed up schema generation.
Default: empty, meaning all modules.
- Returns:
- subtype scanning module white list property.
-
setSubtypeScanningModuleWhiteListFromOption
Method to allow setting allowed subtype modules from the command line.- Parameters:
args- the modules to whitelist
-
getSubtypeScanningPackageWhiteList
@Input public abstract org.gradle.api.provider.ListProperty<String> getSubtypeScanningPackageWhiteList()An optional list of package name used to limit the search for subtypes to only those types under the supplied packages.Allowed package names can include the glob wildcard
*character.Setting this will speed up schema generation.
Default: empty, meaning all packages.
- Returns:
- subtype scanning package white list property.
-
setSubtypePackageWhiteListFromOption
Method to allow setting allowed subtype packages from the command line.- Parameters:
args- the packages to whitelist
-
getSchemaResourceRoot
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getSchemaResourceRoot()The resource root where generated schemas should be storedDefault: $buildDir/generated/resources/schema
- Returns:
- the resource root property
-
getOutputDirectoryName
Optionally, provide a specific directory to generate schemas into.By default, schemas will be generated in a package directory structure under the
resource root, and the schema filename will match the simple name of the type.If this directory name is set, schemas will be generated into a single flat directly under the
resource root, and the schema filename will match the types fully-qualified name.For example, given a type
io.acme.financial.model.Account, the default schema location isresource-root/io/acme/financial/model/Account.yml. If this output directory property is set, then the schema location isresource-root/output-directory/io.acme.financial.model.Account.yml.- Returns:
- output directory property.
-
getExtraArguments
- Returns:
- additional command line arguments to pass to the generator
-
setExtraArgumentsFromOption
Method to allow setting extra arguments from the command line.- Parameters:
args- the extra arguments to set.
-
getClassFiles
@Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getClassFiles()- Returns:
- the class files to scan, e.g. the output of the compileJava task or other compile task.
-
getGeneratorDeps
@Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getGeneratorDeps()The schema generator itself, and its dependencies.Tracked as a classpath input so that upgrading the generator correctly triggers a regeneration of the schemas.
- Returns:
- the generator and its dependencies.
-
getProjectDeps
@Internal public abstract org.gradle.api.file.ConfigurableFileCollection getProjectDeps()The dependencies the project needs at runtime, which are on the generator's classpath so it can resolve the types it scans.Deliberately not tracked: for the test schema task this is
testRuntimeClasspath, which includes this task's ownoutput directory. Tracking it would make the task depend on its own output, so it would never be up-to-date. The compiled classes the generator actually scans are tracked viagetClassFiles().- Returns:
- the project dependencies to put on the generator's classpath.
-
run
public void run()The task action.
-