use of com.synopsys.integration.detectable.detectables.bitbake.data.ShowRecipesResults in project synopsys-detect by blackducksoftware.
the class BitbakeRecipesParserTest method test.
@Test
void test() {
BitbakeRecipesParser parser = new BitbakeRecipesParser();
ShowRecipesResults results = parser.parseShowRecipes(showRecipesOutputLines);
assertEquals(3, results.getLayerNames().size());
assertTrue(results.getLayerNames().contains("meta"));
assertEquals(4, results.getRecipesWithLayers().size());
assertTrue(results.getRecipesWithLayers().containsKey("adcli"));
}
use of com.synopsys.integration.detectable.detectables.bitbake.data.ShowRecipesResults 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);
}
use of com.synopsys.integration.detectable.detectables.bitbake.data.ShowRecipesResults in project synopsys-detect by blackducksoftware.
the class BitbakeExtractor method extract.
public Extraction extract(File sourceDirectory, ExecutableTarget bashExecutable, File buildEnvironmentFile) throws ExecutableFailedException, IOException {
toolVersionLogger.log(() -> bitbakeCommandRunner.runBitbakeVersion(sourceDirectory, bashExecutable, buildEnvironmentFile));
File buildDirectory = determineBuildDirectory(sourceDirectory, bashExecutable, buildEnvironmentFile);
BitbakeEnvironment bitbakeEnvironment = executeBitbakeForEnvironment(sourceDirectory, bashExecutable, buildEnvironmentFile);
ShowRecipesResults showRecipesResults = executeBitbakeForRecipeLayerCatalog(sourceDirectory, bashExecutable, buildEnvironmentFile);
List<CodeLocation> codeLocations = packageNames.stream().map(targetPackage -> generateCodeLocationForTargetPackage(targetPackage, sourceDirectory, bashExecutable, buildEnvironmentFile, buildDirectory, showRecipesResults, bitbakeEnvironment)).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
if (codeLocations.isEmpty()) {
return Extraction.failure("No Code Locations were generated during extraction");
} else {
return Extraction.success(codeLocations);
}
}
Aggregations