Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove subdirectories from mappings for sbt 2 #262

Closed
BillyAutrey opened this issue Oct 23, 2024 · 2 comments · Fixed by #264
Closed

Remove subdirectories from mappings for sbt 2 #262

BillyAutrey opened this issue Oct 23, 2024 · 2 comments · Fixed by #264

Comments

@BillyAutrey
Copy link
Collaborator

In sbt 2.0, mappings has changed type to a Seq[HashedVirtualFileRef]. If any directories are in mappings, calls to package will fail with an error like this:

[info] [error] (e / Compile / packageBin) java.io.IOException: Is a directory

sbt 2 will either have to accomodate subdirectories in mappings, or else this library will have to filter them out of mappings.

@BillyAutrey
Copy link
Collaborator Author

This is blocking #255.

@BillyAutrey
Copy link
Collaborator Author

This is a naive approach, but it experimentally got package to succeed.

===================================================================
diff --git a/src/main/scala/com/typesafe/sbt/web/SbtWeb.scala b/src/main/scala/com/typesafe/sbt/web/SbtWeb.scala
--- a/src/main/scala/com/typesafe/sbt/web/SbtWeb.scala	(revision 99b81eb4d07635e68fb41c04237a712603004faa)
+++ b/src/main/scala/com/typesafe/sbt/web/SbtWeb.scala	(date 1729716374650)
@@ -549,7 +560,9 @@
   ): Seq[PathMapping] = {
     implicit val fc: FileConverter = conv
     if (deduplicators.isEmpty) {
-      mappings
+      mappings.filter { case (fileRef, string) =>
+        !toFile(fileRef).isDirectory
+      }
     } else {
       mappings.groupBy(_._2 /*path*/ ).toSeq flatMap { grouped =>
         val (path, group) = grouped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant