11// Usage
2- // > scala-cli project/scripts/dottyCompileBisect.scala -- File .scala
2+ // > scala-cli project/scripts/dottyCompileBisect.scala -- File1.scala File2 .scala
33//
44// This script will bisect the compilation failure starting with a fast bisection on released nightly builds.
55// Then it will bisect the commits between the last nightly that worked and the first nightly that failed.
@@ -9,19 +9,19 @@ import sys.process._
99import scala .io .Source
1010import Releases .Release
1111
12- @ main def dottyCompileBisect (file : String ): Unit =
13- val releaseBisect = ReleaseBisect (file )
12+ @ main def dottyCompileBisect (files : String * ): Unit =
13+ val releaseBisect = ReleaseBisect (files.toList )
1414 val fistBadRelease = releaseBisect.bisect(Releases .allReleases)
1515 println(" \n Finished bisecting releases\n " )
1616 fistBadRelease.previous match
1717 case Some (lastGoodRelease) =>
1818 println(s " Last good release: $lastGoodRelease\n First bad release: $fistBadRelease\n " )
19- val commitBisect = CommitBisect (file )
19+ val commitBisect = CommitBisect (files.toList )
2020 commitBisect.bisect(lastGoodRelease.hash, fistBadRelease.hash)
2121 case None =>
2222 println(s " No good release found " )
2323
24- class ReleaseBisect (file : String ):
24+ class ReleaseBisect (files : List [ String ] ):
2525
2626 def bisect (releases : Vector [Release ]): Release =
2727 assert(releases.length > 1 , " Need at least 2 releases to bisect" )
@@ -35,7 +35,7 @@ class ReleaseBisect(file: String):
3535
3636 private def isGoodRelease (release : Release ): Boolean =
3737 println(s " Testing ${release.version}" )
38- val res = s """ scala-cli compile $file -S " ${release.version}" """ .!
38+ val res = s """ scala-cli compile ${files.mkString( " " )} -S " ${release.version}" """ .!
3939 val isGood = res == 0
4040 println(s " Test result: ${release.version} is a ${if isGood then " good" else " bad" } release \n " )
4141 isGood
@@ -64,10 +64,10 @@ object Releases:
6464
6565 override def toString : String = version
6666
67- class CommitBisect (file : String ):
67+ class CommitBisect (files : List [ String ] ):
6868 def bisect (lastGoodHash : String , fistBadHash : String ): Unit =
6969 println(s " Starting bisecting commits $lastGoodHash.. $fistBadHash\n " )
7070 " git bisect start" .!
7171 s " git bisect bad $fistBadHash" .!
7272 s " git bisect good $lastGoodHash" .!
73- s " git bisect run sh project/scripts/dottyCompileBisect.sh $file " .!
73+ s " git bisect run sh project/scripts/dottyCompileBisect.sh ${files.mkString( " " )} " .!
0 commit comments