Class Baseline

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
aQute.bnd.gradle.Baseline
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 Baseline extends org.gradle.api.DefaultTask
Baseline task type for Gradle.

This task type can be used to baseline a bundle.

Here is an example of using the Baseline task type:

 import aQute.bnd.gradle.Baseline
 configurations {
   baseline
 }
 dependencies {
     baseline("group": group, "name": jar.archiveBaseName) {
       version {
         strictly "(0,${jar.archiveVersion.get()}["
       }
       transitive false
     }
 }
 tasks.register("baseline", Baseline) {
   bundle = jar
   baseline = configurations.baseline
 }
 

Properties:

  • ignoreFailures - If true the build will not fail due to baseline problems; instead an error message will be logged. Otherwise, the build will fail. The default is false.
  • baselineReportDirName - This is the name of the baseline reports directory. Can be a name or a path relative to ReportingExtension.getBaseDir(). The default name is "baseline".
  • bundle - This is the bundle to be baselined. It can either be a File or a task that produces a bundle. This property must be set.
  • baseline - This is the baseline bundle. It can either be a File or a Configuration. If a Configuration is specified, it must contain a single file; otherwise an exception will fail the build. This property must be set.
  • diffignore - These are the bundle headers or resource paths to ignore when baselining. The default is nothing ignored.
  • diffpackages - These are the names of the exported packages to baseline. The default is all exported packages.
  • 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 a Baseline task.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Baseline the bundle.
    void
    diffignore(String... diffignore)
    Add diffignore values.
    void
    diffpackages(String... diffpackages)
    Add diffpackages values.
    org.gradle.api.provider.Provider<org.gradle.api.file.RegularFile>
    Get the baseline bundle file.
    org.gradle.api.file.DirectoryProperty
    The baseline reports directory.
    org.gradle.api.provider.Property<String>
    The name of the baseline reports directory.
    org.gradle.api.provider.Provider<org.gradle.api.file.RegularFile>
    Return the bundle file to be baselined.
    org.gradle.api.tasks.bundling.Jar
    Get the task which makes the bundle being baselined.
    org.gradle.api.provider.ListProperty<String>
    The bundle headers or resource paths to ignore when baselining.
    org.gradle.api.provider.ListProperty<String>
    The names of the exported packages to baseline.
    boolean
    Whether baseline failures should be ignored.
    org.gradle.api.file.RegularFileProperty
    The baseline reports file.
    boolean
    Whether baseline failures should be ignored.
    void
    Set the baseline bundle from a File.
    void
    Set the bundle to be baselined.
    void
    setIgnoreFailures(boolean ignoreFailures)
    Set whether baseline failures should be ignored.

    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

    • Baseline

      public Baseline()
      Create a Baseline task.
  • Method Details

    • isIgnoreFailures

      @Input public boolean isIgnoreFailures()
      Whether baseline failures should be ignored.
      Returns:
      true if baseline failures will not fail the task. Otherwise, a baseline failure will fail the task. The default is false.
    • getIgnoreFailures

      @Internal public boolean getIgnoreFailures()
      Whether baseline failures should be ignored.

      Alias for isIgnoreFailures().

      Returns:
      true if baseline failures will not fail the task. Otherwise, a baseline failure will fail the task. The default is false.
    • setIgnoreFailures

      public void setIgnoreFailures(boolean ignoreFailures)
      Set whether baseline failures should be ignored.
      Parameters:
      ignoreFailures - If true, then baseline failures will not fail the task. Otherwise, a baseline failure will fail the task. The default is false.
    • getDiffpackages

      @Input public org.gradle.api.provider.ListProperty<String> getDiffpackages()
      The names of the exported packages to baseline.

      The default is all exported packages.

      Returns:
      The list property of the exported packages to baseline.
    • getDiffignore

      @Input public org.gradle.api.provider.ListProperty<String> getDiffignore()
      The bundle headers or resource paths to ignore when baselining.

      The default is nothing ignored.

      Returns:
      The list property of the bundle headers or resource paths to ignore when baselining.
    • getBaselineReportDirName

      @Internal("Represented by reportFile") public org.gradle.api.provider.Property<String> getBaselineReportDirName()
      The name of the baseline reports directory.

      Can be a name or a path relative to ReportingExtension.getBaseDirectory(). The default name is "baseline".

      Returns:
      The property of the name of the baseline reports directory.
    • getBaselineReportDirectory

      @Internal("Represented by reportFile") public org.gradle.api.file.DirectoryProperty getBaselineReportDirectory()
      The baseline reports directory.

      The default is ReportingExtension.getBaseDirectory().dir(baselineReportDirName).

      Returns:
      The property of the baseline reports directory.
    • getReportFile

      @OutputFile public org.gradle.api.file.RegularFileProperty getReportFile()
      The baseline reports file.

      The default is baselineReportDirectory.dir("${task.name}/${bundlename}.txt").

      Returns:
      The property of the baseline reports file.
    • getBundle

      @InputFile public org.gradle.api.provider.Provider<org.gradle.api.file.RegularFile> getBundle()
      Return the bundle file to be baselined.

      An exception will be thrown if the set bundle does not result in exactly one file.

      Returns:
      The provider of the bundle file to be baselined.
    • setBundle

      public void setBundle(Object file)
      Set the bundle to be baselined.
      Parameters:
      file - The argument will be handled using ConfigurableFileCollection.from().
    • getBaseline

      @InputFile public org.gradle.api.provider.Provider<org.gradle.api.file.RegularFile> getBaseline()
      Get the baseline bundle file.

      An exception will be thrown if the baseline argument does not result in exactly one file.

      Returns:
      The provider of the baseline bundle file.
    • setBaseline

      public void setBaseline(Object file)
      Set the baseline bundle from a File.
      Parameters:
      file - The argument will be handled using ConfigurableFileCollection.from().
    • diffignore

      public void diffignore(String... diffignore)
      Add diffignore values.
      Parameters:
      diffignore - Bundle headers or resource paths to ignore when baselining.
    • diffpackages

      public void diffpackages(String... diffpackages)
      Add diffpackages values.
      Parameters:
      diffpackages - Names of exported packages to baseline.
    • getBundleTask

      @Internal("Used by baseline configuration") public org.gradle.api.tasks.bundling.Jar getBundleTask()
      Get the task which makes the bundle being baselined.
      Returns:
      The task which makes the bundle being baselined.
    • baselineAction

      public void baselineAction() throws Exception
      Baseline the bundle.
      Throws:
      Exception - An exception from baselining.