Skip to content

Commit 00dac6f

Browse files
committed
feat(model): Handle notice files in PathLicenseMatcher
Relates to #6399. Keep the license, notice, patent, other files order in existing code, while at it. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 4368fb1 commit 00dac6f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

model/src/main/kotlin/utils/PathLicenseMatcher.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import org.ossreviewtoolkit.utils.common.getAllAncestorDirectories
4444
*/
4545
class PathLicenseMatcher(licenseFilePatterns: LicenseFilePatterns = LicenseFilePatterns.DEFAULT) {
4646
private val licenseFileMatcher = createFileMatcher(licenseFilePatterns.licenseFilenames)
47+
private val noticeFileMatcher = createFileMatcher(licenseFilePatterns.noticeFilenames)
4748
private val patentFileMatcher = createFileMatcher(licenseFilePatterns.patentFilenames)
4849
private val otherLicenseFileMatcher = createFileMatcher(licenseFilePatterns.otherLicenseFilenames)
4950

@@ -83,6 +84,7 @@ class PathLicenseMatcher(licenseFilePatterns: LicenseFilePatterns = LicenseFileP
8384
}.mapValues { it.value.toSet() }
8485

8586
val licenseFiles = filePathsByDir(licenseFileMatcher)
87+
val noticeFiles = filePathsByDir(noticeFileMatcher)
8688
val patentFiles = filePathsByDir(patentFileMatcher)
8789
val otherLicenseFiles = filePathsByDir(otherLicenseFileMatcher)
8890

@@ -102,12 +104,12 @@ class PathLicenseMatcher(licenseFilePatterns: LicenseFilePatterns = LicenseFileP
102104
}
103105

104106
addApplicableLicenseFiles(licenseFiles)
107+
addApplicableLicenseFiles(noticeFiles)
108+
addApplicableLicenseFiles(patentFiles)
105109

106110
if (licenseFilesForDirectory.isEmpty()) {
107111
addApplicableLicenseFiles(otherLicenseFiles)
108112
}
109-
110-
addApplicableLicenseFiles(patentFiles)
111113
}
112114

113115
return result.mapKeys { it.key.removePrefix("/") }

0 commit comments

Comments
 (0)