Class Index

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
aQute.bnd.gradle.Index
All Implemented Interfaces:
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>

public class Index extends org.gradle.api.DefaultTask
Index task type for Gradle.

This task type can be used to index a set of bundles.

Here is an example of using the Index task type:

 import aQute.bnd.gradle.Index
 tasks.register("index", Index) {
   destinationDirectory = layout.buildDirectory.dir("libs")
   gzip = true
   bundles = fileTree(destinationDirectory) {
     include "**/*.jar"
     exclude "**/*-latest.jar"
     exclude "**/*-sources.jar"
     exclude "**/*-javadoc.jar"
     builtBy tasks.withType(Jar)
   }
 }
 

Properties:

  • base - The base URI for the generated index. The default is the file: URI of the destinationDirectory. The default value is buildDir.
  • bundles - This is the bundles to be indexed. This property must be set.
  • destinationDirectory - The destination directory for the index. This is used as the URI base of the generated index.
  • gzip - If true, then a gzip'd copy of the index will be made. Otherwise, only the uncompressed index will be made. The default is false.
  • indexName - The name of the index file. The default is index.xml.
  • repositoryName - The name attribute in the generated index. The default is the name of the task.
  • 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
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an Index task.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.gradle.api.file.ConfigurableFileCollection
    bundles(Object... paths)
    Add files to the bundles to be indexed.
    org.gradle.api.provider.Property<URI>
    The URI base of the generated index.
    org.gradle.api.file.ConfigurableFileCollection
    The bundles to be indexed.
    org.gradle.api.file.DirectoryProperty
    The destination directory for the index.
    boolean
    Whether a gzip'd index should be made.
    org.gradle.api.file.RegularFileProperty
    The compressed index file.
    org.gradle.api.provider.Property<String>
    The name of the index file.
    org.gradle.api.file.RegularFileProperty
    The uncompressed index file.
    org.gradle.api.provider.Property<String>
    The name attribute in the generated index.
    void
    Index the bundles.
    boolean
    Whether a gzip'd index should be made.
    void
    Set the bundles to be indexed.
    void
    setGzip(boolean gzip)
    Set whether a gzip'd index should be made.

    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
  • Constructor Details

    • Index

      public Index()
      Create an Index task.
  • Method Details

    • getBase

      @Input public org.gradle.api.provider.Property<URI> getBase()
      The URI base of the generated index.

      The default is the file: URI of the destinationDir.

      Returns:
      The property for the base of the generated index.
    • getBundles

      @InputFiles public org.gradle.api.file.ConfigurableFileCollection getBundles()
      The bundles to be indexed.
      Returns:
      The property for the bundles to be indexed.
    • getDestinationDirectory

      @Internal("Represented by indexUncompressed and indexCompressed") public org.gradle.api.file.DirectoryProperty getDestinationDirectory()
      The destination directory for the index.

      The default value is project.layout.buildDirectory.

      Returns:
      The property for the destination directory for the index.
    • isGzip

      @Input public boolean isGzip()
      Whether a gzip'd index should be made.
      Returns:
      true if a gzip'd copy of the index will be made. Otherwise, only the uncompressed index will be made. The default is false.
    • getGzip

      @Internal public boolean getGzip()
      Whether a gzip'd index should be made.

      An alias for isGzip().

      Returns:
      true if a gzip'd copy of the index will be made. Otherwise, only the uncompressed index will be made. The default is false.
    • setGzip

      public void setGzip(boolean gzip)
      Set whether a gzip'd index should be made.
      Parameters:
      gzip - If true, then a gzip'd copy of the index will be made. Otherwise, only the uncompressed index will be made. The default is false.
    • getIndexName

      @Internal("Represented by indexUncompressed and indexCompressed") public org.gradle.api.provider.Property<String> getIndexName()
      The name of the index file.

      The default is index.xml.

      Returns:
      The name of the index file.
    • getRepositoryName

      @Input public org.gradle.api.provider.Property<String> getRepositoryName()
      The name attribute in the generated index.

      The default is the name of the task.

      Returns:
      The name attribute in the generated index.
    • getIndexUncompressed

      @OutputFile public org.gradle.api.file.RegularFileProperty getIndexUncompressed()
      The uncompressed index file.

      The default is destinationDirectory.file(indexName).

      Returns:
      The uncompressed index file.
    • getIndexCompressed

      @OutputFile public org.gradle.api.file.RegularFileProperty getIndexCompressed()
      The compressed index file.

      The default is destinationDirectory.file(indexName+".gz").

      Returns:
      The compressed index file.
    • bundles

      public org.gradle.api.file.ConfigurableFileCollection bundles(Object... paths)
      Add files to the bundles to be indexed.
      Parameters:
      paths - The arguments will be handled using ConfigurableFileCollection.from().
      Returns:
      The property for the bundles to be indexed.
    • setBundles

      public void setBundles(Object path)
      Set the bundles to be indexed.
      Parameters:
      path - The argument will be handled using ConfigurableFileCollection.from().
    • indexerAction

      public void indexerAction() throws Exception
      Index the bundles.
      Throws:
      Exception - An exception during indexing.