@@ -719,9 +719,31 @@ object Build {
719719 " org.jline"   %  " jline-terminal"   %  " 3.29.0"  ,
720720 " org.jline"   %  " jline-terminal-jni"   %  " 3.29.0"  , //  needed for Windows
721721 (" io.get-coursier"   %%  " coursier"   %  " 2.0.16"   %  Test ).cross(CrossVersion .for3Use2_13),
722-  (" com.lihaoyi"   %%  " pprint"   %  " 0.9.3"  ).exclude(" org.scala-lang"  , " *"  ),
723722 ),
724723
724+  (Compile  /  sourceGenerators) +=  Def .task {
725+  val  downloads  =  Seq (
726+  " https://repo1.maven.org/maven2/com/lihaoyi/pprint_3/0.9.3/pprint_3-0.9.3-sources.jar"  ,
727+  " https://repo1.maven.org/maven2/com/lihaoyi/fansi_3/0.5.1/fansi_3-0.5.1-sources.jar"  ,
728+  " https://repo1.maven.org/maven2/com/lihaoyi/sourcecode_3/0.4.3-M5/sourcecode_3-0.4.3-M5-sources.jar"  ,
729+  )
730+  val  sourceManagedPath  =  os.Path ((Compile  /  sourceManaged).value)
731+  for (download <-  downloads) os.unzip.stream(requests.get.stream(download), dest =  sourceManagedPath)
732+  for (file <-  os.walk(sourceManagedPath) if  file.ext ==  " scala"  ) yield {
733+  val  text  =  os.read(file)
734+  if  (! text.contains(" package scala"  )){
735+  os.write.over(
736+  file,
737+  " package dotty.shaded\n "   + 
738+  text
739+  .replace(" _root_.pprint"  , " _root_.dotty.shaded.pprint"  )
740+  .replace(" _root_.fansi"  , " _root_.dotty.shaded.fansi"  )
741+  )
742+  }
743+  file.toIO
744+  }
745+  }.taskValue,
746+ 
725747 //  For convenience, change the baseDirectory when running the compiler
726748 Compile  /  forkOptions :=  (Compile  /  forkOptions).value.withWorkingDirectory((ThisBuild  /  baseDirectory).value),
727749 Compile  /  run /  forkOptions :=  (Compile  /  run /  forkOptions).value.withWorkingDirectory((ThisBuild  /  baseDirectory).value),
0 commit comments