Bug 1748762: Update mach.ps1 to always support MozillaBuild 4.0 r=saschanaz

MozillaBuild 4.0 changed its `start-shell.bat` API for consumers that
want to run a command within it, while keeping their current terminal
active.

For a little bit, compatibility with `MACH_PS1_USE_MOZILLABUILD` will be
maintained, though the recent work in bug 1740123 should entirely
obsolete it. It's staying around //for now// so that regressions in
1740123 don't unnecessarily impede workflows.

However, `MACH_PS1_USE_MOZILLABUILD` has some serious drawbacks already
(can't have whitespace in arguments, can't pass braces to Mach, etc).
This patch still has these drawbacks, because they're tricky to solve.

In a couple months, once bug 1740123 has settled nicely, we'll remove
support for `MACH_PS1_USE_MOZILLABUILD`.

Differential Revision: https://phabricator.services.mozilla.com/D136544
This commit is contained in:
Mitchell Hentges 2022-01-21 18:22:59 +00:00
Родитель 0492b82b77
Коммит d484895832
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -38,5 +38,13 @@ Please run MozillaBuild manually for now.
} }
} }
& "$env:MOZILLABUILD/start-shell.bat" $machpath $args $mozillabuild_version = Get-Content "$env:MOZILLABUILD\VERSION"
# Remove "preX" postfix if the current MozillaBuild is a prerelease.
$mozillabuild_version = [decimal]($mozillabuild_version -replace "pre.*")
if ($mozillabuild_version -ge 4.0) {
& "$env:MOZILLABUILD/start-shell.bat" -no-start -defterm -c "$machpath $args"
} else {
& "$env:MOZILLABUILD/start-shell.bat" $machpath $args
}
exit $lastexitcode exit $lastexitcode