@@ -939,6 +939,46 @@ object Build {
939
939
},
940
940
mimaCheckDirection := " both" ,
941
941
mimaBinaryIssueFilters ++= MiMaFilters .LibraryBootstrappedForward ,
942
+ libraryDependencies += // For jar packaging
943
+ (" org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped )),
944
+ exportJars := true ,
945
+ Compile / packageBin / artifactName := { (sv : ScalaVersion , module : ModuleID , artifact : Artifact ) =>
946
+ artifact.name + " -" + stdlibVersion(Bootstrapped ) + " -" + module.revision + " ." + artifact.extension
947
+ },
948
+ Compile / packageBin / mappings := {
949
+ val s = streams.value
950
+ val report = updateClassifiers.value
951
+ val scalaLibraryJar =
952
+ // FIXME
953
+ report.select(
954
+ configuration = configurationFilter(" sourcedeps" ),
955
+ module = (_ : ModuleID ).name == " scala-library" ,
956
+ artifact = artifactFilter(`type` = " src" )).headOption.getOrElse {
957
+ sys.error(s " Could not fetch scala-library sources " )
958
+ }.getParentFile / " scala-library-2.13.10.jar"
959
+ val cacheDir = s.cacheDirectory
960
+ val trgDir = (Compile / sourceManaged).value / " scala-library-bin"
961
+ FileFunction .cached(cacheDir / " fetchScalaLibraryBin" ,
962
+ FilesInfo .lastModified, FilesInfo .exists) { dependencies =>
963
+ s.log.info(s " Unpacking scala-library classfiles to $trgDir... " )
964
+ if (trgDir.exists)
965
+ IO .delete(trgDir)
966
+ IO .createDirectory(trgDir)
967
+ IO .unzip(scalaLibraryJar, trgDir)
968
+
969
+ (trgDir ** " *.class" ).get.toSet
970
+ } (Set (scalaLibraryJar)).toSeq
971
+ val allScalaLibraryJarFiles =
972
+ trgDir.allPaths.get().filterNot(_.getName.endsWith(" .MF" )) // TODO use parts of the old manifest?
973
+ val allScalaLibraryJarMappings : Seq [(java.io.File , String )] =
974
+ allScalaLibraryJarFiles.zip(allScalaLibraryJarFiles.map(_.relativeTo(trgDir).get.getPath))
975
+
976
+ val tastyFileMappings : Seq [(java.io.File , String )] =
977
+ (Compile / packageBin / mappings).value.filter(_._1.getName.endsWith(" .tasty" ))
978
+
979
+ allScalaLibraryJarMappings ++ tastyFileMappings
980
+ }
981
+
942
982
)
943
983
944
984
/** Scala library compiled by dotty using the latest published sources of the library
0 commit comments