Class ThemeBuilderOverlays
ThemeBuilder that performs the various overlays during the build process
There are three main overlay (copy) processes executed during the theme building:
- Copy related assets from web app source to the configured output directory
- Overlay assets from a parent theme to a child theme
- Perform any additional overlays that are configured in a theme's properties file
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidcopyAssetsToWorkingDir(String webappSourceDir, String themeBuilderOutputDir, List<String> additionalThemeDirectories, List<String> additionalPluginDirectories) Invoked at the beginning of the build process to move assets from the web source directory to the output directory, where they can be further processedprotected static voidoverlayAdditionalDirs(File themeDirectory, Properties themeProperties, String webappSourceDir, String themeBuilderOutputDir) Performs any additional overlays that have been configured for the theme (with theadditionalOverlaysproperty)protected static voidoverlayParentAssets(String themeName, File themeDirectory, Properties themeProperties, Map<String, String> themeNamePathMapping) Overlays assets from a parent theme (if there is a parent) to a child themeparseAdditionalOverlaysStr(String additionalOverlaysStr) Helper method that parses the configuration string for additional overlays into a Map where the key is the source path and the map value is the target path
-
Constructor Details
-
ThemeBuilderOverlays
public ThemeBuilderOverlays()
-
-
Method Details
-
copyAssetsToWorkingDir
protected static void copyAssetsToWorkingDir(String webappSourceDir, String themeBuilderOutputDir, List<String> additionalThemeDirectories, List<String> additionalPluginDirectories) throws IOException Invoked at the beginning of the build process to move assets from the web source directory to the output directory, where they can be further processedNote: Not all web resources are copied, just the assets that are needed to build all themes. This includes all the theme directories, plugin directories, and KRAD scripts directory
- Parameters:
webappSourceDir- absolute path to the web source directorythemeBuilderOutputDir- absolute path to the target directory, where assets will be copied to and processed. If the directory does not exist it will be createdadditionalThemeDirectories- list of additional theme paths that should be copied to the output directoryadditionalPluginDirectories- list of additional plugin paths that should be copied to the output directory- Throws:
IOException
-
overlayParentAssets
protected static void overlayParentAssets(String themeName, File themeDirectory, Properties themeProperties, Map<String, String> themeNamePathMapping) Overlays assets from a parent theme (if there is a parent) to a child themeIf the given theme has a parent (determined by the parent property in the theme properties), all files from the parent theme directory are copied to the given theme directory unless:
- A file exists in the child theme directory with the same name and relative path
- The files has been exluded through the property
parentExcludes
- Parameters:
themeName- name of the theme to be processedthemeDirectory- directory for the theme (parent assets will be copied here)themeProperties- properties for the theme, used to retrieve the parent configuration and the parent excludesthemeNamePathMapping- mapping of theme names to theme paths, used to find the parent theme directory path
-
overlayAdditionalDirs
protected static void overlayAdditionalDirs(File themeDirectory, Properties themeProperties, String webappSourceDir, String themeBuilderOutputDir) Performs any additional overlays that have been configured for the theme (with theadditionalOverlaysproperty)Additional overlays can take any directory or file from the web application, and move into the theme directory or one of its subdirectores. This is useful if there are dependencies in script that needs to be moved so they are present for the minified version
- Parameters:
themeDirectory- directory for the theme where directories will be copied tothemeProperties- properties for the theme to process, used to pull the additionalOverlays configurationwebappSourceDir- absolute path to the web source directory, if the source overlay directory is not currently present in the output directory, we need to go back and pull it from sourcethemeBuilderOutputDir- absolute path to the output directory, used to pull the source overly directory
-
parseAdditionalOverlaysStr
Helper method that parses the configuration string for additional overlays into a Map where the key is the source path and the map value is the target pathEach mapping in the string should be separated by a comma. Within the mapping, the source path should be given, followed by the target path in parenthesis ex. sourcePath(targetPath),sourcePath2(targetPath2)
- Parameters:
additionalOverlaysStr- string to parse into additional overlay mappings- Returns:
- map of additional overlay mappings
-