Skip to content

Commit 8c4ee28

Browse files
Don't leave .scala / .scala-build directories in source JARs
These are left behind since our use of scala-cli in the build here, and were ending up in the source JARs, confusing some tools (like metabrowse).
1 parent 75c0256 commit 8c4ee28

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

project/publish.sc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.1.4`
2-
import $file.settings, settings.PublishLocalNoFluff
2+
import $file.settings, settings.{PublishLocalNoFluff, workspaceDirName}
33

44
import de.tobiasroeser.mill.vcs.version._
55
import mill._, scalalib._
@@ -80,6 +80,17 @@ trait ScalaCliPublishModule extends PublishModule with PublishLocalNoFluff {
8080
)
8181
def publishVersion =
8282
finalPublishVersion()
83+
override def sourceJar = T {
84+
import mill.modules.Jvm.createJar
85+
val allSources0 = allSources().map(_.path).filter(os.exists).toSet
86+
createJar(
87+
allSources0 ++ resources().map(_.path).filter(os.exists),
88+
manifest(),
89+
(input, relPath) =>
90+
!allSources0(input) ||
91+
(!relPath.segments.contains(".scala") && !relPath.segments.contains(workspaceDirName))
92+
)
93+
}
8394
}
8495

8596
def publishSonatype(

0 commit comments

Comments
 (0)