From 3e6f6f4424a68bd5e013ceea5b48360c8b65ac79 Mon Sep 17 00:00:00 2001 From: Wolfgang Klenk Date: Mon, 16 Dec 2024 08:41:44 +0100 Subject: [PATCH] fix(reporter): Add authors to concluded license in disclosure document Include authors for package dependencies when both `concluded_license` and `authors` are curated, and ORT is configured with the `addAuthorsToCopyrights` option enabled. This ensures that package authors appear under the respective concluded license in the Disclosure Document. This behavior applies when the Scanner option `skipConcluded` is enabled, having the effect that the scan stage is skipped for the particular package dependency in this case. Fixes #9599. Signed-off-by: Wolfgang Klenk --- model/src/main/kotlin/licenses/LicenseInfoResolver.kt | 4 ++++ model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/model/src/main/kotlin/licenses/LicenseInfoResolver.kt b/model/src/main/kotlin/licenses/LicenseInfoResolver.kt index 9aa72be3aa225..a7a3d57287895 100644 --- a/model/src/main/kotlin/licenses/LicenseInfoResolver.kt +++ b/model/src/main/kotlin/licenses/LicenseInfoResolver.kt @@ -83,6 +83,10 @@ class LicenseInfoResolver( licenseInfo.concludedLicenseInfo.concludedLicense?.also { originalExpressions += ResolvedOriginalExpression(expression = it, source = LicenseSource.CONCLUDED) } + + licenseInfo.declaredLicenseInfo.authors.takeIf { it.isNotEmpty() && addAuthorsToCopyrights }?.also { + locations += resolveCopyrightFromAuthors(it) + } } } diff --git a/model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt b/model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt index 454dd6681e4eb..482a05d50df98 100644 --- a/model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt +++ b/model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt @@ -575,7 +575,7 @@ class LicenseInfoResolverTest : WordSpec({ ) } - "!resolve copyrights from authors in concluded license" { + "resolve copyrights from authors in concluded license" { // In case of a concluded license (due to a package curation) verify that the authors named // in the package curation are added as copyright statement under the concluded license val licenseInfos = listOf( @@ -611,7 +611,7 @@ class LicenseInfoResolverTest : WordSpec({ result should containCopyrightStatementsForLicenseExactly("LicenseRef-b") } - "!not resolve copyrights from authors in concluded license if disabled" { + "not resolve copyrights from authors in concluded license if disabled" { val licenseInfos = listOf( createLicenseInfo( id = pkgId,