Skip to content

Commit 0be9f86

Browse files
committed
Use Configuration type in licenseConfigurations
1 parent 5adfc8c commit 0be9f86

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/main/scala/sbtlicensereport/SbtLicenseReport.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ object SbtLicenseReport extends AutoPlugin {
4141
val licenseReportDir = settingKey[File]("The location where we'll write the license reports.")
4242
val licenseReportStyleRules = settingKey[Option[String]]("The style rules for license report styling.")
4343
val licenseReportTitle = settingKey[String]("The name of the license report.")
44-
val licenseConfigurations = settingKey[Set[String]]("The ivy configurations we wish a report of.")
44+
val licenseConfigurations = settingKey[Set[Configuration]]("The ivy configurations we wish a report of.")
4545
val licenseSelection = settingKey[Seq[LicenseCategory]](
4646
"A priority-order list mechanism we can use to select licenses for builds that have more than one."
4747
)
@@ -137,7 +137,7 @@ object SbtLicenseReport extends AutoPlugin {
137137

138138
override lazy val globalSettings = Seq(
139139
licenseSelection := LicenseCategory.all,
140-
licenseConfigurations := Set("compile", "test"),
140+
licenseConfigurations := Set(Compile, Test),
141141
// Here we use an empty partial function
142142
licenseReportNotes := PartialFunction.empty,
143143
licenseOverrides := PartialFunction.empty,

src/main/scala/sbtlicensereport/license/LicenseReport.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ object LicenseReport {
8585

8686
def makeReport(
8787
module: IvySbt#Module,
88-
configs: Set[String],
88+
configs: Set[Configuration],
8989
licenseSelection: Seq[LicenseCategory],
9090
overrides: DepModuleInfo => Option[LicenseInfo],
9191
exclusions: DepModuleInfo => Option[Boolean],
@@ -123,14 +123,14 @@ object LicenseReport {
123123
/** Picks a single license (or none) for this dependency. */
124124
private def pickLicenseForDep(
125125
dep: IvyNode,
126-
configs: Set[String],
126+
configs: Set[Configuration],
127127
categories: Seq[LicenseCategory],
128128
originatingModule: DepModuleInfo
129129
): Option[DepLicense] =
130130
for {
131131
d <- Option(dep)
132132
cs = dep.getRootModuleConfigurations.toSet
133-
filteredConfigs = if (cs.isEmpty) cs else cs.filter(configs)
133+
filteredConfigs = if (cs.isEmpty) cs else cs.filter(configs.map(_.name))
134134
if !filteredConfigs.isEmpty
135135
if !filteredConfigs.forall(d.isEvicted)
136136
desc <- Option(dep.getDescriptor)
@@ -155,7 +155,7 @@ object LicenseReport {
155155

156156
private def getLicenses(
157157
report: ResolveReport,
158-
configs: Set[String] = Set.empty,
158+
configs: Set[Configuration] = Set.empty,
159159
categories: Seq[LicenseCategory] = LicenseCategory.all,
160160
originatingModule: DepModuleInfo
161161
): Seq[DepLicense] = {
@@ -168,7 +168,7 @@ object LicenseReport {
168168

169169
private def makeReportImpl(
170170
report: ResolveReport,
171-
configs: Set[String],
171+
configs: Set[Configuration],
172172
categories: Seq[LicenseCategory],
173173
overrides: DepModuleInfo => Option[LicenseInfo],
174174
exclusions: DepModuleInfo => Option[Boolean],

src/sbt-test/dumpLicenseReport/custom-report/example.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name := "example"
22

33
licenseReportTitle := "lreport"
44

5-
licenseConfigurations := Set("compile")
5+
licenseConfigurations := Set(Compile)
66

77
licenseSelection := Seq(LicenseCategory.BSD)
88

0 commit comments

Comments
 (0)