Class CloverGrailsBuildTaskActions
- java.lang.Object
-
- com.atlassian.bamboo.clover.build.CloverGrailsBuildTaskActions
-
- All Implemented Interfaces:
PrePostTaskActions
,BambooPluginModule
public class CloverGrailsBuildTaskActions extends Object implements PrePostTaskActions
The pre-task action adds a Grails Clover Plugin dependency in BuildConfig.groovy or in pom.xml, if required. The post-task action will revert this change. Actions are active when an automatic Clover integration is enabled for a Job. Actions are active for GrailsMIN_GRAILS_VERSION_SUPPORTED
-MAX_GRAILS_VERSION_SUPPORTED
.
-
-
Constructor Summary
Constructors Constructor Description CloverGrailsBuildTaskActions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
addCloverToBuildConfigFile(@NotNull CommonTaskContext context, @NotNull File buildConfigFile)
Add Clover dependencies the BuildConfig.groovy file.protected boolean
addCloverToPomFile(@NotNull CommonTaskContext context, @NotNull File pomFile)
Add Clover dependencies the pom.xml file.TaskResult
executeAfter(@NotNull InternalTaskType task, @Nullable TaskResult taskResult)
Executes a custom action after the task is executed.void
executeBefore(@NotNull InternalTaskType task, @NotNull CommonTaskContext context)
Executes a custom action before the task is executed.protected @Nullable File
getBuildConfigFile(@NotNull CommonTaskContext context)
Returns location of BuildConfig file in the workspace.protected @Nullable File
getPomFile(@NotNull CommonTaskContext context)
Returns location of pom.xml file in the workspace.protected boolean
isRequiredGrailsSupported(@NotNull CommonTaskContext context)
Returns if the project to be build requires Grails version which is supported by this action (MIN_GRAILS_VERSION_SUPPORTED
andMAX_GRAILS_VERSION_SUPPORTED
).
-
-
-
Method Detail
-
executeBefore
public void executeBefore(@NotNull @NotNull InternalTaskType task, @NotNull @NotNull CommonTaskContext context) throws Exception
Description copied from interface:PrePostTaskActions
Executes a custom action before the task is executed.- Specified by:
executeBefore
in interfacePrePostTaskActions
- Parameters:
task
- a current task, it can be actually a subclass of TaskType (build plans), DeploymentTaskType (deployment plans) or CommonTaskType (build or deployment plans)context
- a current task context, can be actually a TaskContext (build plans) or DeploymentTaskContext (deployment plans), TODO can it be a CommonTaskContext? flow in TaskExecutorImpl suggests that it may happen - but under which conditions actually?- Throws:
Exception
- in case when a pre-task action fails
-
executeAfter
public TaskResult executeAfter(@NotNull @NotNull InternalTaskType task, @Nullable @Nullable TaskResult taskResult)
Description copied from interface:PrePostTaskActions
Executes a custom action after the task is executed.- Specified by:
executeAfter
in interfacePrePostTaskActions
- Parameters:
task
- a current task which was executedtaskResult
- a result of a task execution; may benull
in case task terminated abnormally- Returns:
- TaskResult a result of a task execution (you may return the original result or modify it)
-
isRequiredGrailsSupported
protected boolean isRequiredGrailsSupported(@NotNull @NotNull CommonTaskContext context)
Returns if the project to be build requires Grails version which is supported by this action (MIN_GRAILS_VERSION_SUPPORTED
andMAX_GRAILS_VERSION_SUPPORTED
). It checks the application.config file in the working directory.- Returns:
- boolean
true
is supported,false
otherwise
-
getBuildConfigFile
@Nullable protected @Nullable File getBuildConfigFile(@NotNull @NotNull CommonTaskContext context)
Returns location of BuildConfig file in the workspace.- Parameters:
context
- task context- Returns:
- File - location of BuildConfig.groovy file or
null
if not found
-
getPomFile
@Nullable protected @Nullable File getPomFile(@NotNull @NotNull CommonTaskContext context)
Returns location of pom.xml file in the workspace.- Parameters:
context
- task context- Returns:
- File - location of pom.xml or
null
if not found
-
addCloverToBuildConfigFile
protected boolean addCloverToBuildConfigFile(@NotNull @NotNull CommonTaskContext context, @NotNull @NotNull File buildConfigFile)
Add Clover dependencies the BuildConfig.groovy file.- Parameters:
buildConfigFile
- file to be modified- Returns:
- boolean - true if integration was performed, false otherwise
-
addCloverToPomFile
protected boolean addCloverToPomFile(@NotNull @NotNull CommonTaskContext context, @NotNull @NotNull File pomFile)
Add Clover dependencies the pom.xml file.- Parameters:
pomFile
- file to be modified- Returns:
- boolean - true if integration was performed, false otherwise
-
-