org.codehaus.groovy.grails.cli.support
Class GrailsBuildHelper

java.lang.Object
  extended by org.codehaus.groovy.grails.cli.support.GrailsBuildHelper

public class GrailsBuildHelper
extends Object

Helper class that allows a client to bootstrap the Grails build system in its own class loader. It basically uses reflection to handle the entry points to the build system: BuildSettings and GrailsScriptRunner. This ensures class loader isolation for Grails.

Author:
Peter Ledbrook

Constructor Summary
GrailsBuildHelper(ClassLoader classLoader)
          Creates a helper that loads the Grails build system with the given class loader.
GrailsBuildHelper(ClassLoader classLoader, String grailsHome)
          Creates a helper that loads the Grails build system with the given class loader.
GrailsBuildHelper(ClassLoader classLoader, String grailsHome, String baseDir)
           
 
Method Summary
 int execute(String script)
          Executes the named Grails script with no arguments.
 int execute(String script, String args)
          Executes the named Grails script with the given arguments.
 int execute(String script, String args, String env)
          Executes the named Grails script with the given arguments in the specified environment.
 File getClassesDir()
           
 List getCompileDependencies()
           
 File getGlobalPluginsDir()
           
 File getGrailsWorkDir()
           
 File getProjectPluginsDir()
           
 File getProjectWorkDir()
           
 File getResourcesDir()
           
 List getRuntimeDependencies()
           
 File getTestClassesDir()
           
 List getTestDependencies()
           
 File getTestReportsDir()
           
 void setClassesDir(File dir)
           
 void setCompileDependencies(List dependencies)
           
 void setDependenciesExternallyConfigured(boolean b)
           
 void setGlobalPluginsDir(File dir)
           
 void setGrailsWorkDir(File dir)
           
 void setProjectPluginsDir(File dir)
           
 void setProjectWorkDir(File dir)
           
 void setResourcesDir(File dir)
           
 void setRuntimeDependencies(List dependencies)
           
 void setTestClassesDir(File dir)
           
 void setTestDependencies(List dependencies)
           
 void setTestReportsDir(File dir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrailsBuildHelper

public GrailsBuildHelper(ClassLoader classLoader)
Creates a helper that loads the Grails build system with the given class loader. Ideally, the class loader should be an instance of GrailsRootLoader. You can try other class loaders, but you may run into problems.

Parameters:
classLoader - The class loader that will be used to load Grails.

GrailsBuildHelper

public GrailsBuildHelper(ClassLoader classLoader,
                         String grailsHome)
Creates a helper that loads the Grails build system with the given class loader. Ideally, the class loader should be an instance of GrailsRootLoader. You can try other class loaders, but you may run into problems.

Parameters:
classLoader - The class loader that will be used to load Grails.
grailsHome - Location of a local Grails installation.

GrailsBuildHelper

public GrailsBuildHelper(ClassLoader classLoader,
                         String grailsHome,
                         String baseDir)
Method Detail

execute

public int execute(String script)
Executes the named Grails script with no arguments.

Parameters:
script - The name of the script to execute, such as "Compile".
Returns:
The value returned by the build system (notionally the exit code).

execute

public int execute(String script,
                   String args)
Executes the named Grails script with the given arguments.

Parameters:
script - The name of the script to execute, such as "Compile".
args - A single string containing the arguments for the script, each argument separated by whitespace.
Returns:
The value returned by the build system (notionally the exit code).

execute

public int execute(String script,
                   String args,
                   String env)
Executes the named Grails script with the given arguments in the specified environment. Normally the script is run in the default environment for that script.

Parameters:
script - The name of the script to execute, such as "Compile".
args - A single string containing the arguments for the script, each argument separated by whitespace.
env - The name of the environment to run in, e.g. "development" or "production".
Returns:
The value returned by the build system (notionally the exit code).

getGrailsWorkDir

public File getGrailsWorkDir()

setGrailsWorkDir

public void setGrailsWorkDir(File dir)

getProjectWorkDir

public File getProjectWorkDir()

setProjectWorkDir

public void setProjectWorkDir(File dir)

getClassesDir

public File getClassesDir()

setClassesDir

public void setClassesDir(File dir)

getTestClassesDir

public File getTestClassesDir()

setTestClassesDir

public void setTestClassesDir(File dir)

getResourcesDir

public File getResourcesDir()

setResourcesDir

public void setResourcesDir(File dir)

getProjectPluginsDir

public File getProjectPluginsDir()

setProjectPluginsDir

public void setProjectPluginsDir(File dir)

getGlobalPluginsDir

public File getGlobalPluginsDir()

setGlobalPluginsDir

public void setGlobalPluginsDir(File dir)

getTestReportsDir

public File getTestReportsDir()

setTestReportsDir

public void setTestReportsDir(File dir)

getCompileDependencies

public List getCompileDependencies()

setCompileDependencies

public void setCompileDependencies(List dependencies)

setDependenciesExternallyConfigured

public void setDependenciesExternallyConfigured(boolean b)

getTestDependencies

public List getTestDependencies()

setTestDependencies

public void setTestDependencies(List dependencies)

getRuntimeDependencies

public List getRuntimeDependencies()

setRuntimeDependencies

public void setRuntimeDependencies(List dependencies)


Copyright (c) 2005-2009 The Grails project