Search in sources :

Example 1 with ScanBatchBuilder

use of com.synopsys.integration.blackduck.codelocation.signaturescanner.ScanBatchBuilder in project hub-detect by blackducksoftware.

the class OnlineBlackDuckSignatureScanner method createScanBatch.

@Override
protected ScanBatch createScanBatch(NameVersion projectNameVersion, File installDirectory, List<SignatureScanPath> signatureScanPaths, File dockerTarFile) {
    final ScanBatchBuilder scanJobBuilder = createDefaultScanBatchBuilder(projectNameVersion, installDirectory, signatureScanPaths, dockerTarFile);
    scanJobBuilder.fromBlackDuckServerConfig(hubServerConfig);
    return scanJobBuilder.build();
}
Also used : ScanBatchBuilder(com.synopsys.integration.blackduck.codelocation.signaturescanner.ScanBatchBuilder)

Example 2 with ScanBatchBuilder

use of com.synopsys.integration.blackduck.codelocation.signaturescanner.ScanBatchBuilder in project hub-detect by blackducksoftware.

the class BlackDuckSignatureScanner method createDefaultScanBatchBuilder.

protected ScanBatchBuilder createDefaultScanBatchBuilder(final NameVersion projectNameVersion, File installDirectory, final List<SignatureScanPath> signatureScanPaths, File dockerTarFile) {
    final ScanBatchBuilder scanJobBuilder = new ScanBatchBuilder();
    scanJobBuilder.scanMemoryInMegabytes(signatureScannerOptions.getScanMemory());
    scanJobBuilder.installDirectory(installDirectory);
    scanJobBuilder.outputDirectory(directoryManager.getScanOutputDirectory());
    scanJobBuilder.dryRun(signatureScannerOptions.getDryRun());
    scanJobBuilder.cleanupOutput(signatureScannerOptions.getCleanupOutput());
    if (signatureScannerOptions.getSnippetMatching()) {
        scanJobBuilder.snippetMatching(SnippetMatching.SNIPPET_MATCHING);
    }
    scanJobBuilder.additionalScanArguments(signatureScannerOptions.getAdditionalArguments());
    final String projectName = projectNameVersion.getName();
    final String projectVersionName = projectNameVersion.getVersion();
    scanJobBuilder.projectAndVersionNames(projectName, projectVersionName);
    final String sourcePath = directoryManager.getSourceDirectory().getAbsolutePath();
    final String prefix = signatureScannerOptions.getCodeLocationPrefix();
    final String suffix = signatureScannerOptions.getCodeLocationSuffix();
    String dockerTarFilename = null;
    if (dockerTarFile != null) {
        dockerTarFilename = dockerTarFile.getName();
    }
    for (final SignatureScanPath scanPath : signatureScanPaths) {
        final String codeLocationName = codeLocationNameManager.createScanCodeLocationName(sourcePath, scanPath.targetPath, dockerTarFilename, projectName, projectVersionName, prefix, suffix);
        scanJobBuilder.addTarget(ScanTarget.createBasicTarget(scanPath.targetPath, scanPath.exclusions, codeLocationName));
    }
    return scanJobBuilder;
}
Also used : ScanBatchBuilder(com.synopsys.integration.blackduck.codelocation.signaturescanner.ScanBatchBuilder)

Example 3 with ScanBatchBuilder

use of com.synopsys.integration.blackduck.codelocation.signaturescanner.ScanBatchBuilder in project hub-detect by blackducksoftware.

the class OfflineBlackDuckSignatureScanner method createScanBatch.

@Override
protected ScanBatch createScanBatch(final NameVersion projectNameVersion, File installDirectory, final List<SignatureScanPath> signatureScanPaths, final File dockerTarFile) {
    final ScanBatchBuilder scanJobBuilder = createDefaultScanBatchBuilder(projectNameVersion, installDirectory, signatureScanPaths, dockerTarFile);
    // temporarily need to do this. fix when hub common updates;
    scanJobBuilder.fromBlackDuckServerConfig(null);
    return scanJobBuilder.build();
}
Also used : ScanBatchBuilder(com.synopsys.integration.blackduck.codelocation.signaturescanner.ScanBatchBuilder)

Aggregations

ScanBatchBuilder (com.synopsys.integration.blackduck.codelocation.signaturescanner.ScanBatchBuilder)3