[2.x] Add runner support for execution log (#9237)

**Problem/Solution**
This adds runner commandline option experimental_execution_log.
This commit is contained in:
eugene yokota 2026-05-17 03:01:12 -04:00 committed by Eugene Yokota
parent 95702f43cf
commit deb8f6d767
6 changed files with 34 additions and 0 deletions

View File

@ -330,4 +330,8 @@ object RunnerScriptTest extends verify.BasicTestSuite with ShellScriptUtil:
s"Should not have errors from comment character, but found: ${errorMessages.mkString(", ")}"
)
testOutput("sbt --experimental_execution_log=true")("--experimental_execution_log=true", "-v"):
(out: List[String]) =>
assert(out.contains[String]("-Dsbt.experimental_execution_log=true"))
end RunnerScriptTest

View File

@ -54,6 +54,7 @@ set sbt_args_mem=
set sbt_args_client=
set sbt_args_jvm_client=
set sbt_args_no_server=
set sbt_args_experimental_execution_log=
set is_this_dir_sbt=0
rem users can set SBT_OPTS via .sbtopts
@ -419,6 +420,21 @@ if defined _color_arg (
goto args_loop
)
if "%~0" == "--experimental_execution_log" set _experimental_execution_log_arg=true
if defined _experimental_execution_log_arg (
set _experimental_execution_log_arg=
if not "%~1" == "" (
set sbt_args_experimental_execution_log=%~1
shift
goto args_loop
) else (
echo "%~0" is missing a value
goto error
)
goto args_loop
)
if "%~0" == "--no-share" set _no_share_arg=true
if "%~0" == "-no-share" set _no_share_arg=true
@ -724,6 +740,10 @@ if not defined sbt_args_no_hide_jdk_warnings (
)
)
if defined sbt_args_experimental_execution_log (
set _SBT_OPTS=-Dsbt.experimental_execution_log=!sbt_args_experimental_execution_log! !_SBT_OPTS!
)
rem TODO: _SBT_OPTS needs to be processed as args and diffed against SBT_ARGS
if !sbt_args_print_sbt_version! equ 1 (
@ -1137,6 +1157,8 @@ echo --script-version print the version of sbt script
echo -d ^| --debug set sbt log level to debug
echo -debug-inc ^| --debug-inc
echo enable extra debugging for the incremental compiler
echo --experimental_execution_log=true^|^<path^>
echo enable experimental execution log
rem echo -J-X pass option -X directly to the java runtime
rem echo ^(-J is stripped^)
rem echo -S-X add -X to sbt's scalacOptions ^(-S is stripped^)

3
sbt
View File

@ -668,6 +668,8 @@ Usage: `basename "$0"` [options]
-d | --debug set sbt log level to debug
-debug-inc | --debug-inc
enable extra debugging for the incremental compiler
--experimental_execution_log=true|<path>
enable experimental execution log
# sbt version (default: from project/build.properties if present, else latest release)
--sbt-version <version> use the specified version of sbt
@ -725,6 +727,7 @@ map_args () {
-autostart=*) options=( "${options[@]}" "-Dsbt.server.autostart=${1:12}" ) && shift ;;
--color=*) options=( "${options[@]}" "-Dsbt.color=${1:8}" ) && shift ;;
-color=*) options=( "${options[@]}" "-Dsbt.color=${1:7}" ) && shift ;;
--experimental_execution_log=*) options=( "${options[@]}" "-Dsbt.experimental_execution_log=${1:29}" ) && shift ;;
-no-share|--no-share) options=( "${options[@]}" "${noshare_opts[@]}" ) && shift ;;
-no-global|--no-global) options=( "${options[@]}" "-Dsbt.global.base=$(pwd)/project/.sbtboot" ) && shift ;;
-ivy|--ivy) require_arg path "$1" "$2" && options=( "${options[@]}" "-Dsbt.ivy.home=$2" ) && shift 2 ;;

View File

@ -44,6 +44,9 @@ object ArgParser:
opt[String]("autostart").action((x, c) => c.copy(autostart = Some(x))),
opt[Int]("jvm-debug").action((x, c) => c.copy(jvmDebug = Some(x))),
opt[String]("java-home").action((x, c) => c.copy(javaHome = Some(x))),
opt[String]("experimental_execution_log").action((x, c) =>
c.copy(experimentalExecutionLog = Some(x))
),
arg[String]("<arg>")
.unbounded()
.optional()

View File

@ -35,6 +35,7 @@ case class LauncherOptions(
server: Boolean = false,
residual: Seq[String] = Nil,
sbtNew: Boolean = false,
experimentalExecutionLog: Option[String] = None,
)
object LauncherOptions:

View File

@ -63,6 +63,7 @@ object Runner:
opts.ivy.foreach(v => s = s :+ s"-Dsbt.ivy.home=$v")
opts.color.foreach(v => s = s :+ s"-Dsbt.color=$v")
opts.autostart.foreach(v => s = s :+ s"-Dsbt.server.autostart=$v")
opts.experimentalExecutionLog.foreach(v => s = s :+ s"-Dsbt.experimental_execution_log=$v")
if opts.timings then
s = s ++ Seq("-Dsbt.task.timings=true", "-Dsbt.task.timings.on.shutdown=true")
if opts.traces then s = s :+ "-Dsbt.traces=true"