Skip to content

Commit

Permalink
feat: migrate to blackduck-common 48.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Billings committed Jun 2, 2020
1 parent 4e3be2a commit d3a6500
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -13,7 +13,7 @@ import com.synopsys.integration.log.PrintStreamIntLogger
buildscript {
ext {
springBootVersion = '2.2.4.RELEASE'
blackDuckCommonVersion = '47.1.3'
blackDuckCommonVersion = '48.0.0'
polarisCommonVersion = '0.13.2'
junitPlatformDefaultTestTags = 'integration, performance, battery'
}
Expand Down
Expand Up @@ -93,7 +93,7 @@ public Optional<UploadTarget> createAggregateBdio1File(final String aggregateNam

detectBdioWriter.writeBdioFile(aggregateBdioFile, aggregateBdioDocument);

return createUploadTarget(codeLocationName, aggregateBdioFile, aggregateDependencyGraph, uploadEmptyAggregate);
return createUploadTarget(projectNameVersion, codeLocationName, aggregateBdioFile, aggregateDependencyGraph, uploadEmptyAggregate);
}

public Optional<UploadTarget> createAggregateBdio2File(final String aggregateName, final AggregateMode aggregateMode, final boolean uploadEmptyAggregate, final File sourcePath, final File bdioDirectory,
Expand All @@ -120,13 +120,13 @@ public Optional<UploadTarget> createAggregateBdio2File(final String aggregateNam
throw new DetectUserFriendlyException(e.getMessage(), e, ExitCodeType.FAILURE_GENERAL_ERROR);
}

return createUploadTarget(codeLocationName, aggregateBdioFile, aggregateDependencyGraph, uploadEmptyAggregate);
return createUploadTarget(projectNameVersion, codeLocationName, aggregateBdioFile, aggregateDependencyGraph, uploadEmptyAggregate);
}

private Optional<UploadTarget> createUploadTarget(final String codeLocationName, final File aggregateBdioFile, final DependencyGraph dependencyGraph, final boolean uploadEmptyAggregate) {
private Optional<UploadTarget> createUploadTarget(final NameVersion projectNameVersion, final String codeLocationName, final File aggregateBdioFile, final DependencyGraph dependencyGraph, final boolean uploadEmptyAggregate) {
final boolean aggregateHasDependencies = !dependencyGraph.getRootDependencies().isEmpty();
if (aggregateHasDependencies || uploadEmptyAggregate) {
return Optional.of(UploadTarget.createDefault(codeLocationName, aggregateBdioFile));
return Optional.of(UploadTarget.createDefault(projectNameVersion, codeLocationName, aggregateBdioFile));
} else {
logger.warn("The aggregate contained no dependencies, will not upload aggregate at this time.");
return Optional.empty();
Expand Down
Expand Up @@ -78,7 +78,7 @@ public List<UploadTarget> createBdio1Files(final File bdioOutput, final List<Bdi
final SimpleBdioDocument simpleBdioDocument = simpleBdioFactory.createSimpleBdioDocument(codeLocationName, projectNameVersion.getName(), projectNameVersion.getVersion(), externalId, dependencyGraph);

detectBdioWriter.writeBdioFile(bdioOutputFile, simpleBdioDocument);
uploadTargets.add(UploadTarget.createDefault(codeLocationName, bdioOutputFile));
uploadTargets.add(UploadTarget.createDefault(projectNameVersion, codeLocationName, bdioOutputFile));
}

return uploadTargets;
Expand Down Expand Up @@ -110,7 +110,7 @@ public List<UploadTarget> createBdio2Files(final File bdioOutput, final List<Bdi
bdio2Writer.writeBdioDocument(outputStream, bdio2Document);
logger.debug(String.format("BDIO Generated: %s", bdio2OutputFile.getAbsolutePath()));

uploadTargets.add(UploadTarget.createDefault(codeLocationName, bdio2OutputFile));
uploadTargets.add(UploadTarget.createDefault(projectNameVersion, codeLocationName, bdio2OutputFile));
} catch (final IOException e) {
throw new DetectUserFriendlyException(e.getMessage(), e, ExitCodeType.FAILURE_GENERAL_ERROR);
}
Expand Down
Expand Up @@ -43,6 +43,7 @@
import com.synopsys.integration.detect.workflow.event.EventSystem;
import com.synopsys.integration.detect.workflow.result.ReportDetectResult;
import com.synopsys.integration.rest.exception.IntegrationRestException;
import com.synopsys.integration.util.NameVersion;

public class BlackDuckPostActions {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
Expand All @@ -69,9 +70,10 @@ public void perform(final BlackDuckPostOptions blackDuckPostOptions, final CodeL
// In order to wait the full timeout, we have to not use that start time and instead use now().
final NotificationTaskRange notificationTaskRange = new NotificationTaskRange(System.currentTimeMillis(), codeLocationWaitData.getNotificationRange().getStartDate(),
codeLocationWaitData.getNotificationRange().getEndDate());
final NameVersion projectNameVersion = new NameVersion(projectView.getName(), projectVersionView.getVersionName());
final CodeLocationWaitResult result = codeLocationCreationService
.waitForCodeLocations(notificationTaskRange, codeLocationWaitData.getCodeLocationNames(), codeLocationWaitData.getExpectedNotificationCount(),
timeoutInSeconds);
.waitForCodeLocations(notificationTaskRange, projectNameVersion, codeLocationWaitData.getCodeLocationNames(), codeLocationWaitData.getExpectedNotificationCount(),
timeoutInSeconds);
if (result.getStatus() == CodeLocationWaitResult.Status.PARTIAL) {
throw new DetectUserFriendlyException(result.getErrorMessage().orElse("Timed out waiting for code locations to finish on the Black Duck server."), ExitCodeType.FAILURE_TIMEOUT);
}
Expand Down

0 comments on commit d3a6500

Please sign in to comment.