Class ExtractAnnotations

  • All Implemented Interfaces:
    com.android.build.gradle.internal.tasks.VariantAwareTask, java.lang.Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

    @CacheableTask
    public abstract class ExtractAnnotations
    extends com.android.build.gradle.internal.tasks.NonIncrementalTask
    Task which extracts annotations from the source files, and writes them to one of two possible destinations:
    • A "external annotations" file (pointed to by getOutput()) which records the annotations in a zipped XML format for use by the IDE and by lint to associate the (source retention) annotations back with the compiled code
    We typically only extract external annotations when building libraries; ProGuard annotations are extracted when building libraries (to record in the AAR), or when building an app module where ProGuarding is enabled.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ExtractAnnotations.CreationAction  
      • Nested classes/interfaces inherited from interface org.gradle.api.Task

        org.gradle.api.Task.Namer
    • Field Summary

      • Fields inherited from class com.android.build.gradle.internal.tasks.AndroidVariantTask

        variantName
      • 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

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doTaskAction()  
      org.gradle.api.file.FileCollection getBootClasspath()
      Boot classpath: typically android.jar
      org.gradle.api.file.FileCollection getClasspath()  
      java.lang.String getEncoding()
      The encoding to use when reading source files.
      boolean getHasAndroidAnnotations()  
      org.gradle.api.file.FileCollection getLibraries()  
      abstract org.gradle.api.provider.Property<com.android.build.gradle.internal.services.LintClassLoaderBuildService> getLintClassLoaderBuildService()  
      abstract com.android.build.gradle.internal.lint.LintTool getLintTool()  
      abstract org.gradle.api.file.RegularFileProperty getOutput()
      The output .zip file to write the annotations database to, if any
      org.gradle.api.file.FileTree getSource()  
      abstract org.gradle.api.provider.Property<java.lang.String> getStrictTypedefRetention()  
      abstract org.gradle.api.file.RegularFileProperty getTypedefFile()
      The output .txt file to write the typedef recipe file to.
      void setBootClasspath​(org.gradle.api.file.FileCollection bootClasspath)  
      void setEncoding​(java.lang.String encoding)  
      void source​(java.lang.Object source)
      Used by the variant API
      • Methods inherited from class com.android.build.gradle.internal.tasks.NonIncrementalTask

        taskAction
      • Methods inherited from class com.android.build.gradle.internal.tasks.AndroidVariantTask

        getVariantName, setVariantName
      • Methods inherited from class com.android.build.gradle.internal.tasks.BaseTask

        getAnalyticsService, getProjectPath, getWorkerExecutor, recordTaskAction
      • 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, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
      • Methods inherited from class org.gradle.api.internal.AbstractTask

        appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getOnlyIf, getReasonNotToTrackState, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isEnabled, isHasCustomActions, prependParallelSafeAction, setImpliesSubProjects
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.gradle.api.Task

        doNotTrackState, getConvention
      • Methods inherited from interface com.android.build.gradle.internal.tasks.VariantAwareTask

        getAnalyticsService
    • Constructor Detail

      • ExtractAnnotations

        public ExtractAnnotations()
    • Method Detail

      • getLintTool

        public abstract com.android.build.gradle.internal.lint.LintTool getLintTool()
      • getSource

        @NonNull
        @PathSensitive(NAME_ONLY)
        @InputFiles
        @IgnoreEmptyDirectories
        public org.gradle.api.file.FileTree getSource()
      • getClasspath

        @CompileClasspath
        public org.gradle.api.file.FileCollection getClasspath()
      • source

        public void source​(java.lang.Object source)
        Used by the variant API
      • getBootClasspath

        @CompileClasspath
        public org.gradle.api.file.FileCollection getBootClasspath()
        Boot classpath: typically android.jar
      • setBootClasspath

        public void setBootClasspath​(org.gradle.api.file.FileCollection bootClasspath)
      • getLibraries

        @CompileClasspath
        public org.gradle.api.file.FileCollection getLibraries()
      • getOutput

        @OutputFile
        public abstract org.gradle.api.file.RegularFileProperty getOutput()
        The output .zip file to write the annotations database to, if any
      • getTypedefFile

        @OutputFile
        public abstract org.gradle.api.file.RegularFileProperty getTypedefFile()
        The output .txt file to write the typedef recipe file to. A "recipe" file is a file which describes typedef classes, typically ones that should be deleted. It is generated by this ExtractAnnotations task and consumed by the com.android.tools.lint.typedefs.TypedefRemover.
      • getEncoding

        @NonNull
        @Input
        public java.lang.String getEncoding()
        The encoding to use when reading source files. The output file will ignore this and will always be a UTF-8 encoded .xml file inside the annotations zip file.
      • setEncoding

        public void setEncoding​(java.lang.String encoding)
      • getStrictTypedefRetention

        @Input
        public abstract org.gradle.api.provider.Property<java.lang.String> getStrictTypedefRetention()
      • getLintClassLoaderBuildService

        @Internal
        public abstract org.gradle.api.provider.Property<com.android.build.gradle.internal.services.LintClassLoaderBuildService> getLintClassLoaderBuildService()
      • doTaskAction

        protected void doTaskAction()
        Specified by:
        doTaskAction in class com.android.build.gradle.internal.tasks.NonIncrementalTask
      • getHasAndroidAnnotations

        @Input
        public boolean getHasAndroidAnnotations()