Search in sources :

Example 6 with Detector

use of com.blackducksoftware.integration.hub.detect.detector.Detector in project hub-detect by blackducksoftware.

the class DetectorSearchProvider method createBomToolSearchRuleSet.

public DetectorSearchRuleSet createBomToolSearchRuleSet(final DetectorEnvironment environment) {
    final DetectorSearchRuleSetBuilder searchRuleSet = new DetectorSearchRuleSetBuilder(environment);
    searchRuleSet.addBomTool(detectorFactory.createBitbakeBomTool(environment)).defaultNotNested();
    searchRuleSet.addBomTool(detectorFactory.createPodLockBomTool(environment)).defaultNested();
    searchRuleSet.addBomTool(detectorFactory.createCondaBomTool(environment)).defaultNotNested();
    searchRuleSet.addBomTool(detectorFactory.createCpanCliBomTool(environment)).defaultNotNested();
    searchRuleSet.addBomTool(detectorFactory.createPackratLockBomTool(environment)).defaultNotNested();
    Detector goCli = detectorFactory.createGoCliBomTool(environment);
    Detector goLock = detectorFactory.createGoLockBomTool(environment);
    Detector goVnd = detectorFactory.createGoVndrBomTool(environment);
    Detector goVendor = detectorFactory.createGoVendorBomTool(environment);
    searchRuleSet.addBomTool(goLock).defaultNotNested();
    searchRuleSet.addBomTool(goVnd).defaultNotNested();
    searchRuleSet.addBomTool(goVendor).defaultNotNested();
    searchRuleSet.addBomTool(goCli).defaultNotNested();
    searchRuleSet.yield(goCli).to(goLock);
    searchRuleSet.yield(goCli).to(goVnd);
    searchRuleSet.yield(goCli).to(goVendor);
    searchRuleSet.addBomTool(detectorFactory.createGradleInspectorBomTool(environment)).defaultNotNested();
    searchRuleSet.addBomTool(detectorFactory.createRebarBomTool(environment)).defaultNotNested();
    searchRuleSet.addBomTool(detectorFactory.createMavenPomBomTool(environment)).defaultNotNested();
    searchRuleSet.addBomTool(detectorFactory.createMavenPomWrapperBomTool(environment)).defaultNotNested();
    Detector yarnLock = detectorFactory.createYarnLockBomTool(environment);
    searchRuleSet.addBomTool(yarnLock).defaultNested();
    Detector npmPackageLock = detectorFactory.createNpmPackageLockBomTool(environment);
    Detector npmShrinkwrap = detectorFactory.createNpmShrinkwrapBomTool(environment);
    Detector npmCli = detectorFactory.createNpmCliBomTool(environment);
    searchRuleSet.addBomTool(npmPackageLock).defaultNested();
    searchRuleSet.addBomTool(npmShrinkwrap).defaultNested();
    searchRuleSet.addBomTool(npmCli).defaultNested();
    searchRuleSet.yield(npmShrinkwrap).to(npmPackageLock);
    searchRuleSet.yield(npmCli).to(npmPackageLock);
    searchRuleSet.yield(npmCli).to(npmShrinkwrap);
    searchRuleSet.yield(npmCli).to(yarnLock);
    searchRuleSet.yield(npmPackageLock).to(yarnLock);
    searchRuleSet.yield(npmShrinkwrap).to(yarnLock);
    Detector nugetSolution = detectorFactory.createNugetSolutionBomTool(environment);
    Detector nugetProject = detectorFactory.createNugetProjectBomTool(environment);
    searchRuleSet.addBomTool(nugetSolution).defaultNested();
    searchRuleSet.addBomTool(nugetProject).defaultNotNested();
    searchRuleSet.yield(nugetProject).to(nugetSolution);
    searchRuleSet.addBomTool(detectorFactory.createComposerLockBomTool(environment)).defaultNotNested();
    Detector pipEnv = detectorFactory.createPipenvBomTool(environment);
    Detector pipInspector = detectorFactory.createPipInspectorBomTool(environment);
    searchRuleSet.addBomTool(pipEnv).defaultNotNested();
    searchRuleSet.addBomTool(pipInspector).defaultNotNested();
    searchRuleSet.yield(pipInspector).to(pipEnv);
    searchRuleSet.addBomTool(detectorFactory.createGemlockBomTool(environment)).defaultNotNested();
    searchRuleSet.addBomTool(detectorFactory.createSbtResolutionCacheBomTool(environment)).defaultNotNested();
    searchRuleSet.addBomTool(detectorFactory.createPearCliBomTool(environment)).defaultNotNested();
    searchRuleSet.addBomTool(detectorFactory.createClangBomTool(environment)).defaultNested();
    return searchRuleSet.build();
}
Also used : Detector(com.blackducksoftware.integration.hub.detect.detector.Detector)

Example 7 with Detector

use of com.blackducksoftware.integration.hub.detect.detector.Detector in project hub-detect by blackducksoftware.

the class DetectorSearchRuleSetBuilder method build.

public DetectorSearchRuleSet build() {
    final List<DetectorSearchRule> bomToolRules = new ArrayList<>();
    for (final Detector detector : desiredDetectorOrder) {
        final DetectorSearchRuleBuilder builder = builderMap.get(detector);
        for (final DetectorYieldBuilder yieldBuilder : yieldBuilders) {
            if (yieldBuilder.getYieldingDetector() == detector) {
                builder.yield(yieldBuilder.getYieldingToDetector());
            }
        }
        bomToolRules.add(builder.build());
    }
    return new DetectorSearchRuleSet(bomToolRules, environment);
}
Also used : Detector(com.blackducksoftware.integration.hub.detect.detector.Detector) ArrayList(java.util.ArrayList)

Aggregations

Detector (com.blackducksoftware.integration.hub.detect.detector.Detector)7 ArrayList (java.util.ArrayList)5 DetectorEnvironment (com.blackducksoftware.integration.hub.detect.detector.DetectorEnvironment)3 DetectorEvaluation (com.blackducksoftware.integration.hub.detect.workflow.search.result.DetectorEvaluation)3 DetectorType (com.blackducksoftware.integration.hub.detect.detector.DetectorType)2 DetectorSearchRuleSet (com.blackducksoftware.integration.hub.detect.workflow.search.rules.DetectorSearchRuleSet)2 List (java.util.List)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 DetectorException (com.blackducksoftware.integration.hub.detect.detector.DetectorException)1 DetectorFactory (com.blackducksoftware.integration.hub.detect.detector.DetectorFactory)1 DetectUserFriendlyException (com.blackducksoftware.integration.hub.detect.exception.DetectUserFriendlyException)1 ExitCodeType (com.blackducksoftware.integration.hub.detect.exitcode.ExitCodeType)1 Event (com.blackducksoftware.integration.hub.detect.workflow.event.Event)1 EventSystem (com.blackducksoftware.integration.hub.detect.workflow.event.EventSystem)1 DetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.DetectorResult)1 ExcludedDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.ExcludedDetectorResult)1 ForcedNestedPassedDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.ForcedNestedPassedDetectorResult)1 MaxDepthExceededDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.MaxDepthExceededDetectorResult)1 NotNestableDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.NotNestableDetectorResult)1