Class PbjCompilerTask
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.SourceTask
com.hedera.pbj.compiler.PbjCompilerTask
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.api.tasks.util.PatternFilterable, org.gradle.util.Configurable<org.gradle.api.Task>
@CacheableTask
public abstract class PbjCompilerTask
extends org.gradle.api.tasks.SourceTask
Gradle Task that generates java src code from protobuf proto schema files.
-
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.ConfigurableFileCollectionThe classpath to import 'proto' files from dependencies.protected abstract org.gradle.api.internal.file.FileOperationsabstract org.gradle.api.provider.Property<Boolean> An optional boolean that indicates if test classes for protobuf models should be generated, which is true by default.abstract org.gradle.api.file.DirectoryPropertySet the java main directory that we write generated code intoabstract org.gradle.api.provider.Property<String> An optional Java package suffix for PBJ-generated classes when `pbj.java_package` is missing.abstract org.gradle.api.file.DirectoryPropertySet the java test directory that we write generated code intoabstract org.gradle.api.provider.SetProperty<File> Src folders to determine the relative path of files to resolve import statements.voidperform()Perform task action - Generates all the PBJ java source filesMethods inherited from class org.gradle.api.tasks.SourceTask
exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSet, getPatternSetFactory, getSource, include, include, include, include, setExcludes, setIncludes, setSource, setSource, sourceMethods inherited from class org.gradle.api.internal.ConventionTask
conventionMapping, conventionMapping, getConventionMappingMethods 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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Constructor Details
-
PbjCompilerTask
public PbjCompilerTask()
-
-
Method Details
-
getJavaMainOutputDirectory
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getJavaMainOutputDirectory()Set the java main directory that we write generated code into- Returns:
- The java main directory that we write generated code into
-
getJavaTestOutputDirectory
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getJavaTestOutputDirectory()Set the java test directory that we write generated code into- Returns:
- The java test directory that we write generated code into
-
getClasspath
@InputFiles @PathSensitive(RELATIVE) public abstract org.gradle.api.file.ConfigurableFileCollection getClasspath()The classpath to import 'proto' files from dependencies. The task expects the proto files to be extracted from the Jar files. These proto files are used for importing protobufs from other modules in theSourceTask.getSource()proto files. The generated code for theSourceTask.getSource()proto will then have the correct Java imports.Note that the Jar files from which the proto files in this file collection are extracted should also contain the generated code for these files, as no code generation is performed for proto files in this file collection.
- Returns:
- The classpath to find imports in other libraries.
-
getFileOperations
@Inject protected abstract org.gradle.api.internal.file.FileOperations getFileOperations()- Returns:
- Gradle's FileOperations service to use for file deletion
-
getJavaPackageSuffix
An optional Java package suffix for PBJ-generated classes when `pbj.java_package` is missing. -
getGenerateTestClasses
An optional boolean that indicates if test classes for protobuf models should be generated, which is true by default. -
getSourceRoots
Src folders to determine the relative path of files to resolve import statements. -
perform
-