@@ -8,13 +8,19 @@ Look at the `usageMessage` below for more details.
88*/
99
1010
11+
12+
1113import sys .process ._
1214import scala .io .Source
1315import java .io .File
1416import java .nio .file .attribute .PosixFilePermissions
1517import java .nio .charset .StandardCharsets
1618import java .nio .file .Files
1719
20+ // --extra-scalac-options ${{ inputs.extra-scalac-options }} \
21+ // --disabled-scalac-options ${{ inputs.disabled-scalac-options }} \
22+ // --community-build-dir ${{ github.workspace }}/opencb
23+
1824val usageMessage = """
1925 |Usage:
2026 | > scala-cli project/scripts/bisect.scala -- [<bisect-options>] <projectName> <targets>*
@@ -23,17 +29,26 @@ val usageMessage = """
2329 |* --dry-run
2430 | Don't try to bisect - just make sure the validation command works correctly
2531 |
32+ |* --extra-scalac-options <options>
33+ | Comma delimited of additional scalacOptions passed to project build
34+ |
35+ |* --disabled-scalac-options <options>
36+ | Comma delimited of disabled scalacOptions passed to project build
37+ |
38+ |* --community-build-dir <path>
39+ | Directory with community build project from which the project config would be resolved
40+ |
41+ |* --compiler-dir <path>
42+ | Directory containing Scala compiler repository, required for commit-based bissect
43+ |
2644 |* --releases <releases-range>
2745 | Bisect only releases from the given range (defaults to all releases).
28- | The range format is <first>... <last>, where both <first> and <last> are optional, e.g.
46+ | The range format is <first>..<last>, where both <first> and <last> are optional, e.g.
2947 | * 3.1.0-RC1-bin-20210827-427d313-NIGHTLY..3.2.1-RC1-bin-20220716-bb9c8ff-NIGHTLY
3048 | * 3.2.1-RC1-bin-20220620-de3a82c-NIGHTLY..
3149 | * ..3.3.0-RC1-bin-20221124-e25362d-NIGHTLY
3250 | The ranges are treated as inclusive.
3351 |
34- |* --bootstrapped
35- | Publish locally and test a bootstrapped compiler rather than a nonboostrapped one.
36- |
3752 |* --should-fail
3853 | Expect the validation command to fail rather that succeed. This can be used e.g. to find out when some illegal code started to compile.
3954 |
@@ -60,17 +75,16 @@ val usageMessage = """
6075 println(s " First bad release: ${firstBadRelease.version}" )
6176 println(" \n Finished bisecting releases\n " )
6277
63- val commitBisect = CommitBisect (validationScript, shouldFail = scriptOptions.shouldFail, bootstrapped = scriptOptions.bootstrapped, lastGoodRelease.hash, firstBadRelease.hash)
78+ val commitBisect = CommitBisect (validationScript, shouldFail = scriptOptions.shouldFail, lastGoodRelease.hash, firstBadRelease.hash)
6479 commitBisect.bisect()
6580
6681
67- case class ScriptOptions (validationCommand : ValidationCommand , dryRun : Boolean , bootstrapped : Boolean , releasesRange : ReleasesRange , shouldFail : Boolean )
82+ case class ScriptOptions (validationCommand : ValidationCommand , dryRun : Boolean , releasesRange : ReleasesRange , shouldFail : Boolean )
6883object ScriptOptions :
6984 def fromArgs (args : Seq [String ]) =
7085 val defaultOptions = ScriptOptions (
7186 validationCommand = null ,
7287 dryRun = false ,
73- bootstrapped = false ,
7488 ReleasesRange (first = None , last = None ),
7589 shouldFail = false
7690 )
@@ -80,17 +94,15 @@ object ScriptOptions:
8094 println(s " parse: $args" )
8195 args match
8296 case " --dry-run" :: argsRest => parseArgs(argsRest, options.copy(dryRun = true ))
83- case " --bootstrapped" :: argsRest => parseArgs(argsRest, options.copy(bootstrapped = true ))
8497 case " --releases" :: argsRest =>
8598 val range = ReleasesRange .tryParse(argsRest.head).get
8699 parseArgs(argsRest.tail, options.copy(releasesRange = range))
87100 case " --should-fail" :: argsRest => parseArgs(argsRest, options.copy(shouldFail = true ))
88101 case args =>
89- println(s " command: $args" )
90102 val command = ValidationCommand .fromArgs(args)
91103 options.copy(validationCommand = command)
92104
93- case class ValidationCommand (projectName : String , openCommunityBuildDir : File , targets : Seq [String ]):
105+ case class ValidationCommand (projectName : String , openCommunityBuildDir : File , targets : Seq [String ]):
94106 val remoteValidationScript : File = ValidationScript .buildProject(
95107 projectName = projectName,
96108 targets = Option .when(targets.nonEmpty)(targets.mkString(" " )),
@@ -104,7 +116,6 @@ case class ValidationCommand(projectName: String, openCommunityBuildDir: File, t
104116
105117object ValidationCommand :
106118 def fromArgs (args : Seq [String ]) =
107- println(args)
108119 args match
109120 case Seq (projectName, openCBDir, targets* ) => ValidationCommand (projectName, new File (openCBDir), targets)
110121
@@ -119,7 +130,7 @@ object ValidationScript:
119130 |#!/usr/bin/env bash
120131 |set -e
121132 |
122- |scalaVersion=" $$ 1" # e.g. 3.0.0-RC3
133+ |scalaVersion=" $$ 1" # e.g. 3.3.3
123134 |
124135 |DefaultConfig='{"memoryRequestMb":4096}'
125136 |ConfigFile="/opencb/.github/workflows/buildConfig.json"
@@ -217,7 +228,7 @@ case class ReleasesRange(first: Option[String], last: Option[String]):
217228object ReleasesRange :
218229 def all = ReleasesRange (None , None )
219230 def tryParse (range : String ): Option [ReleasesRange ] = range match
220- case s " ${first}... ${last}" => Some (ReleasesRange (
231+ case s " ${first}.. ${last}" => Some (ReleasesRange (
221232 Some (first).filter(_.nonEmpty),
222233 Some (last).filter(_.nonEmpty)
223234 ))
@@ -287,11 +298,12 @@ class ReleaseBisect(validationScript: File, shouldFail: Boolean, allReleases: Ve
287298 isGood
288299 })
289300
290- class CommitBisect (validationScript : File , shouldFail : Boolean , bootstrapped : Boolean , lastGoodHash : String , fistBadHash : String ):
301+ class CommitBisect (validationScript : File , shouldFail : Boolean , lastGoodHash : String , fistBadHash : String ):
291302 def bisect (): Unit =
292303 println(s " Starting bisecting commits $lastGoodHash.. $fistBadHash\n " )
293- val scala3CompilerProject = if bootstrapped then " scala3-compiler-bootstrapped" else " scala3-compiler"
294- val scala3Project = if bootstrapped then " scala3-bootstrapped" else " scala3"
304+ // Always bootstrapped
305+ val scala3CompilerProject = " scala3-compiler-bootstrapped"
306+ val scala3Project = " scala3-bootstrapped"
295307 val mavenRepo = " https://scala3.westeurope.cloudapp.azure.com/maven2/bisect/"
296308 val validationCommandStatusModifier = if shouldFail then " ! " else " " // invert the process status if failure was expected
297309 val bisectRunScript = raw """
0 commit comments