Skip to content

Commit 2a142cd

Browse files
committed
Phiscally remove the ignored Scala 2 library-aux files instead of filtering them out in Compile / sources (not reliable, for some reasone the AnyRef.scala was still compiled)
1 parent e81b4a3 commit 2a142cd

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

project/Build.scala

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,19 +1126,23 @@ object Build {
11261126
IO.createDirectory(trgDir)
11271127
IO.unzip(scalaLibrarySourcesJar, trgDir)
11281128

1129-
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
1129+
val (ignoredSources, sources) =
1130+
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
1131+
.partition{file =>
1132+
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
1133+
val path = file.getPath.replace('\\', '/')
1134+
path.endsWith("scala-library-src/scala/Any.scala") ||
1135+
path.endsWith("scala-library-src/scala/AnyVal.scala") ||
1136+
path.endsWith("scala-library-src/scala/AnyRef.scala") ||
1137+
path.endsWith("scala-library-src/scala/Nothing.scala") ||
1138+
path.endsWith("scala-library-src/scala/Null.scala") ||
1139+
path.endsWith("scala-library-src/scala/Singleton.scala")
1140+
}
1141+
// These sources should be never compiled, filtering them out was not working correctly sometimes
1142+
ignoredSources.foreach(_.delete())
1143+
sources
11301144
} (Set(scalaLibrarySourcesJar)).toSeq
11311145
}.taskValue,
1132-
(Compile / sources) ~= (_.filterNot { file =>
1133-
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
1134-
val path = file.getPath.replace('\\', '/')
1135-
path.endsWith("scala-library-src/scala/Any.scala") ||
1136-
path.endsWith("scala-library-src/scala/AnyVal.scala") ||
1137-
path.endsWith("scala-library-src/scala/AnyRef.scala") ||
1138-
path.endsWith("scala-library-src/scala/Nothing.scala") ||
1139-
path.endsWith("scala-library-src/scala/Null.scala") ||
1140-
path.endsWith("scala-library-src/scala/Singleton.scala")
1141-
}),
11421146
(Compile / sources) := {
11431147
val files = (Compile / sources).value
11441148
val overwrittenSourcesDir = (Compile / scalaSource).value

0 commit comments

Comments
 (0)