The following two iterations which are supposed to determine when to add an edge
slightly differ from one another in the following aspects
Determine linkage type of ID pairs which should be connected
This is done here: 1, and calls following iteration APIs:
|
getProjects(omitExcluded = true, includeSubProjects = true).forEach { project -> |
|
dependencyNavigator.directDependencies(project, scopeName).forEach { node -> |
|
val children = parent.visitDependencies { children -> |
Adding the relationships
This is done here: 2, and calls following iteration APIs:
|
val projects = ortResult.getProjects(omitExcluded = true, includeSubProjects = false).sortedBy { it.id } |
|
ortResult.getDependencies( |
|
ortResult.getDependencies( |
Question
- Are the two iterations semantically equivalent?
- If yes, can this be simplified?
- One idea is to refactor
addRelationShip calls to simply be done by an iteration over the map val linkageTypesForDependencyRelationships.
The following two iterations which are supposed to determine when to add an edge
slightly differ from one another in the following aspects
Determine linkage type of ID pairs which should be connected
This is done here: 1, and calls following iteration APIs:
ort/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentModelMapper.kt
Line 223 in fb2abce
ort/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentModelMapper.kt
Line 229 in fb2abce
ort/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentModelMapper.kt
Line 238 in fb2abce
Adding the relationships
This is done here: 2, and calls following iteration APIs:
ort/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentModelMapper.kt
Line 86 in fb2abce
ort/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentModelMapper.kt
Line 100 in fb2abce
ort/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentModelMapper.kt
Line 120 in fb2abce
Question
addRelationShipcalls to simply be done by an iteration over the mapval linkageTypesForDependencyRelationships.Footnotes
https://github.com/oss-review-toolkit/ort/blob/fb2abcedbd0ed43430814876a98d10acc99aa157/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentModelMapper.kt#L218-L254 ↩
https://github.com/oss-review-toolkit/ort/blob/fb2abcedbd0ed43430814876a98d10acc99aa157/plugins/reporters/spdx/src/main/kotlin/SpdxDocumentModelMapper.kt#L86-L126 ↩