Search in sources :

Example 1 with ConanInfoLineAnalyzer

use of com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoLineAnalyzer in project synopsys-detect by blackducksoftware.

the class DetectableFactory method conanCliExtractor.

private ConanCliExtractor conanCliExtractor(ConanCliOptions options) {
    ConanCommandRunner conanCommandRunner = new ConanCommandRunner(executableRunner, options.getLockfilePath().orElse(null), options.getAdditionalArguments().orElse(null));
    ConanInfoLineAnalyzer conanInfoLineAnalyzer = new ConanInfoLineAnalyzer();
    ConanCodeLocationGenerator conanCodeLocationGenerator = new ConanCodeLocationGenerator(options.getDependencyTypeFilter(), options.preferLongFormExternalIds());
    NodeElementParser nodeElementParser = new NodeElementParser(conanInfoLineAnalyzer);
    ConanInfoNodeParser conanInfoNodeParser = new ConanInfoNodeParser(conanInfoLineAnalyzer, nodeElementParser);
    ConanInfoParser conanInfoParser = new ConanInfoParser(conanInfoNodeParser, conanCodeLocationGenerator, externalIdFactory);
    return new ConanCliExtractor(conanCommandRunner, conanInfoParser, toolVersionLogger);
}
Also used : ConanInfoParser(com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoParser) ConanCodeLocationGenerator(com.synopsys.integration.detectable.detectables.conan.ConanCodeLocationGenerator) NodeElementParser(com.synopsys.integration.detectable.detectables.conan.cli.parser.element.NodeElementParser) ConanCommandRunner(com.synopsys.integration.detectable.detectables.conan.cli.process.ConanCommandRunner) ConanInfoLineAnalyzer(com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoLineAnalyzer) ConanCliExtractor(com.synopsys.integration.detectable.detectables.conan.cli.ConanCliExtractor) ConanInfoNodeParser(com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoNodeParser)

Example 2 with ConanInfoLineAnalyzer

use of com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoLineAnalyzer in project synopsys-detect by blackducksoftware.

the class ConanCliParserFunctionalTest method test.

@Test
public void test() throws IOException, IntegrationException {
    File conanInfoOutputFile = FunctionalTestFiles.asFile("/conan/cli/conan_info.txt");
    EnumListFilter<ConanDependencyType> dependencyTypeFilter = EnumListFilter.excludeNone();
    ConanCodeLocationGenerator conanCodeLocationGenerator = new ConanCodeLocationGenerator(dependencyTypeFilter, false);
    ConanInfoLineAnalyzer conanInfoLineAnalyzer = new ConanInfoLineAnalyzer();
    NodeElementParser nodeElementParser = new NodeElementParser(conanInfoLineAnalyzer);
    ConanInfoNodeParser conanInfoNodeParser = new ConanInfoNodeParser(conanInfoLineAnalyzer, nodeElementParser);
    ConanInfoParser parser = new ConanInfoParser(conanInfoNodeParser, conanCodeLocationGenerator, new ExternalIdFactory());
    String conanInfoOutput = FileUtils.readFileToString(conanInfoOutputFile, StandardCharsets.UTF_8);
    ConanDetectableResult result = parser.generateCodeLocationFromConanInfoOutput(conanInfoOutput);
    assertEquals(3, result.getCodeLocation().getDependencyGraph().getRootDependencies().size());
    DependencyGraph actualDependencyGraph = result.getCodeLocation().getDependencyGraph();
    GraphCompare.assertEqualsResource("/conan/cli/noProjectRef_graph.json", actualDependencyGraph);
}
Also used : ConanInfoParser(com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoParser) ConanCodeLocationGenerator(com.synopsys.integration.detectable.detectables.conan.ConanCodeLocationGenerator) NodeElementParser(com.synopsys.integration.detectable.detectables.conan.cli.parser.element.NodeElementParser) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) ConanInfoLineAnalyzer(com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoLineAnalyzer) ConanInfoNodeParser(com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoNodeParser) ConanDetectableResult(com.synopsys.integration.detectable.detectables.conan.ConanDetectableResult) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ConanDependencyType(com.synopsys.integration.detectable.detectables.conan.cli.config.ConanDependencyType) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

ConanCodeLocationGenerator (com.synopsys.integration.detectable.detectables.conan.ConanCodeLocationGenerator)2 ConanInfoLineAnalyzer (com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoLineAnalyzer)2 ConanInfoNodeParser (com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoNodeParser)2 ConanInfoParser (com.synopsys.integration.detectable.detectables.conan.cli.parser.ConanInfoParser)2 NodeElementParser (com.synopsys.integration.detectable.detectables.conan.cli.parser.element.NodeElementParser)2 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 ExternalIdFactory (com.synopsys.integration.bdio.model.externalid.ExternalIdFactory)1 ConanDetectableResult (com.synopsys.integration.detectable.detectables.conan.ConanDetectableResult)1 ConanCliExtractor (com.synopsys.integration.detectable.detectables.conan.cli.ConanCliExtractor)1 ConanDependencyType (com.synopsys.integration.detectable.detectables.conan.cli.config.ConanDependencyType)1 ConanCommandRunner (com.synopsys.integration.detectable.detectables.conan.cli.process.ConanCommandRunner)1 File (java.io.File)1 Test (org.junit.jupiter.api.Test)1