Skip to content

Commit 5f9126f

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)
[Cherry-picked 2a142cd][modified]
1 parent 5ffd8de commit 5f9126f

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

project/Build.scala

+15-1
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,21 @@ object Build {
10021002
IO.createDirectory(trgDir)
10031003
IO.unzip(scalaLibrarySourcesJar, trgDir)
10041004

1005-
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
1005+
val (ignoredSources, sources) =
1006+
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
1007+
.partition{file =>
1008+
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
1009+
val path = file.getPath.replace('\\', '/')
1010+
path.endsWith("scala-library-src/scala/Any.scala") ||
1011+
path.endsWith("scala-library-src/scala/AnyVal.scala") ||
1012+
path.endsWith("scala-library-src/scala/AnyRef.scala") ||
1013+
path.endsWith("scala-library-src/scala/Nothing.scala") ||
1014+
path.endsWith("scala-library-src/scala/Null.scala") ||
1015+
path.endsWith("scala-library-src/scala/Singleton.scala")
1016+
}
1017+
// These sources should be never compiled, filtering them out was not working correctly sometimes
1018+
ignoredSources.foreach(_.delete())
1019+
sources
10061020
} (Set(scalaLibrarySourcesJar)).toSeq
10071021
}.taskValue,
10081022
(Compile / sourceGenerators) += Def.task {

project/MiMaFilters.scala

+6-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ object MiMaFilters {
1414
ProblemFilters.exclude[MissingFieldProblem]("scala.runtime.stdLibPatches.language#experimental.relaxedExtensionImports"),
1515
ProblemFilters.exclude[MissingClassProblem]("scala.runtime.stdLibPatches.language$experimental$relaxedExtensionImports$"),
1616
// end of New experimental features in 3.3.X
17-
18-
// New in 2.13.13
19-
"scala.collection.mutable.ArrayBuffer.resizeUp", // private[mutable] def
20-
// New in 2.13.14
21-
"scala.util.Properties.consoleIsTerminal", // private[scala] lazy val
22-
// end of new in Scala 2
23-
)
17+
) ++ Seq(
18+
// New in 2.13.13
19+
"scala.collection.mutable.ArrayBuffer.resizeUp", // private[mutable] def
20+
// New in 2.13.14
21+
"scala.util.Properties.consoleIsTerminal", // private[scala] lazy val
22+
).map(ProblemFilters.exclude[DirectMissingMethodProblem])
2423
val TastyCore: Seq[ProblemFilter] = Seq(
2524
)
2625
val Interfaces: Seq[ProblemFilter] = Seq(

0 commit comments

Comments
 (0)