The root build.gradle
script includes several global configuration closures. These closures are executed once when you run your build (as opposed to the tasks in the allprojects
closure, which get executed for each project).
excludeNonDevBuildTasks
The excludeNonDevBuild
configuration closure retrieves the Boolean value of the devBuild
property, which is set either in the gradle.properties
file or on the command line when Gradle is run. If the value is true
, the build is run as normal and all tasks and task dependencies are executed. If the value is false
, several development-related tasks are excluded from the build process. Out of the box, the tasks to exclude are test
(unit tests) and jshint
(JavaScript formatting and syntax checking).
setDynamoClasspath
The setDynamoClasspath
configuration closure builds the Dynamo classpath using a custom ant task (atg.applauncher.taskdef.DynamoClasspathTask
). The requiredPlatformModules
property of the root gradle.properties
file defines the Oracle Commerce Platform modules that are included the Dynamo classpath. Out of the box, this property looks like this:
requiredPlatformModules=\ DCS.ADC;DAF.Endeca.Assembler;DAF.Endeca.Index;DPS-UI;SiteAdmin.Versioned
setDynamoHome
The setDynamoHome
configuration closure sets the dynamoHome
value to be used by the build scripts. The dynamoHome
value is obtained from one of three locations:
setDyanmoHome
first tries to retrieve the value fordynamoHome
from the command line arguments used when running Gradle. To pass adynamoHome
value on the command line, use:-- PdynamoHome=<path_to_dynamoHome>
or
--project-prop dynamoHome=<path_to_dynamoHome>
If
dynamoHome
has not been defined on the command line, the value set fordynamoHome
in the rootgradle.properties
file is used.IMPORTANT: If you choose to set
dynamoHome
in thegradle.properties
file, you must use forward slashes, even if you are on Windows.If the
dynamoHome
value has not been defined in either of the above locations, the value of theDYNAMO_HOME
system environment variable is used.
If the dynamoHome
value cannot be determined from any of the above locations, the build fails.
setProxy
The setProxy
configuration closure retrieves the httpProxy
and httpsProxy
property values from the gradle.properties
file and assigns them to a global proxySettings
variable. This global variable can then be used in Exec
tasks (tasks that run executables on the command line). For example, the bowerInstall
task must retrieve packages from across the network, so it requires the proxySettings
variable. The syntax for specifying an Exec
task that uses the proxySettings
variable is:
task('myExecTask', type: Exec) { environment proxySettings; commandLinec
md
|c
md.bat
, "cmdArg
" }