From 2893bff7ca8853015f3bb9ccbb4ac14f4cabb551 Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Wed, 29 Apr 2026 21:45:08 +0900 Subject: [PATCH] [2.x] ci: Filter NOTICE file (#9155) --- project/Utils.scala | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/project/Utils.scala b/project/Utils.scala index 708f84456..2af699b80 100644 --- a/project/Utils.scala +++ b/project/Utils.scala @@ -183,7 +183,7 @@ object Utils { } 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 seeRegex = """\(see (.*?)\)""".r @@ -195,13 +195,17 @@ object Licensed { seeRegex.findAllIn(noticeString).matchData.map(d => licensePath(base, d.group(1))).toList def settings: Seq[Setting[?]] = Seq( - notice := (baseDirectory.value / "NOTICE"), - Compile / unmanagedResources ++= notice.value +: extractLicenses.value, - extractLicenses := extractLicenses0( - (ThisBuild / baseDirectory).value, - notice.value, - streams.value - ) + notice := Option(baseDirectory.value / "NOTICE").filter(_.isFile), + Compile / unmanagedResources ++= notice.value.toSeq ++ extractLicenses.value, + extractLicenses := notice.value + .map { n => + extractLicenses0( + (ThisBuild / baseDirectory).value, + n, + streams.value + ) + } + .getOrElse(Nil) ) def extractLicenses0(base: File, note: File, s: TaskStreams): Seq[File] = if (!note.exists) Nil