From b764a6e8e3f51a692a18488ad9ef4dff13ea90d6 Mon Sep 17 00:00:00 2001 From: klw1imb Date: Mon, 3 Nov 2025 23:00:12 +0100 Subject: [PATCH] fix(model): Keep the root project under all circumstances If a repository has monorepo-like structures, possibly with sub-projects declaring dependencies to the root-project, it may happen that the root-project is removed when generating the SPDX report, as it is a dependency of a sub-project and one does not want to include it. Signed-off-by: klw1imb --- model/src/main/kotlin/OrtResult.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/model/src/main/kotlin/OrtResult.kt b/model/src/main/kotlin/OrtResult.kt index 208c5cd141d5e..ec3734ecc5683 100644 --- a/model/src/main/kotlin/OrtResult.kt +++ b/model/src/main/kotlin/OrtResult.kt @@ -461,7 +461,12 @@ data class OrtResult( dependencyNavigator.projectDependencies(it, matcher = MATCH_SUB_PROJECTS) } + subProjectIds.forEach { logger.info { "wklenk --- sub-project it=$it" } } + projects.removeAll { it.id in subProjectIds } + + // This line would do the thing + // projects.removeAll { it.id in subProjectIds && it.id.namespace.isNotEmpty() } } return projects