Support executing generate-compiler-code.ps1 on Linux using Powershell Core.

上级 494165c8
# Collection of powershell build utility functions that we use across our scripts.
Set-StrictMode -version 2.0
$ErrorActionPreference="Stop"
Add-Type -AssemblyName 'System.Drawing'
Add-Type -AssemblyName 'System.Windows.Forms'
function Capture-Screenshot($path) {
$width = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width
$height = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height
$bitmap = New-Object System.Drawing.Bitmap $width, $height
try {
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
try {
$graphics.CopyFromScreen( `
[System.Windows.Forms.Screen]::PrimaryScreen.Bounds.X, `
[System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Y, `
0, `
0, `
$bitmap.Size, `
[System.Drawing.CopyPixelOperation]::SourceCopy)
} finally {
$graphics.Dispose()
}
$bitmap.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
} finally {
$bitmap.Dispose()
}
}
......@@ -159,7 +159,20 @@ function Exec-Script([string]$script, [string]$scriptArgs = "") {
# Ensure the proper .NET Core SDK is available. Returns the location to the dotnet.exe.
function Ensure-DotnetSdk() {
return Join-Path (InitializeDotNetCli -install:$true) "dotnet.exe"
$dotnetInstallDir = (InitializeDotNetCli -install:$true)
$dotnetTestPath = Join-Path $dotnetInstallDir "dotnet.exe"
if (Test-Path -Path $dotnetTestPath)
{
return $dotnetTestPath
}
$dotnetTestPath = Join-Path $dotnetInstallDir "dotnet"
if (Test-Path -Path $dotnetTestPath)
{
return $dotnetTestPath
}
throw "Could not find dotnet executable in $dotnetInstallDir"
}
function Get-VersionCore([string]$name, [string]$versionFile) {
......@@ -288,30 +301,3 @@ function Make-BootstrapBuild([switch]$force32 = $false) {
return $dir
}
Add-Type -AssemblyName 'System.Drawing'
Add-Type -AssemblyName 'System.Windows.Forms'
function Capture-Screenshot($path) {
$width = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width
$height = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height
$bitmap = New-Object System.Drawing.Bitmap $width, $height
try {
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
try {
$graphics.CopyFromScreen( `
[System.Windows.Forms.Screen]::PrimaryScreen.Bounds.X, `
[System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Y, `
0, `
0, `
$bitmap.Size, `
[System.Drawing.CopyPixelOperation]::SourceCopy)
} finally {
$graphics.Dispose()
}
$bitmap.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
} finally {
$bitmap.Dispose()
}
}
......@@ -605,6 +605,11 @@ try {
. (Join-Path $PSScriptRoot "build-utils.ps1")
if ($testVsi)
{
. (Join-Path $PSScriptRoot "build-utils-win.ps1")
}
Push-Location $RepoRoot
if ($ci) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册