Griffon 1.2.0

griffon.util
[Groovy] Class BuildSettings

java.lang.Object
  griffon.util.AbstractBuildSettings
      griffon.util.BuildSettings

class BuildSettings
extends AbstractBuildSettings

Represents the project paths and other build settings that the user can change when running the Griffon commands. Defaults are provided for all settings, but the user can override those by setting the appropriate system property or specifying a value for it in the BuildConfig.groovy file.

Warning The behaviour is poorly defined if you explicitly set some of the project paths (such as projectWorkDir), but not others. If you set one of them explicitly, set all of them to ensure consistent behaviour.


Field Summary
static String APP_BASE_DIR

The base directory of the application

static String BUILD_LISTENERS

The name of the system property for multiple buildListeners.

private static String GRIFFON_APP

private static Logger LOG

static String PLUGINS_DIR

The name of the system property for projectPluginsDir.

static String PROJECT_CLASSES_DIR

The name of the system property for classesDir.

static String PROJECT_DOCS_OUTPUT_DIR

The name of the system property for testReportsDir.

static String PROJECT_RESOURCES_DIR

The name of the system property for resourcesDir.

static String PROJECT_SOURCE_DIR

The name of the system property for sourceDir.

static String PROJECT_TARGET_DIR

The name of the system property for projectTargetDir.

static String PROJECT_TEST_CLASSES_DIR

The name of the system property for testClassesDir.

static String PROJECT_TEST_REPORTS_DIR

The name of the system property for testReportsDir.

static String PROJECT_TEST_RESOURCES_DIR

The name of the system property for testResourcesDir.

static String PROJECT_TEST_SOURCE_DIR

The name of the system property for testSourceDir.

static String PROJECT_WORK_DIR

The name of the system property for projectWorkDir.

static int RESOLUTION_ERROR

static int RESOLUTION_OK

static int RESOLUTION_SKIPPED

private static PathMatchingResourcePatternResolver RESOLVER

static String WORK_DIR

The name of the system property for griffonWorkDir.

ArtifactSettings artifactSettings

private List buildDependencies

private boolean buildListenersSet

private boolean classesDirSet

private List compileDependencies

private boolean defaultBuildDepsAdded

private boolean defaultCompileDepsAdded

private boolean defaultRuntimeDepsAdded

private boolean defaultTestDepsAdded

private boolean docsOutputDirSet

private GroovyClassLoader gcl

private boolean griffonWorkDirSet

private List internalBuildDependencies

List containing the dependencies required for the build system only

private List internalCompileDependencies

List containing the default (resolved via the dependencyManager) compile-time dependencies of the app as File instances.

private List internalRuntimeDependencies

List containing the default runtime-time dependencies of the app as File instances.

private List internalTestDependencies

List containing the default test-time dependencies of the app as File instances.

PluginSettings pluginSettings

private boolean projectTargetDirSet

private boolean projectWorkDirSet

private boolean readFromCache

private Map resolveCache

private String resolveChecksum

private boolean resourcesDirSet

private List runtimeDependencies

protected boolean settingsFileLoaded

private boolean sourceDirSet

private boolean sourceEncodingSet

private boolean testClassesDirSet

private List testDependencies

private boolean testReportsDirSet

private boolean testResourcesDirSet

private boolean testSourceDirSet

private boolean verboseCompileSet

 
Fields inherited from class AbstractBuildSettings
cache, config, flatConfig, projectPluginsDir, projectPluginsDirSet
 
Property Summary
static Closure ARTIFACT_FILTER

static Pattern JAR_PATTERN

ResolveReport allDependenciesReport

The dependency report for all configurations

String antVersion

List applicationJars

List of jars provided in the applications 'lib' directory

File baseDir

The base directory for the build, which is normally the root directory of the current project.

List buildListeners

ResolveReport buildResolveReport

File classesDir

The location to which Griffon compiles a project's classes.

ResolveReport compileResolveReport

String compilerDebug

String compilerSourceLevel

The compiler source level to use

String compilerTargetLevel

The compiler target level to use

List defaultBuildDependencies

List defaultCompileDependencies

boolean defaultEnv

true if the default environment for a script should be used.

List defaultRuntimeDependencies

List defaultTestDependencies

boolean dependenciesExternallyConfigured

Whether the project required build dependencies are externally configured (by Maven for example) or not

IvyDependencyManager dependencyManager

Manages dependencies and dependency resolution in a Griffon application

File docsOutputDir

The location of the documentation output.

boolean enableResolve

Whether to enable resolving dependencies

String griffonEnv

The environment for the current script.

File griffonHome

Location of the Griffon distribution as usually identified by the Griffon_HOME environment variable.

Closure griffonScriptClosure

Implementation of the "griffonScript()" method used in Griffon scripts.

String griffonVersion

The version of Griffon being used for the current script.

File griffonWorkDir

The location of the Griffon working directory where non-project-specific temporary files are stored.

String groovyVersion

boolean includeJavadoc

whether to include javadoc attachments in a resolve

Closure includePluginScriptClosure

Implementation of the "includePluginScript()" method used in Griffon scripts.

Closure includeScriptClosure

Implementation of the "includeScript()" method used in Griffon scripts.

boolean includeSource

whether to include source attachments in a resolve

String log4jVersion

boolean modified

Return whether the BuildConfig has been modified

File projectTargetDir

The location of the project target directory where reports, artifacts and so on are output.

File projectWorkDir

The location of the project working directory for project-specific temporary files.

ConfigObject proxySettings

The settings used to establish the HTTP proxy to use for dependency resolution etc.

File proxySettingsFile

The file containing the proxy settings

Closure resolveResourcesClosure

Implementation of the "resolveResources()" method used in Griffon scripts.

File resourcesDir

The location where Griffon keeps temporary copies of a project's resources.

URLClassLoader rootLoader

The root loader for the build.

ResolveReport runtimeResolveReport

String slf4jVersion

File sourceDir

The location of the plain source.

String sourceEncoding

Src Encoding

String springVersion

Map systemProperties

File testClassesDir

The location to which Griffon compiles a project's test classes.

File testReportsDir

The location of the test reports.

ResolveReport testResolveReport

File testResourcesDir

The location to which Griffon writes a project's test resources.

File testSourceDir

The location of the test source.

File userHome

Location of the current user's home directory - equivalent to "user.home" system property.

 
Constructor Summary
BuildSettings()

BuildSettings(String griffonHome)

BuildSettings(File griffonHome)

BuildSettings(File griffonHome, File baseDir)

 
Method Summary
IvyDependencyManager configureDependencyManager(ConfigObject config)

ConfigReader createConfigReader()

private File establishBaseDir()

private void establishProjectStructure()

File getBaseDir()

Returns the current base directory of this project.

List getBuildDependencies()

List containing the runtime dependencies of the app as File instances.

Object[] getBuildListeners()

List getCompileDependencies()

List containing the compile-time dependencies of the app as File instances.

Object getConfigValue(String key, Object defaultValue)

Object getPropertyValue(String propertyName, Object defaultValue)

List getRuntimeDependencies()

List containing the runtime dependencies of the app as File instances.

List getTestDependencies()

List containing the test-time dependencies of the app as File instances.

private Object getValueFromSystemOrBuild(String propertyName, Properties props)

private Object getValueOf(String propertyName, Properties props, Object defaultValue)

File isAddonPlugin()

File isArchetypeProject()

boolean isGriffonProject()

boolean isOfflineMode()

File isPluginProject()

private def loadBuildPropertiesFromClasspath(Properties buildProps)

ConfigObject loadConfig()

Loads the application's BuildConfig.groovy file if it exists and returns the corresponding config object.

ConfigObject loadConfig(File configFile)

Loads the given configuration file if it exists and returns the corresponding config object.

ConfigObject loadConfig(ConfigObject config)

protected ConfigObject loadSettingsFile()

GroovyClassLoader obtainGroovyClassLoader()

protected void parseGriffonBuildListeners()

Closure pluginDependencyHandler()

Closure pluginDependencyHandler(IvyDependencyManager dependencyManager)

protected void postLoadConfig()

ConfigObject resetConfig()

void setBaseDir(File newBaseDir)

void setBuildDependencies(List deps)

Sets the runtime dependencies for the project

void setBuildListeners(def buildListeners)

void setClassesDir(File dir)

void setCompileDependencies(List deps)

Sets the compile time dependencies for the project

void setGriffonWorkDir(File dir)

void setProjectTargetDir(File dir)

void setProjectWorkDir(File dir)

void setResourcesDir(File dir)

void setRuntimeDependencies(List deps)

Sets the runtime dependencies for the project

void setSourceDir(File dir)

void setSourceEncoding(String encoding)

void setTestClassesDir(File dir)

void setTestDependencies(List deps)

Sets the test time dependencies for the project

void setTestReportsDir(File dir)

void setTestResourcesDir(File dir)

void setTestSourceDir(File dir)

protected boolean shouldResolve()

void updateDependenciesFor(String conf, List dependencies)

 
Methods inherited from class AbstractBuildSettings
clearCache, debug, getBaseDir, getConfig, getDefaultAnswerNonInteractive, getProjectPluginsDir, isDebugEnabled, setConfig, setProjectPluginsDir
 

Field Detail

APP_BASE_DIR

public static final String APP_BASE_DIR
The base directory of the application


BUILD_LISTENERS

public static final String BUILD_LISTENERS
The name of the system property for multiple buildListeners.


GRIFFON_APP

private static final String GRIFFON_APP


LOG

private static final Logger LOG


PLUGINS_DIR

public static final String PLUGINS_DIR
The name of the system property for projectPluginsDir.


PROJECT_CLASSES_DIR

public static final String PROJECT_CLASSES_DIR
The name of the system property for classesDir.


PROJECT_DOCS_OUTPUT_DIR

public static final String PROJECT_DOCS_OUTPUT_DIR
The name of the system property for testReportsDir.


PROJECT_RESOURCES_DIR

public static final String PROJECT_RESOURCES_DIR
The name of the system property for resourcesDir.


PROJECT_SOURCE_DIR

public static final String PROJECT_SOURCE_DIR
The name of the system property for sourceDir.


PROJECT_TARGET_DIR

public static final String PROJECT_TARGET_DIR
The name of the system property for projectTargetDir.


PROJECT_TEST_CLASSES_DIR

public static final String PROJECT_TEST_CLASSES_DIR
The name of the system property for testClassesDir.


PROJECT_TEST_REPORTS_DIR

public static final String PROJECT_TEST_REPORTS_DIR
The name of the system property for testReportsDir.


PROJECT_TEST_RESOURCES_DIR

public static final String PROJECT_TEST_RESOURCES_DIR
The name of the system property for testResourcesDir.


PROJECT_TEST_SOURCE_DIR

public static final String PROJECT_TEST_SOURCE_DIR
The name of the system property for testSourceDir.


PROJECT_WORK_DIR

public static final String PROJECT_WORK_DIR
The name of the system property for projectWorkDir.


RESOLUTION_ERROR

public static final int RESOLUTION_ERROR


RESOLUTION_OK

public static final int RESOLUTION_OK


RESOLUTION_SKIPPED

public static final int RESOLUTION_SKIPPED


RESOLVER

private static final PathMatchingResourcePatternResolver RESOLVER


WORK_DIR

public static final String WORK_DIR
The name of the system property for griffonWorkDir.


artifactSettings

public final ArtifactSettings artifactSettings


buildDependencies

private List buildDependencies


buildListenersSet

private boolean buildListenersSet


classesDirSet

private boolean classesDirSet


compileDependencies

private List compileDependencies


defaultBuildDepsAdded

private boolean defaultBuildDepsAdded


defaultCompileDepsAdded

private boolean defaultCompileDepsAdded


defaultRuntimeDepsAdded

private boolean defaultRuntimeDepsAdded


defaultTestDepsAdded

private boolean defaultTestDepsAdded


docsOutputDirSet

private boolean docsOutputDirSet


gcl

private GroovyClassLoader gcl


griffonWorkDirSet

private boolean griffonWorkDirSet


internalBuildDependencies

private List internalBuildDependencies
List containing the dependencies required for the build system only


internalCompileDependencies

private List internalCompileDependencies
List containing the default (resolved via the dependencyManager) compile-time dependencies of the app as File instances.


internalRuntimeDependencies

private List internalRuntimeDependencies
List containing the default runtime-time dependencies of the app as File instances.


internalTestDependencies

private List internalTestDependencies
List containing the default test-time dependencies of the app as File instances.


pluginSettings

public final PluginSettings pluginSettings


projectTargetDirSet

private boolean projectTargetDirSet


projectWorkDirSet

private boolean projectWorkDirSet


readFromCache

private boolean readFromCache


resolveCache

private Map resolveCache


resolveChecksum

private String resolveChecksum


resourcesDirSet

private boolean resourcesDirSet


runtimeDependencies

private List runtimeDependencies


settingsFileLoaded

protected boolean settingsFileLoaded


sourceDirSet

private boolean sourceDirSet


sourceEncodingSet

private boolean sourceEncodingSet


testClassesDirSet

private boolean testClassesDirSet


testDependencies

private List testDependencies


testReportsDirSet

private boolean testReportsDirSet


testResourcesDirSet

private boolean testResourcesDirSet


testSourceDirSet

private boolean testSourceDirSet


verboseCompileSet

private boolean verboseCompileSet


 
Property Detail

ARTIFACT_FILTER

static final Closure ARTIFACT_FILTER


JAR_PATTERN

static final Pattern JAR_PATTERN


allDependenciesReport

@Lazy
ResolveReport allDependenciesReport
The dependency report for all configurations


antVersion

final String antVersion


applicationJars

List applicationJars
List of jars provided in the applications 'lib' directory


baseDir

File baseDir
The base directory for the build, which is normally the root directory of the current project. If a command is run outside of a project, then this will be the current working directory that the command was launched from.


buildListeners

List buildListeners


buildResolveReport

ResolveReport buildResolveReport


classesDir

File classesDir
The location to which Griffon compiles a project's classes.


compileResolveReport

ResolveReport compileResolveReport


compilerDebug

String compilerDebug


compilerSourceLevel

String compilerSourceLevel
The compiler source level to use


compilerTargetLevel

String compilerTargetLevel
The compiler target level to use


defaultBuildDependencies

@Lazy
List defaultBuildDependencies


defaultCompileDependencies

@Lazy
List defaultCompileDependencies


defaultEnv

boolean defaultEnv
true if the default environment for a script should be used.


defaultRuntimeDependencies

@Lazy
List defaultRuntimeDependencies


defaultTestDependencies

@Lazy
List defaultTestDependencies


dependenciesExternallyConfigured

boolean dependenciesExternallyConfigured
Whether the project required build dependencies are externally configured (by Maven for example) or not


dependencyManager

IvyDependencyManager dependencyManager
Manages dependencies and dependency resolution in a Griffon application


docsOutputDir

File docsOutputDir
The location of the documentation output.


enableResolve

boolean enableResolve
Whether to enable resolving dependencies


griffonEnv

String griffonEnv
The environment for the current script.


griffonHome

File griffonHome
Location of the Griffon distribution as usually identified by the Griffon_HOME environment variable. This value may be null if Griffon_HOME is not set, for example if a project uses the Griffon JAR files directly.


griffonScriptClosure

Closure griffonScriptClosure
Implementation of the "griffonScript()" method used in Griffon scripts.


griffonVersion

final String griffonVersion
The version of Griffon being used for the current script.


griffonWorkDir

File griffonWorkDir
The location of the Griffon working directory where non-project-specific temporary files are stored.


groovyVersion

final String groovyVersion


includeJavadoc

boolean includeJavadoc
whether to include javadoc attachments in a resolve


includePluginScriptClosure

Closure includePluginScriptClosure
Implementation of the "includePluginScript()" method used in Griffon scripts.


includeScriptClosure

Closure includeScriptClosure
Implementation of the "includeScript()" method used in Griffon scripts.


includeSource

boolean includeSource
whether to include source attachments in a resolve


log4jVersion

final String log4jVersion


modified

boolean modified
Return whether the BuildConfig has been modified


projectTargetDir

File projectTargetDir
The location of the project target directory where reports, artifacts and so on are output.


projectWorkDir

File projectWorkDir
The location of the project working directory for project-specific temporary files.


proxySettings

ConfigObject proxySettings
The settings used to establish the HTTP proxy to use for dependency resolution etc.


proxySettingsFile

File proxySettingsFile
The file containing the proxy settings


resolveResourcesClosure

Closure resolveResourcesClosure
Implementation of the "resolveResources()" method used in Griffon scripts.


resourcesDir

File resourcesDir
The location where Griffon keeps temporary copies of a project's resources.


rootLoader

URLClassLoader rootLoader
The root loader for the build. This has the required libraries on the classpath.


runtimeResolveReport

ResolveReport runtimeResolveReport


slf4jVersion

final String slf4jVersion


sourceDir

File sourceDir
The location of the plain source.


sourceEncoding

String sourceEncoding
Src Encoding


springVersion

final String springVersion


systemProperties

final Map systemProperties


testClassesDir

File testClassesDir
The location to which Griffon compiles a project's test classes.


testReportsDir

File testReportsDir
The location of the test reports.


testResolveReport

ResolveReport testResolveReport


testResourcesDir

File testResourcesDir
The location to which Griffon writes a project's test resources.


testSourceDir

File testSourceDir
The location of the test source.


userHome

File userHome
Location of the current user's home directory - equivalent to "user.home" system property.


 
Constructor Detail

BuildSettings

BuildSettings()


BuildSettings

BuildSettings(String griffonHome)


BuildSettings

BuildSettings(File griffonHome)


BuildSettings

BuildSettings(File griffonHome, File baseDir)


 
Method Detail

configureDependencyManager

IvyDependencyManager configureDependencyManager(ConfigObject config)


createConfigReader

ConfigReader createConfigReader()


establishBaseDir

private File establishBaseDir()


establishProjectStructure

private void establishProjectStructure()


getBaseDir

File getBaseDir()
Returns the current base directory of this project.


getBuildDependencies

List getBuildDependencies()
List containing the runtime dependencies of the app as File instances.


getBuildListeners

Object[] getBuildListeners()


getCompileDependencies

List getCompileDependencies()
List containing the compile-time dependencies of the app as File instances.


getConfigValue

Object getConfigValue(String key, Object defaultValue)


getPropertyValue

Object getPropertyValue(String propertyName, Object defaultValue)


getRuntimeDependencies

List getRuntimeDependencies()
List containing the runtime dependencies of the app as File instances.


getTestDependencies

List getTestDependencies()
List containing the test-time dependencies of the app as File instances.


getValueFromSystemOrBuild

private Object getValueFromSystemOrBuild(String propertyName, Properties props)


getValueOf

private Object getValueOf(String propertyName, Properties props, Object defaultValue)


isAddonPlugin

File isAddonPlugin()


isArchetypeProject

File isArchetypeProject()


isGriffonProject

boolean isGriffonProject()


isOfflineMode

boolean isOfflineMode()


isPluginProject

File isPluginProject()


loadBuildPropertiesFromClasspath

private def loadBuildPropertiesFromClasspath(Properties buildProps)


loadConfig

ConfigObject loadConfig()
Loads the application's BuildConfig.groovy file if it exists and returns the corresponding config object. If the file does not exist, this returns an empty config.


loadConfig

ConfigObject loadConfig(File configFile)
Loads the given configuration file if it exists and returns the corresponding config object. If the file does not exist, this returns an empty config.


loadConfig

ConfigObject loadConfig(ConfigObject config)


loadSettingsFile

protected ConfigObject loadSettingsFile()


obtainGroovyClassLoader

GroovyClassLoader obtainGroovyClassLoader()


parseGriffonBuildListeners

protected void parseGriffonBuildListeners()


pluginDependencyHandler

Closure pluginDependencyHandler()


pluginDependencyHandler

Closure pluginDependencyHandler(IvyDependencyManager dependencyManager)


postLoadConfig

protected void postLoadConfig()


resetConfig

ConfigObject resetConfig()


setBaseDir

void setBaseDir(File newBaseDir)

Changes the base directory, making sure that everything that depends on it gets refreshed too. If you have have previously loaded a configuration file, you should load it again after calling this method.

Warning This method resets the project paths, so if they have been set manually by the caller, then that information will be lost!


setBuildDependencies

void setBuildDependencies(List deps)
Sets the runtime dependencies for the project


setBuildListeners

void setBuildListeners(def buildListeners)


setClassesDir

void setClassesDir(File dir)


setCompileDependencies

void setCompileDependencies(List deps)
Sets the compile time dependencies for the project


setGriffonWorkDir

void setGriffonWorkDir(File dir)


setProjectTargetDir

void setProjectTargetDir(File dir)


setProjectWorkDir

void setProjectWorkDir(File dir)


setResourcesDir

void setResourcesDir(File dir)


setRuntimeDependencies

void setRuntimeDependencies(List deps)
Sets the runtime dependencies for the project


setSourceDir

void setSourceDir(File dir)


setSourceEncoding

void setSourceEncoding(String encoding)


setTestClassesDir

void setTestClassesDir(File dir)


setTestDependencies

void setTestDependencies(List deps)
Sets the test time dependencies for the project


setTestReportsDir

void setTestReportsDir(File dir)


setTestResourcesDir

void setTestResourcesDir(File dir)


setTestSourceDir

void setTestSourceDir(File dir)


shouldResolve

protected boolean shouldResolve()


updateDependenciesFor

void updateDependenciesFor(String conf, List dependencies)


 

Groovy Documentation