Package io.github.nguyenduck.autoaidl
Class GenerateAidlTask
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
io.github.nguyenduck.autoaidl.GenerateAidlTask
- 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>
public abstract class GenerateAidlTask
extends org.gradle.api.DefaultTask
An abstract task that generates AIDL files based on annotated Java interfaces.
This task processes Java source files located in a specified directory,
identifies interfaces annotated with `@AIDLInterface` or `@ShizukuInterface`,
and creates corresponding AIDL files in an output directory.
The task uses a `JavaParser` to parse Java source files, computes method identifiers for each method in annotated interfaces, and generates AIDL declarations based on the extracted information.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Task
org.gradle.api.Task.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 -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate()Generates intermediate AIDL files from Java source files.abstract org.gradle.api.file.DirectoryPropertyReturns the directory property representing the output directory where the generated files will be placed.abstract org.gradle.api.file.DirectoryPropertyReturns the directory property representing the source directory where input Java files are located for processing.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, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, 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, getConvention, notCompatibleWithConfigurationCache
-
Method Details
-
getSourceDir
@InputDirectory public abstract org.gradle.api.file.DirectoryProperty getSourceDir()Returns the directory property representing the source directory where input Java files are located for processing.- Returns:
- a
DirectoryPropertyrepresenting the source directory.
-
getOutputDir
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDir()Returns the directory property representing the output directory where the generated files will be placed.- Returns:
- a
DirectoryPropertyrepresenting the output directory.
-
generate
Generates intermediate AIDL files from Java source files.This method processes all `.java` files found in the source directory and generates corresponding AIDL files in the specified output directory. It uses the `JavaParser` to parse Java files and extracts interfaces annotated with specific annotations (`AIDLInterface` or `ShizukuInterface`) for further processing.
The method traverses the file tree of the source directory, identifies relevant files, and delegates their processing to the `processFile` method.
- Throws:
Exception- if any error occurs during file processing or generation.
-