mach.ps1 (1331B)
1 $mypath = $MyInvocation.MyCommand.Path 2 $machpath = $mypath.substring(0, $mypath.length - 4) 3 4 if (Get-Command py -ErrorAction SilentlyContinue) { 5 $python_executable = "py" 6 } else { 7 $python_executable = "python" 8 } 9 10 if (-not (test-path env:MACH_PS1_USE_MOZILLABUILD)) { 11 &$python_executable $machpath $args 12 exit $lastexitcode 13 } 14 15 if (-not (test-path env:MOZILLABUILD)) { 16 echo "No MOZILLABUILD environment variable found, terminating." 17 exit 1 18 } 19 20 $machpath = ($machpath -replace '\\', '/') 21 22 if ($machpath.contains(' ')) { 23 echo @' 24 The repository path contains whitespace which currently isn't supported in mach.ps1. 25 Please run MozillaBuild manually for now. 26 '@ 27 exit 1 28 } 29 30 for ($i = 0; $i -lt $args.length; $i++) { 31 $arg = $args[$i] 32 if ($arg.contains(' ')) { 33 echo @' 34 The command contains whitespace which currently isn't supported in mach.ps1. 35 Please run MozillaBuild manually for now. 36 '@ 37 exit 1 38 } 39 } 40 41 $mozillabuild_version = Get-Content "$env:MOZILLABUILD\VERSION" 42 # Remove "preX" postfix if the current MozillaBuild is a prerelease. 43 $mozillabuild_version = [decimal]($mozillabuild_version -replace "pre.*") 44 45 if ($mozillabuild_version -ge 4.0) { 46 & "$env:MOZILLABUILD/start-shell.bat" -no-start -defterm -c "$machpath $args" 47 } else { 48 & "$env:MOZILLABUILD/start-shell.bat" $machpath $args 49 } 50 exit $lastexitcode