Skip to content

Commit 511a00e

Browse files
committed
Use Configuration type in licenseConfigurations
1 parent 7ec44f0 commit 511a00e

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
@@ -37,7 +37,7 @@ object SbtLicenseReport extends AutoPlugin {
3737
val licenseReportDir = settingKey[File]("The location where we'll write the license reports.")
3838
val licenseReportStyleRules = settingKey[Option[String]]("The style rules for license report styling.")
3939
val licenseReportTitle = settingKey[String]("The name of the license report.")
40-
val licenseConfigurations = settingKey[Set[String]]("The ivy configurations we wish a report of.")
40+
val licenseConfigurations = settingKey[Set[Configuration]]("The ivy configurations we wish a report of.")
4141
val licenseSelection = settingKey[Seq[LicenseCategory]](
4242
"A priority-order list mechanism we can use to select licenses for builds that have more than one."
4343
)
@@ -130,7 +130,7 @@ object SbtLicenseReport extends AutoPlugin {
130130

131131
override lazy val globalSettings = Seq(
132132
licenseSelection := LicenseCategory.all,
133-
licenseConfigurations := Set("compile", "test"),
133+
licenseConfigurations := Set(Compile, Test),
134134
// Here we use an empty partial function
135135
licenseReportNotes := PartialFunction.empty,
136136
licenseOverrides := PartialFunction.empty,

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

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

8181
def makeReport(
8282
module: IvySbt#Module,
83-
configs: Set[String],
83+
configs: Set[Configuration],
8484
licenseSelection: Seq[LicenseCategory],
8585
overrides: DepModuleInfo => Option[LicenseInfo],
8686
exclusions: DepModuleInfo => Option[Boolean],
@@ -117,13 +117,13 @@ object LicenseReport {
117117
/** Picks a single license (or none) for this dependency. */
118118
private def pickLicenseForDep(
119119
dep: IvyNode,
120-
configs: Set[String],
120+
configs: Set[Configuration],
121121
categories: Seq[LicenseCategory]
122122
): Option[DepLicense] =
123123
for {
124124
d <- Option(dep)
125125
cs = dep.getRootModuleConfigurations.toSet
126-
filteredConfigs = if (cs.isEmpty) cs else cs.filter(configs)
126+
filteredConfigs = if (cs.isEmpty) cs else cs.filter(configs.map(_.name))
127127
if !filteredConfigs.isEmpty
128128
if !filteredConfigs.forall(d.isEvicted)
129129
desc <- Option(dep.getDescriptor)
@@ -142,7 +142,7 @@ object LicenseReport {
142142

143143
private def getLicenses(
144144
report: ResolveReport,
145-
configs: Set[String] = Set.empty,
145+
configs: Set[Configuration] = Set.empty,
146146
categories: Seq[LicenseCategory] = LicenseCategory.all
147147
): Seq[DepLicense] = {
148148
import collection.JavaConverters._
@@ -154,7 +154,7 @@ object LicenseReport {
154154

155155
private def makeReportImpl(
156156
report: ResolveReport,
157-
configs: Set[String],
157+
configs: Set[Configuration],
158158
categories: Seq[LicenseCategory],
159159
overrides: DepModuleInfo => Option[LicenseInfo],
160160
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)