@@ -114,6 +114,7 @@ class Scanner(
114114 ortResult.labels + labels,
115115 PackageType .PROJECT ,
116116 ortResult.repository.config.excludes,
117+ ortResult.repository.config.includes,
117118 scannerConfig.detectedLicenseMapping,
118119 snippetChoices = ortResult.repository.config.snippetChoices
119120 )
@@ -127,6 +128,7 @@ class Scanner(
127128 ortResult.labels,
128129 PackageType .PACKAGE ,
129130 ortResult.repository.config.excludes,
131+ ortResult.repository.config.includes,
130132 scannerConfig.detectedLicenseMapping,
131133 snippetChoices = ortResult.repository.config.snippetChoices
132134 )
@@ -332,8 +334,9 @@ class Scanner(
332334 val nestedProvenance = controller.getNestedProvenance(referencePackage.id) ? : return @scanner
333335
334336 val adjustedContext = context.copy(
335- // Hide excludes from scanners with a scanner matcher.
337+ // Hide includes and excludes from scanners with a scanner matcher.
336338 excludes = context.excludes.takeUnless { scanner.matcher != null },
339+ includes = context.includes.takeUnless { scanner.matcher != null },
337340 // Tell scanners also about the non-reference packages.
338341 coveredPackages = packagesWithIncompleteScanResult
339342 )
@@ -399,8 +402,13 @@ class Scanner(
399402 " '${scanner.descriptor.displayName} '."
400403 }
401404
402- // Filter the scan context to hide the excludes from scanner with scan matcher.
403- val filteredContext = if (scanner.matcher == null ) context else context.copy(excludes = null )
405+ // Filter the scan context to hide the includes and excludes from scanner with scan matcher.
406+ val filteredContext = if (scanner.matcher == null ) {
407+ context
408+ } else {
409+ context.copy(excludes = null , includes = null )
410+ }
411+
404412 val scanResult = scanner.scanProvenance(provenance, filteredContext)
405413
406414 val completedPackages = controller.getPackagesCompletedByProvenance(scanner, provenance)
@@ -581,8 +589,12 @@ class Scanner(
581589 val results = scanners.mapNotNull { scanner ->
582590 logger.info { " Scan of $provenance with path scanner '${scanner.descriptor.displayName} ' started." }
583591
584- // Filter the scan context to hide the excludes from scanner with scan matcher.
585- val filteredContext = if (scanner.matcher == null ) context else context.copy(excludes = null )
592+ // Filter the scan context to hide the includes and excludes from scanner with scan matcher.
593+ val filteredContext = if (scanner.matcher == null ) {
594+ context
595+ } else {
596+ context.copy(excludes = null , includes = null )
597+ }
586598
587599 val summary = runCatching {
588600 scanner.scanPath(downloadDir, filteredContext)
0 commit comments