Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions model/src/main/kotlin/utils/PathLicenseMatcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import org.ossreviewtoolkit.utils.common.getAllAncestorDirectories
*/
class PathLicenseMatcher(licenseFilePatterns: LicenseFilePatterns = LicenseFilePatterns.DEFAULT) {
private val licenseFileMatcher = createFileMatcher(licenseFilePatterns.licenseFilenames)
private val noticeFileMatcher = createFileMatcher(licenseFilePatterns.noticeFilenames)
private val patentFileMatcher = createFileMatcher(licenseFilePatterns.patentFilenames)
private val otherLicenseFileMatcher = createFileMatcher(licenseFilePatterns.otherLicenseFilenames)

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

val licenseFiles = filePathsByDir(licenseFileMatcher)
val noticeFiles = filePathsByDir(noticeFileMatcher)
val patentFiles = filePathsByDir(patentFileMatcher)
val otherLicenseFiles = filePathsByDir(otherLicenseFileMatcher)

Expand All @@ -107,6 +109,7 @@ class PathLicenseMatcher(licenseFilePatterns: LicenseFilePatterns = LicenseFileP
addApplicableLicenseFiles(otherLicenseFiles)
}

addApplicableLicenseFiles(noticeFiles)
addApplicableLicenseFiles(patentFiles)
}

Expand Down
1 change: 1 addition & 0 deletions model/src/test/kotlin/config/OrtConfigurationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class OrtConfigurationTest : WordSpec({

with(ortConfig.licenseFilePatterns) {
licenseFilenames should containExactly("license*")
noticeFilenames should containExactly("notice*")
patentFilenames should containExactly("patents")
otherLicenseFilenames should containExactly("readme*")
}
Expand Down
Loading