Skip to content

Commit a583f34

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 bd8552c commit a583f34

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
@@ -1093,19 +1093,23 @@ object Build {
10931093
IO.createDirectory(trgDir)
10941094
IO.unzip(scalaLibrarySourcesJar, trgDir)
10951095

1096-
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
1096+
val (ignoredSources, sources) =
1097+
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
1098+
.partition{file =>
1099+
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
1100+
val path = file.getPath.replace('\\', '/')
1101+
path.endsWith("scala-library-src/scala/Any.scala") ||
1102+
path.endsWith("scala-library-src/scala/AnyVal.scala") ||
1103+
path.endsWith("scala-library-src/scala/AnyRef.scala") ||
1104+
path.endsWith("scala-library-src/scala/Nothing.scala") ||
1105+
path.endsWith("scala-library-src/scala/Null.scala") ||
1106+
path.endsWith("scala-library-src/scala/Singleton.scala")
1107+
}
1108+
// These sources should be never compiled, filtering them out was not working correctly sometimes
1109+
ignoredSources.foreach(_.delete())
1110+
sources
10971111
} (Set(scalaLibrarySourcesJar)).toSeq
10981112
}.taskValue,
1099-
(Compile / sources) ~= (_.filterNot { file =>
1100-
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
1101-
val path = file.getPath.replace('\\', '/')
1102-
path.endsWith("scala-library-src/scala/Any.scala") ||
1103-
path.endsWith("scala-library-src/scala/AnyVal.scala") ||
1104-
path.endsWith("scala-library-src/scala/AnyRef.scala") ||
1105-
path.endsWith("scala-library-src/scala/Nothing.scala") ||
1106-
path.endsWith("scala-library-src/scala/Null.scala") ||
1107-
path.endsWith("scala-library-src/scala/Singleton.scala")
1108-
}),
11091113
(Compile / sources) := {
11101114
val files = (Compile / sources).value
11111115
val overwrittenSourcesDir = (Compile / scalaSource).value

0 commit comments

Comments
 (0)