Skip to content

Commit c8ff05b

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 d677243 commit c8ff05b

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

Diff for: project/Build.scala

+15-11
Original file line numberDiff line numberDiff line change
@@ -1124,19 +1124,23 @@ object Build {
11241124
IO.createDirectory(trgDir)
11251125
IO.unzip(scalaLibrarySourcesJar, trgDir)
11261126

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

0 commit comments

Comments
 (0)