Package org.savantbuild.plugin.groovy
Class BaseGroovyPlugin
java.lang.Object
groovy.lang.GroovyObjectSupport
org.savantbuild.plugin.groovy.BaseGroovyPlugin
- All Implemented Interfaces:
groovy.lang.GroovyObject,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 Summary
FieldsModifier and TypeFieldDescriptionfinal org.savantbuild.output.Outputfinal Projectfinal RuntimeConfiguration -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseGroovyPlugin(Project project, RuntimeConfiguration runtimeConfiguration, org.savantbuild.output.Output output) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidFails the build with the given message by throwing aBuildFailureException.protected PropertiesloadConfiguration(org.savantbuild.dep.domain.ArtifactID id, String errorMessage) Loads the plugin configuration file.Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClassMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
getProperty, invokeMethod, setProperty
-
Field Details
-
output
public final org.savantbuild.output.Output output -
project
-
runtimeConfiguration
-
-
Constructor Details
-
BaseGroovyPlugin
protected BaseGroovyPlugin(Project project, RuntimeConfiguration runtimeConfiguration, org.savantbuild.output.Output output)
-
-
Method Details
-
fail
Fails the build with the given message by throwing aBuildFailureException.- 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.
-