bobbai00 commented on code in PR #4387:
URL: https://github.com/apache/texera/pull/4387#discussion_r3106067157


##########
project/AddMetaInfLicenseFiles.scala:
##########
@@ -120,23 +120,24 @@ object AddMetaInfLicenseFiles {
     }.taskValue
   )
 
-  /** Additional settings for dist-producing modules: places the same files
-   *  at the top level of the sbt-native-packager Universal zip so they
-   *  appear alongside lib/ and bin/ in the distribution. */
-  lazy val distSettings: Seq[Setting[_]] = Seq(
-    Universal / mappings := {
-      val existing = (Universal / mappings).value
-      val root = rootDir.value
-      val licenseFile = root / "LICENSE"
-      val noticeFile = root / "NOTICE"
-      val disclaimerFile = root / "DISCLAIMER-WIP"
-      val reserved = Set("LICENSE", "NOTICE", "DISCLAIMER-WIP")
-      val filtered = existing.filterNot { case (_, path) => 
reserved.contains(path) }
-      val extras = Seq(
-        licenseFile -> "LICENSE",
-        noticeFile -> "NOTICE"
-      ) ++ (if (disclaimerFile.exists()) Seq(disclaimerFile -> 
"DISCLAIMER-WIP") else Seq.empty)
-      filtered ++ extras
+  /** Ships LICENSE-binary, NOTICE-binary, DISCLAIMER-WIP, and licenses/ at 
the Universal zip's top level. */
+  def distMappings(existing: Seq[(File, String)], rootDir: File): Seq[(File, 
String)] = {
+    val licenseBinary = rootDir / "LICENSE-binary"
+    val noticeBinary = rootDir / "NOTICE-binary"
+    val disclaimerFile = rootDir / "DISCLAIMER-WIP"
+    val licensesDir = rootDir / "licenses"
+
+    val reserved = Set("LICENSE", "NOTICE", "DISCLAIMER-WIP")
+    val filtered = existing.filterNot {
+      case (_, path) => reserved.contains(path) || path.startsWith("licenses/")
     }
-  )
+
+    val licenseTexts = (licensesDir ** "*.txt").get.map(f => f -> 
s"licenses/${f.getName}")
+
+    filtered ++ Seq(
+      licenseBinary -> "LICENSE",
+      noticeBinary -> "NOTICE",
+      disclaimerFile -> "DISCLAIMER-WIP"
+    ) ++ licenseTexts

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to