fix(bdio1): BDIO1 documents are now built "correctly".
@@ -9,10 +9,14 @@ import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.synopsys.integration.bdio.BdioNodeFactory;
+import com.synopsys.integration.bdio.BdioPropertyHelper;
import com.synopsys.integration.bdio.SimpleBdioFactory;
import com.synopsys.integration.bdio.graph.DependencyGraph;
import com.synopsys.integration.bdio.graph.DependencyGraphUtil;
import com.synopsys.integration.bdio.graph.ProjectDependencyGraph;
+import com.synopsys.integration.bdio.model.BdioBillOfMaterials;
+import com.synopsys.integration.bdio.model.BdioProject;
import com.synopsys.integration.bdio.model.SimpleBdioDocument;
import com.synopsys.integration.bdio.model.dependency.ProjectDependency;
import com.synopsys.integration.bdio.model.externalid.ExternalId;
@@ -41,15 +45,32 @@ public class CreateBdio1FilesOperation {
String codeLocationName = bdioCodeLocation.getCodeLocationName();
ExternalId externalId = bdioCodeLocation.getDetectCodeLocation().getExternalId();
DependencyGraph dependencyGraph = bdioCodeLocation.getDetectCodeLocation().getDependencyGraph();
+
+ ProjectDependencyGraph projectDependencyGraph = new ProjectDependencyGraph(new ProjectDependency(externalId));
+ DependencyGraphUtil.copyRootDependencies(projectDependencyGraph, dependencyGraph);
+
+ File bdioOutputFile = new File(outputDirectory, bdioCodeLocation.getBdioName() + ".jsonld");
+
ExternalId projectExternalId = externalId;
if (externalId.getForge().equals(DETECT_FORGE)) {
projectExternalId = ExternalId.FACTORY.createNameVersionExternalId(DETECT_FORGE, projectNameVersion.getName(), projectNameVersion.getVersion());
}
- ProjectDependencyGraph projectDependencyGraph = new ProjectDependencyGraph(new ProjectDependency(projectExternalId));
- DependencyGraphUtil.copyRootDependencies(projectDependencyGraph, dependencyGraph);
+ BdioNodeFactory bdioNodeFactory = new BdioNodeFactory(new BdioPropertyHelper());
+ BdioProject bdioProject = bdioNodeFactory.createProject(
+ projectNameVersion.getName(),
+ projectNameVersion.getVersion(),
+ projectExternalId.createBdioId(),
+ projectExternalId
+ );
- File bdioOutputFile = new File(outputDirectory, bdioCodeLocation.getBdioName() + ".jsonld");
- SimpleBdioDocument simpleBdioDocument = simpleBdioFactory.createPopulatedBdioDocument(codeLocationName, projectDependencyGraph);
+ BdioBillOfMaterials billOfMaterials = bdioNodeFactory.createBillOfMaterials(codeLocationName, bdioProject.name, bdioProject.version);
+ SimpleBdioDocument simpleBdioDocument = new SimpleBdioDocument();
+ simpleBdioDocument.setBillOfMaterials(billOfMaterials);
+ simpleBdioDocument.setProject(bdioProject);
+
+ simpleBdioFactory.populateComponents(simpleBdioDocument, projectDependencyGraph);
+ // TODO: In 8.0.0
+ // SimpleBdioDocument simpleBdioDocument = simpleBdioFactory.createPopulatedBdioDocument(codeLocationName, projectDependencyGraph);
detectBdioWriter.writeBdioFile(bdioOutputFile, simpleBdioDocument);
uploadTargets.add(UploadTarget.createDefault(projectNameVersion, codeLocationName, bdioOutputFile));
