Skip to content

Commit 8b32efb

Browse files
authored
docs(examples): showcase shorthand dependency management (#403)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent cf40048 commit 8b32efb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

examples/build_and_serialize.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from cyclonedx.factory.license import LicenseFactory
2-
from cyclonedx.model import OrganizationalEntity, XsUri
3-
from cyclonedx.model.bom import Bom, LicenseChoice
2+
from cyclonedx.model import LicenseChoice, OrganizationalEntity, XsUri
3+
from cyclonedx.model.bom import Bom
44
from cyclonedx.model.component import Component, ComponentType
5-
from cyclonedx.model.dependency import Dependency
65
from cyclonedx.output.json import JsonV1Dot4
76
from cyclonedx.output.xml import XmlV1Dot4
87
from packageurl import PackageURL
@@ -34,7 +33,7 @@
3433
)
3534

3635
bom.components.add(component)
37-
bom.dependencies.add(Dependency(rootComponent.bom_ref, [Dependency(component.bom_ref)]))
36+
bom.register_dependency(rootComponent, [component])
3837

3938
# endregion build the BOM
4039

0 commit comments

Comments
 (0)