Package dev.gmitch215.bytebox.gradle
Class GenerateCodecsTask
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
dev.gmitch215.bytebox.gradle.GenerateCodecsTask
- 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 GenerateCodecsTask
extends org.gradle.api.DefaultTask
Writes a JSON codec for every type asked for, and one class that registers them all.
Generated rather than reflective, and the reason is size. A reflective decoder needs field
metadata for every type that could arrive through an Object-typed field, which is the
whole-program closure dead-code elimination exists to prune — the binary would grow with how many
types were serialisable rather than with how many were used. A codec per named type keeps the
closure to what was asked for.
- Since:
- 1.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe package the generated codecs live in.static final StringThe class that registers every generated codec.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()Writes the codecs.abstract org.gradle.api.file.ConfigurableFileCollectionReturns everything needed to resolve those classes, including bytebox itself.abstract org.gradle.api.file.DirectoryPropertyReturns where the generated source goes.abstract org.gradle.api.file.ConfigurableFileCollectionReturns the project's own compiled classes, which are the ones scanned.abstract org.gradle.api.provider.ListProperty<String> getTypes()Returns types to generate codecs for that the scan would not find.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
-
Field Details
-
PACKAGE
The package the generated codecs live in.- See Also:
-
REGISTRY
The class that registers every generated codec.- See Also:
-
-
Constructor Details
-
GenerateCodecsTask
public GenerateCodecsTask()
-
-
Method Details
-
getTypes
Returns types to generate codecs for that the scan would not find.Added to whatever is discovered rather than replacing it, for a type in a dependency or one whose source the project does not control.
- Returns:
- types to generate codecs for that the scan would not find
-
getScanned
@Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getScanned()Returns the project's own compiled classes, which are the ones scanned.- Returns:
- the project's own compiled classes, which are the ones scanned
-
getClasspath
@Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getClasspath()Returns everything needed to resolve those classes, including bytebox itself.- Returns:
- everything needed to resolve those classes, including bytebox itself
-
getOutputDirectory
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDirectory()Returns where the generated source goes.- Returns:
- where the generated source goes
-
generate
public void generate()Writes the codecs.
-