Class BaseGroovyPlugin

java.lang.Object
groovy.lang.GroovyObjectSupport
org.savantbuild.plugin.groovy.BaseGroovyPlugin
All Implemented Interfaces:
groovy.lang.GroovyObject, Plugin

public class BaseGroovyPlugin extends groovy.lang.GroovyObjectSupport implements Plugin
Abstract base class for plugins. This defines some helper methods that all plugins will need and it also allows Savant to pass the Project and Output objects to plugins.
  • Field Details

    • output

      public final org.savantbuild.output.Output output
    • project

      public final Project project
    • runtimeConfiguration

      public final RuntimeConfiguration runtimeConfiguration
  • Constructor Details

    • BaseGroovyPlugin

      protected BaseGroovyPlugin(Project project, RuntimeConfiguration runtimeConfiguration, org.savantbuild.output.Output output)
  • Method Details

    • fail

      protected void fail(String message, Object... values)
      Fails the build with the given message by throwing a BuildFailureException.
      Parameters:
      message - The failure message.
      values - Values used to format the message String.
    • loadConfiguration

      protected Properties loadConfiguration(org.savantbuild.dep.domain.ArtifactID id, String errorMessage)

      Loads the plugin configuration file. If the configuration file doesn't exist, this throws an exception.

      The configuration file location is standardized and based on the ArtifactID of the plugin and the user's home directory.

      The location pattern is as follows:

         $XDG_CONFIG_HOME/savant/plugins/<id.group>.<id.name>.properties
       
      Parameters:
      id - The artifact Id that is used to load the configuration file.
      errorMessage - The error message to print out if the configuration file doesn't exist or is invalid.
      Returns:
      The Properties object for the configuration file.