use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.
the class FavoritesSerializable method serializeIn.
public static void serializeIn(SettingsNode settings, List<FavoriteTask> favorites) {
//remove everything already there
favorites.clear();
SettingsNode rootElement = settings.getChildNode(ROOT_TAG);
if (rootElement == null) {
return;
}
Iterator<SettingsNode> iterator = rootElement.getChildNodes(FAVORITE_ELEMENT_TAG).iterator();
while (iterator.hasNext()) {
SettingsNode taskNode = iterator.next();
String fullCommandLine = taskNode.getValueOfChild(FULL_COMMAND_LINE, null);
if (fullCommandLine != null) {
String displayName = taskNode.getValueOfChild(DISPLAY_NAME, fullCommandLine);
boolean showOutput = taskNode.getValueOfChildAsBoolean(SHOW_OUTPUT, false);
addFavoriteTask(favorites, fullCommandLine, displayName, showOutput);
}
}
}
use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.
the class FavoritesSerializable method serializeOut.
public static void serializeOut(SettingsNode settings, List<FavoriteTask> favorites) {
SettingsNode rootNode = settings.addChildIfNotPresent(ROOT_TAG);
//clear out whatever may have already been there
rootNode.removeAllChildren();
Iterator<FavoriteTask> iterator = favorites.iterator();
while (iterator.hasNext()) {
FavoriteTask favoriteTask = iterator.next();
SettingsNode taskNode = rootNode.addChild(FAVORITE_ELEMENT_TAG);
taskNode.setValueOfChild(FULL_COMMAND_LINE, favoriteTask.getFullCommandLine());
taskNode.setValueOfChild(DISPLAY_NAME, favoriteTask.getDisplayName());
taskNode.setValueOfChildAsBoolean(SHOW_OUTPUT, favoriteTask.alwaysShowOutput());
}
}
use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.
the class BasicProjectAndTaskFilter method serializeInStringList.
/**
* Reads in a list of strings as 'item' element children of parentElement.
*/
private void serializeInStringList(SettingsNode parentNode, List<String> strings) {
Iterator<SettingsNode> iterator = parentNode.getChildNodes(ITEM).iterator();
while (iterator.hasNext()) {
SettingsNode itemNode = iterator.next();
String item = itemNode.getValue();
if (item != null) {
strings.add(item);
}
}
}
use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.
the class BasicProjectAndTaskFilter method serializeOutStringList.
/**
* Writes out a list of strings as 'item' element children of parentElement.
*/
private void serializeOutStringList(SettingsNode parentNode, List<String> strings) {
Iterator<String> iterator = strings.iterator();
while (iterator.hasNext()) {
String item = iterator.next();
SettingsNode itemNode = parentNode.addChild(ITEM);
itemNode.setValue(item);
}
}
use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.
the class BasicProjectAndTaskFilter method serializeOut.
/**
* Call this to saves the current settings.
*
* @param settings where you save the settings.
*/
public void serializeOut(SettingsNode settings) {
SettingsNode rootNode = settings.addChildIfNotPresent(BASIC_PROJECT_AND_TASK_FILTER);
//clear out whatever may have already been there
rootNode.removeAllChildren();
rootNode.setValueOfChildAsBoolean(FILTER_OUT_TASKS_WITH_NO_DESCRIPTION, filterOutTasksWithNoDescription);
SettingsNode filteredOutProjectsNode = rootNode.addChild(FILTERED_OUT_PROJECTS);
serializeOutStringList(filteredOutProjectsNode, filteredOutProjectNames);
SettingsNode filteredOutTasksNode = rootNode.addChild(FILTERED_OUT_TASKS);
serializeOutStringList(filteredOutTasksNode, filteredOutTaskNames);
}
Aggregations