mirror of https://github.com/sbt/sbt.git
[2.x] ci: Filter NOTICE file (#9155)
This commit is contained in:
parent
01fbc474f1
commit
2893bff7ca
|
|
@ -183,7 +183,7 @@ object Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
object Licensed {
|
object Licensed {
|
||||||
lazy val notice = SettingKey[File]("notice")
|
lazy val notice = SettingKey[Option[File]]("notice")
|
||||||
lazy val extractLicenses = TaskKey[Seq[File]]("extract-licenses")
|
lazy val extractLicenses = TaskKey[Seq[File]]("extract-licenses")
|
||||||
|
|
||||||
lazy val seeRegex = """\(see (.*?)\)""".r
|
lazy val seeRegex = """\(see (.*?)\)""".r
|
||||||
|
|
@ -195,13 +195,17 @@ object Licensed {
|
||||||
seeRegex.findAllIn(noticeString).matchData.map(d => licensePath(base, d.group(1))).toList
|
seeRegex.findAllIn(noticeString).matchData.map(d => licensePath(base, d.group(1))).toList
|
||||||
|
|
||||||
def settings: Seq[Setting[?]] = Seq(
|
def settings: Seq[Setting[?]] = Seq(
|
||||||
notice := (baseDirectory.value / "NOTICE"),
|
notice := Option(baseDirectory.value / "NOTICE").filter(_.isFile),
|
||||||
Compile / unmanagedResources ++= notice.value +: extractLicenses.value,
|
Compile / unmanagedResources ++= notice.value.toSeq ++ extractLicenses.value,
|
||||||
extractLicenses := extractLicenses0(
|
extractLicenses := notice.value
|
||||||
(ThisBuild / baseDirectory).value,
|
.map { n =>
|
||||||
notice.value,
|
extractLicenses0(
|
||||||
streams.value
|
(ThisBuild / baseDirectory).value,
|
||||||
)
|
n,
|
||||||
|
streams.value
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.getOrElse(Nil)
|
||||||
)
|
)
|
||||||
def extractLicenses0(base: File, note: File, s: TaskStreams): Seq[File] =
|
def extractLicenses0(base: File, note: File, s: TaskStreams): Seq[File] =
|
||||||
if (!note.exists) Nil
|
if (!note.exists) Nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue