Class BundleTaskExtension

java.lang.Object
aQute.bnd.gradle.BundleTaskExtension

public class BundleTaskExtension extends Object
BundleTaskExtension for Gradle.

Adds bundle extension to bundle builder tasks.

Properties:

  • bndfile - This is the name of the bnd file to use to make the bundle. The bndfile does not need to exist. It will override headers in the jar task's manifest.
  • bnd - This is a string holding a bnd file to use to make the bundle. It will override headers in the jar task's manifest. This properties is ignored if bndfile is specified and the specified file exists.
  • sourceSet - This is the SourceSet to use for the bnd builder. It defaults to "project.sourceSets.main".
  • classpath - This is the FileCollection to use for the buildpath for the bnd builder. It defaults to "project.sourceSets.main.compileClasspath".
  • properties - Properties that are available for evaluation of the bnd instructions. The default is the properties of the task and project objects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Name of the extension.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BundleTaskExtension(org.gradle.api.tasks.bundling.Jar task)
    Create a BundleTaskExtension for the specified Jar task.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bnd(CharSequence... lines)
    Add instructions to the bnd property from a list of multi-line strings.
    void
    bnd(Map<String,?> map)
    Add instructions to the bnd property from a map.
    void
    bnd(org.gradle.api.provider.Provider<? extends CharSequence> lines)
    Add a multi-line string of instructions to the bnd property using a Provider.
    org.gradle.api.Action<org.gradle.api.Task>
    Return the Action to build the bundle for the task.
    org.gradle.api.file.ConfigurableFileCollection
    classpath(Object... paths)
    Add files to the classpath.
    org.gradle.api.provider.Provider<String>
    The bnd property.
    org.gradle.api.file.RegularFileProperty
    The bndfile property.
    org.gradle.api.file.ConfigurableFileCollection
    The classpath property.
    org.gradle.api.provider.MapProperty<String,Object>
    Properties that are available for evaluation of the bnd instructions.
    void
    Set the bnd property from a multi-line string.
    void
    setBnd(Map<String,?> map)
    Set the bnd property from a map.
    void
    setBnd(org.gradle.api.provider.Provider<? extends CharSequence> lines)
    Set the bnd property from a multi-line string using a Provider.
    void
    Set the classpath property.
    void
    setSourceSet(org.gradle.api.tasks.SourceSet sourceSet)
    Set the sourceSet.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • BundleTaskExtension

      public BundleTaskExtension(org.gradle.api.tasks.bundling.Jar task)
      Create a BundleTaskExtension for the specified Jar task.

      This also sets the default values for the added properties and adds the bnd file to the task inputs.

      Parameters:
      task - The Jar task for this extension.
  • Method Details

    • getBndfile

      @InputFile @PathSensitive(RELATIVE) @NormalizeLineEndings @Optional public org.gradle.api.file.RegularFileProperty getBndfile()
      The bndfile property.

      A bnd file containing bnd instructions for this project.

      Returns:
      The property for the bndfile.
    • getClasspath

      @InputFiles @Classpath public org.gradle.api.file.ConfigurableFileCollection getClasspath()
      The classpath property.

      The default value is sourceSets.main.compileClasspath.

      Returns:
      The property for the classpath.
    • getBnd

      @Input @Optional public org.gradle.api.provider.Provider<String> getBnd()
      The bnd property.

      If the bndfile property points an existing file, this property is ignored. Otherwise, the bnd instructions in this property will be used.

      Returns:
      The property for the bnd instructions.
    • getProperties

      @Input public org.gradle.api.provider.MapProperty<String,Object> getProperties()
      Properties that are available for evaluation of the bnd instructions.

      If this property is not set, the properties of the following are available:

      task
      The Task object of this extension.
      project
      The Project object for the task of this extension.
      If the task property is not set, the properties of the Task object of this extension will automatically be available.

      The following properties are set by the builder and are also available:

      project.dir
      The project directory.
      project.output
      The build directory.
      project.buildpath
      The project buildpath.
      project.sourcepath<
      The project sourcepath.

      Note: The defaults for this property use the Project object which makes the task ineligible for the Gradle configuration cache. If you want to use this task with the Gradle configuration cache, you must set this property to ensure it does not use the Project object. Of course, this then means you cannot use ${project.xxx} style expressions in the bnd instructions unless you set those values in this property.

      Returns:
      Properties available for evaluation of the bnd instructions.
    • setBnd

      public void setBnd(CharSequence line)
      Set the bnd property from a multi-line string.
      Parameters:
      line - bnd instructions.
    • bnd

      public void bnd(CharSequence... lines)
      Add instructions to the bnd property from a list of multi-line strings.
      Parameters:
      lines - bnd instructions.
    • setBnd

      public void setBnd(org.gradle.api.provider.Provider<? extends CharSequence> lines)
      Set the bnd property from a multi-line string using a Provider.
      Parameters:
      lines - A provider of bnd instructions.
    • bnd

      public void bnd(org.gradle.api.provider.Provider<? extends CharSequence> lines)
      Add a multi-line string of instructions to the bnd property using a Provider.
      Parameters:
      lines - A provider bnd instructions.
    • setBnd

      public void setBnd(Map<String,?> map)
      Set the bnd property from a map.
      Parameters:
      map - A map of bnd instructions.
    • bnd

      public void bnd(Map<String,?> map)
      Add instructions to the bnd property from a map.
      Parameters:
      map - A map of bnd instructions.
    • classpath

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

      public void setClasspath(Object path)
      Set the classpath property.
      Parameters:
      path - The argument will be handled using ConfigurableFileCollection.from().
    • setSourceSet

      public void setSourceSet(org.gradle.api.tasks.SourceSet sourceSet)
      Set the sourceSet.
      Parameters:
      sourceSet - A sourceSet to use to find source code.
    • buildAction

      public org.gradle.api.Action<org.gradle.api.Task> buildAction()
      Return the Action to build the bundle for the task.
      Returns:
      The Action to build the bundle for the task.