Skip to content

Commit

Permalink
Phiscally remove the ignored Scala 2 library-aux files instead of fil…
Browse files Browse the repository at this point in the history
…tering them out in `Compile / sources` (not reliable, for some reasone the AnyRef.scala was still compiled)
  • Loading branch information
WojciechMazur committed Jul 1, 2024
1 parent e81b4a3 commit 2a142cd
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1126,19 +1126,23 @@ object Build {
IO.createDirectory(trgDir)
IO.unzip(scalaLibrarySourcesJar, trgDir)

((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
val (ignoredSources, sources) =
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
.partition{file =>
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
val path = file.getPath.replace('\\', '/')
path.endsWith("scala-library-src/scala/Any.scala") ||
path.endsWith("scala-library-src/scala/AnyVal.scala") ||
path.endsWith("scala-library-src/scala/AnyRef.scala") ||
path.endsWith("scala-library-src/scala/Nothing.scala") ||
path.endsWith("scala-library-src/scala/Null.scala") ||
path.endsWith("scala-library-src/scala/Singleton.scala")
}
// These sources should be never compiled, filtering them out was not working correctly sometimes
ignoredSources.foreach(_.delete())
sources
} (Set(scalaLibrarySourcesJar)).toSeq
}.taskValue,
(Compile / sources) ~= (_.filterNot { file =>
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
val path = file.getPath.replace('\\', '/')
path.endsWith("scala-library-src/scala/Any.scala") ||
path.endsWith("scala-library-src/scala/AnyVal.scala") ||
path.endsWith("scala-library-src/scala/AnyRef.scala") ||
path.endsWith("scala-library-src/scala/Nothing.scala") ||
path.endsWith("scala-library-src/scala/Null.scala") ||
path.endsWith("scala-library-src/scala/Singleton.scala")
}),
(Compile / sources) := {
val files = (Compile / sources).value
val overwrittenSourcesDir = (Compile / scalaSource).value
Expand Down

0 comments on commit 2a142cd

Please sign in to comment.