Search in sources :

Example 1 with BitbakeRecipe

use of com.synopsys.integration.detectable.detectables.bitbake.data.BitbakeRecipe in project synopsys-detect by blackducksoftware.

the class BitbakeRecipesParser method parseShowRecipes.

/**
 * @param showRecipeLines is the executable output.
 * @return Recipe names mapped to a recipe's the layer names.
 */
public ShowRecipesResults parseShowRecipes(List<String> showRecipeLines) {
    Map<String, List<String>> bitbakeRecipes = new HashMap<>();
    Set<String> layerNames = new HashSet<>();
    boolean started = false;
    BitbakeRecipe currentRecipe = null;
    for (String line : showRecipeLines) {
        if (StringUtils.isBlank(line)) {
            continue;
        }
        if (!started && line.trim().startsWith("=== Available recipes: ===")) {
            started = true;
        } else if (started) {
            currentRecipe = parseLine(line, currentRecipe, bitbakeRecipes, layerNames);
        }
    }
    finishCurrentRecipe(bitbakeRecipes, layerNames, currentRecipe);
    return new ShowRecipesResults(layerNames, bitbakeRecipes);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) ShowRecipesResults(com.synopsys.integration.detectable.detectables.bitbake.data.ShowRecipesResults) BitbakeRecipe(com.synopsys.integration.detectable.detectables.bitbake.data.BitbakeRecipe) HashSet(java.util.HashSet)

Aggregations

BitbakeRecipe (com.synopsys.integration.detectable.detectables.bitbake.data.BitbakeRecipe)1 ShowRecipesResults (com.synopsys.integration.detectable.detectables.bitbake.data.ShowRecipesResults)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1