Package ro.isdc.wro.maven.plugin.support
Class BuildContextHolder
java.lang.Object
ro.isdc.wro.maven.plugin.support.BuildContextHolder
Encapsulate the details about state persisted across multiple build runs. This class hides the details about the
storage used to persist the data produced during a build. By default the
BuildContext is used, but if it is
not available - the alternate storage (a properties file stored in the file system) is used.- Since:
- 1.7.1
- Author:
- Alex Objelean
-
Constructor Summary
ConstructorsConstructorDescriptionBuildContextHolder(org.sonatype.plexus.build.incremental.BuildContext buildContext, File buildDirectory) -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroy the persisted storage and all stored data.booleanvoidpersist()Persist the fallbackStorage to the fallbackStorageFile.voidsetIncrementalBuildEnabled(boolean incrementalBuildEnabled) void
-
Constructor Details
-
BuildContextHolder
public BuildContextHolder(org.sonatype.plexus.build.incremental.BuildContext buildContext, File buildDirectory) - Parameters:
buildContext- - The context provided by maven. If this is not provided, the default mechanism for persisting build data is used.buildDirectory- the folder where the build output is created. If this value is null, the temp folder will be used.
-
-
Method Details
-
getValue
- Parameters:
key- of the value to retrieve.- Returns:
- the persisted value stored under the provided key. If no value exist, the returned result will be null.
-
setValue
- Parameters:
key- to associate with the value to be persisted.value- to persist.
-
setIncrementalBuildEnabled
public void setIncrementalBuildEnabled(boolean incrementalBuildEnabled) -
isIncrementalBuild
public boolean isIncrementalBuild()- Returns:
- the flag indicating the incremental build change. A build is incremental, when the modified resources should be processed only. Useful to avoid unnecessary processing when there is actually no change detected.
-
destroy
public void destroy()Destroy the persisted storage and all stored data. -
persist
public void persist()Persist the fallbackStorage to the fallbackStorageFile. This method should be invoked only once during build, since it is relatively expensive. Not invoking it, would break the incremental build feature.
-