Skip to content

Commit

Permalink
Merge pull request #35 from spdx/fix-formatting
Browse files Browse the repository at this point in the history
fix formatting
  • Loading branch information
loosebazooka authored Aug 28, 2023
2 parents b65d934 + c837374 commit 7d77642
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/main/java/org/spdx/sbom/gradle/utils/SpdxDocumentBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ private Optional<SpdxPackage> createMavenModulePackage(
.setSupplier("NOASSERTION");

String sourceRepo;
if(GradleVersion.current().compareTo(GradleVersion.version("8.2")) < 0) {
sourceRepo = ((ResolvedComponentResultInternal) resolvedComponentResult).getRepositoryName();
}
else {
if (GradleVersion.current().compareTo(GradleVersion.version("8.2")) < 0) {
sourceRepo =
((ResolvedComponentResultInternal) resolvedComponentResult).getRepositoryName();
} else {
sourceRepo = ((DefaultResolvedComponentResult) resolvedComponentResult).getRepositoryId();
}
if (sourceRepo == null) {
Expand All @@ -331,21 +331,20 @@ private Optional<SpdxPackage> createMavenModulePackage(
if (taskExtension != null && repoUri != null) {
repoUri = taskExtension.mapRepoUri(repoUri, moduleId);
}
if(repoUri == null) {
if (repoUri == null) {
spdxPkgBuilder.setDownloadLocation("NOASSERTION");
}
else {
} else {
spdxPkgBuilder.setDownloadLocation(
URIs.toDownloadLocation(repoUri, moduleId, dependencyFile.getName()).toString());
URIs.toDownloadLocation(repoUri, moduleId, dependencyFile.getName()).toString());
}

if(repoUri != null) {
if (repoUri != null) {
var externalRef =
doc.createExternalRef(
ReferenceCategory.PACKAGE_MANAGER,
new ReferenceType(SpdxConstants.SPDX_LISTED_REFERENCE_TYPES_PREFIX + "purl"),
URIs.toPurl(repoUri, moduleId),
null);
doc.createExternalRef(
ReferenceCategory.PACKAGE_MANAGER,
new ReferenceType(SpdxConstants.SPDX_LISTED_REFERENCE_TYPES_PREFIX + "purl"),
URIs.toPurl(repoUri, moduleId),
null);
spdxPkgBuilder.setExternalRefs(Collections.singletonList(externalRef));
}

Expand Down

0 comments on commit 7d77642

Please sign in to comment.