From eac507fa4463e686aa4ceb5238b23b0bd65c3b0c Mon Sep 17 00:00:00 2001 From: Yannick Heiber Date: Tue, 5 Nov 2024 10:23:23 +0100 Subject: [PATCH] Fix filtering of licenseConfigurations With the changes of #86, the filtering of configurations broke and test dependencies got reported even though licenseConfigurations was set to Set("compile"). This is due to the fact that the resolved Ivy deps not properly mirror the configurations the dependency was defined for. By selecting the configurations from the report early on, we restore the filtering. --- .../scala/sbtlicensereport/license/LicenseReport.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/scala/sbtlicensereport/license/LicenseReport.scala b/src/main/scala/sbtlicensereport/license/LicenseReport.scala index 5b63ae7..f588e46 100644 --- a/src/main/scala/sbtlicensereport/license/LicenseReport.scala +++ b/src/main/scala/sbtlicensereport/license/LicenseReport.scala @@ -211,12 +211,13 @@ object LicenseReport { private def getLicenses( report: UpdateReport, - configs: Set[String] = Set.empty, - categories: Seq[LicenseCategory] = LicenseCategory.all, + configs: Set[String], + categories: Seq[LicenseCategory], originatingModule: DepModuleInfo ): Seq[DepLicense] = { + val relevantConfigurations = report.configurations.filter(c => configs.contains(c.configuration.name)) for { - dep <- allModuleReports(report.configurations) + dep <- allModuleReports(relevantConfigurations) report <- pickLicenseForDep(dep, configs, categories, originatingModule) } yield report }