Class ProjectBuildFile

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Script
org.savantbuild.parser.groovy.ProjectBuildFile
All Implemented Interfaces:
groovy.lang.GroovyObject

public abstract class ProjectBuildFile extends groovy.lang.Script
Base class from the project build file Groovy script.
  • Field Details

  • Constructor Details

    • ProjectBuildFile

      public ProjectBuildFile()
  • Method Details

    • getProperty

      public Object getProperty(String property)
      Specified by:
      getProperty in interface groovy.lang.GroovyObject
      Overrides:
      getProperty in class groovy.lang.Script
    • 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.
    • loadPlugin

      protected Plugin loadPlugin(Map<String,Object> attributes)

      Loads a plugin and returns a new instance of the Plugin class. This method is called with the information used to load the plugin like this:

         java = loadPlugin(id: "org.savantbuild.plugin:java:0.1.0")
       
      Parameters:
      attributes - The Attributes used to load the plugin.
      Returns:
      The Plugin instance.
    • project

      protected Project project(Map<String,Object> attributes, @DelegatesTo(ProjectDelegate.class) groovy.lang.Closure<?> closure)

      Sets up the project information in the build file. This method is called with a Map of values and a closure like this:

         project(group: "org.example", name: "my-project", version: "1.1", licenses: ["Commercial"]) {
      
         }
       

      The require attributes are:

         group: The name of the group that the project belongs to
         name: The name of the project
         version: The semantic version of the project.
         licenses: The license(s) of the project.
       
      Parameters:
      attributes - The attributes.
      closure - The closure that is invoked for the project configuration handling.
      Returns:
      The project.
    • target

      protected Target target(Map<String,Object> attributes, groovy.lang.Closure<?> closure)

      Adds a target to the project. This method is called with a Map of values and a closure like this:

         target(name: "compile", description: "Compiles") {
           ...
         }
       

      The required attributes are:

         name: The name of the target
       
      Parameters:
      attributes - The attributes of the target.
      closure - The closure that contains the executable pieces of the target.
      Returns:
      The Target.