2022-01-06 09:49:47 +03:00
|
|
|
$mypath = $MyInvocation.MyCommand.Path
|
2022-01-21 21:22:58 +03:00
|
|
|
$machpath = $mypath.substring(0, $mypath.length - 4)
|
|
|
|
|
|
|
|
if (Get-Command py) {
|
|
|
|
$python_executable = "py"
|
|
|
|
} else {
|
|
|
|
$python_executable = "python"
|
|
|
|
}
|
2022-01-06 09:49:47 +03:00
|
|
|
|
|
|
|
if (-not (test-path env:MACH_PS1_USE_MOZILLABUILD)) {
|
2022-01-21 21:22:58 +03:00
|
|
|
&$python_executable $machpath $args
|
2022-01-06 09:49:47 +03:00
|
|
|
exit $lastexitcode
|
|
|
|
}
|
|
|
|
|
2021-01-20 05:08:40 +03:00
|
|
|
if (-not (test-path env:MOZILLABUILD)) {
|
|
|
|
echo "No MOZILLABUILD environment variable found, terminating."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-01-21 21:22:58 +03:00
|
|
|
$machpath = ($machpath -replace '\\', '/')
|
|
|
|
|
2021-01-20 05:08:40 +03:00
|
|
|
if ($machpath.contains(' ')) {
|
|
|
|
echo @'
|
|
|
|
The repository path contains whitespace which currently isn't supported in mach.ps1.
|
|
|
|
Please run MozillaBuild manually for now.
|
|
|
|
'@
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
for ($i = 0; $i -lt $args.length; $i++) {
|
|
|
|
$arg = $args[$i]
|
|
|
|
if ($arg.contains(' ')) {
|
|
|
|
echo @'
|
|
|
|
The command contains whitespace which currently isn't supported in mach.ps1.
|
|
|
|
Please run MozillaBuild manually for now.
|
|
|
|
'@
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-21 21:22:59 +03:00
|
|
|
$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
|
|
|
|
}
|
2021-01-20 05:08:40 +03:00
|
|
|
exit $lastexitcode
|