Clean up crossgen
related build scripts also generate native symbols for R2R
images (#16297)
* Clean up crossgen related build scripts * Fix ci.psm1 * Clean up '-CrossGen' use in a few other files
This commit is contained in:
parent
d28691f59e
commit
f2d5ae74ad
|
@ -138,6 +138,7 @@
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<LangVersion>10.0</LangVersion>
|
<LangVersion>10.0</LangVersion>
|
||||||
<PublishReadyToRun Condition=" '$(Configuration)' != 'Debug' ">true</PublishReadyToRun>
|
<PublishReadyToRun Condition=" '$(Configuration)' != 'Debug' ">true</PublishReadyToRun>
|
||||||
|
<PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>
|
||||||
|
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
|
227
build.psm1
227
build.psm1
|
@ -314,8 +314,6 @@ function Start-PSBuild {
|
||||||
[ValidateSet('Debug', 'Release', 'CodeCoverage', '')] # We might need "Checked" as well
|
[ValidateSet('Debug', 'Release', 'CodeCoverage', '')] # We might need "Checked" as well
|
||||||
[string]$Configuration,
|
[string]$Configuration,
|
||||||
|
|
||||||
[switch]$CrossGen,
|
|
||||||
|
|
||||||
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+(\.\d{1,2})?)?$")]
|
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+(\.\d{1,2})?)?$")]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]$ReleaseTag,
|
[string]$ReleaseTag,
|
||||||
|
@ -343,10 +341,6 @@ function Start-PSBuild {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ForMinimalSize) {
|
if ($ForMinimalSize) {
|
||||||
if ($CrossGen) {
|
|
||||||
throw "Build for the minimal size requires the minimal disk footprint, so `CrossGen` is not allowed"
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($Runtime -and "linux-x64", "win7-x64", "osx-x64" -notcontains $Runtime) {
|
if ($Runtime -and "linux-x64", "win7-x64", "osx-x64" -notcontains $Runtime) {
|
||||||
throw "Build for the minimal size is enabled only for following runtimes: 'linux-x64', 'win7-x64', 'osx-x64'"
|
throw "Build for the minimal size is enabled only for following runtimes: 'linux-x64', 'win7-x64', 'osx-x64'"
|
||||||
}
|
}
|
||||||
|
@ -414,7 +408,6 @@ Fix steps:
|
||||||
|
|
||||||
# set output options
|
# set output options
|
||||||
$OptionsArguments = @{
|
$OptionsArguments = @{
|
||||||
CrossGen=$CrossGen
|
|
||||||
Output=$Output
|
Output=$Output
|
||||||
Runtime=$Runtime
|
Runtime=$Runtime
|
||||||
Configuration=$Configuration
|
Configuration=$Configuration
|
||||||
|
@ -529,12 +522,6 @@ Fix steps:
|
||||||
Write-Log -message "Run dotnet $Arguments from $PWD"
|
Write-Log -message "Run dotnet $Arguments from $PWD"
|
||||||
Start-NativeExecution { dotnet $Arguments }
|
Start-NativeExecution { dotnet $Arguments }
|
||||||
Write-Log -message "PowerShell output: $($Options.Output)"
|
Write-Log -message "PowerShell output: $($Options.Output)"
|
||||||
|
|
||||||
if ($CrossGen) {
|
|
||||||
# fxdependent package cannot be CrossGen'ed
|
|
||||||
Start-CrossGen -PublishPath $publishPath -Runtime $script:Options.Runtime
|
|
||||||
Write-Log -message "pwsh.exe with ngen binaries is available at: $($Options.Output)"
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$globalToolSrcFolder = Resolve-Path (Join-Path $Options.Top "../Microsoft.PowerShell.GlobalTool.Shim") | Select-Object -ExpandProperty Path
|
$globalToolSrcFolder = Resolve-Path (Join-Path $Options.Top "../Microsoft.PowerShell.GlobalTool.Shim") | Select-Object -ExpandProperty Path
|
||||||
|
|
||||||
|
@ -837,8 +824,6 @@ function New-PSOptions {
|
||||||
"win7-x86")]
|
"win7-x86")]
|
||||||
[string]$Runtime,
|
[string]$Runtime,
|
||||||
|
|
||||||
[switch]$CrossGen,
|
|
||||||
|
|
||||||
# Accept a path to the output directory
|
# Accept a path to the output directory
|
||||||
# If not null or empty, name of the executable will be appended to
|
# If not null or empty, name of the executable will be appended to
|
||||||
# this path, otherwise, to the default path, and then the full path
|
# this path, otherwise, to the default path, and then the full path
|
||||||
|
@ -944,7 +929,6 @@ function New-PSOptions {
|
||||||
-RootInfo ([PSCustomObject]$RootInfo) `
|
-RootInfo ([PSCustomObject]$RootInfo) `
|
||||||
-Top $Top `
|
-Top $Top `
|
||||||
-Runtime $Runtime `
|
-Runtime $Runtime `
|
||||||
-Crossgen $Crossgen.IsPresent `
|
|
||||||
-Configuration $Configuration `
|
-Configuration $Configuration `
|
||||||
-PSModuleRestore $PSModuleRestore.IsPresent `
|
-PSModuleRestore $PSModuleRestore.IsPresent `
|
||||||
-Framework $Framework `
|
-Framework $Framework `
|
||||||
|
@ -2360,211 +2344,6 @@ function script:Start-NativeExecution
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Start-CrossGen {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory= $true)]
|
|
||||||
[ValidateNotNullOrEmpty()]
|
|
||||||
[String]
|
|
||||||
$PublishPath,
|
|
||||||
|
|
||||||
[Parameter(Mandatory=$true)]
|
|
||||||
[ValidateSet("alpine-x64",
|
|
||||||
"linux-arm",
|
|
||||||
"linux-arm64",
|
|
||||||
"linux-x64",
|
|
||||||
"osx-arm64",
|
|
||||||
"osx-x64",
|
|
||||||
"win-arm",
|
|
||||||
"win-arm64",
|
|
||||||
"win7-x64",
|
|
||||||
"win7-x86")]
|
|
||||||
[string]
|
|
||||||
$Runtime
|
|
||||||
)
|
|
||||||
|
|
||||||
function New-CrossGenAssembly {
|
|
||||||
param (
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[ValidateNotNullOrEmpty()]
|
|
||||||
[String[]]
|
|
||||||
$AssemblyPath,
|
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[ValidateNotNullOrEmpty()]
|
|
||||||
[String]
|
|
||||||
$CrossgenPath,
|
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[ValidateSet("alpine-x64",
|
|
||||||
"linux-arm",
|
|
||||||
"linux-arm64",
|
|
||||||
"linux-x64",
|
|
||||||
"osx-arm64",
|
|
||||||
"osx-x64",
|
|
||||||
"win-arm",
|
|
||||||
"win-arm64",
|
|
||||||
"win7-x64",
|
|
||||||
"win7-x86")]
|
|
||||||
[string]
|
|
||||||
$Runtime
|
|
||||||
)
|
|
||||||
|
|
||||||
$platformAssembliesPath = Split-Path $AssemblyPath[0] -Parent
|
|
||||||
|
|
||||||
$targetOS, $targetArch = $Runtime -split '-'
|
|
||||||
|
|
||||||
# Special cases where OS / Arch does not conform with runtime names
|
|
||||||
switch ($Runtime) {
|
|
||||||
'alpine-x64' {
|
|
||||||
$targetOS = 'linux'
|
|
||||||
$targetArch = 'x64'
|
|
||||||
}
|
|
||||||
'win-arm' {
|
|
||||||
$targetOS = 'windows'
|
|
||||||
$targetArch = 'arm'
|
|
||||||
}
|
|
||||||
'win-arm64' {
|
|
||||||
$targetOS = 'windows'
|
|
||||||
$targetArch = 'arm64'
|
|
||||||
}
|
|
||||||
'win7-x64' {
|
|
||||||
$targetOS = 'windows'
|
|
||||||
$targetArch = 'x64'
|
|
||||||
}
|
|
||||||
'win7-x86' {
|
|
||||||
$targetOS = 'windows'
|
|
||||||
$targetArch = 'x86'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$generatePdb = $targetos -eq 'windows'
|
|
||||||
|
|
||||||
# The path to folder must end with directory separator
|
|
||||||
$dirSep = [System.IO.Path]::DirectorySeparatorChar
|
|
||||||
$platformAssembliesPath = if (-not $platformAssembliesPath.EndsWith($dirSep)) { $platformAssembliesPath + $dirSep }
|
|
||||||
|
|
||||||
Start-NativeExecution {
|
|
||||||
$crossgen2Params = @(
|
|
||||||
"-r"
|
|
||||||
$platformAssembliesPath
|
|
||||||
"--out-near-input"
|
|
||||||
"--single-file-compilation"
|
|
||||||
"-O"
|
|
||||||
"--targetos"
|
|
||||||
$targetOS
|
|
||||||
"--targetarch"
|
|
||||||
$targetArch
|
|
||||||
)
|
|
||||||
|
|
||||||
if ($generatePdb) {
|
|
||||||
$crossgen2Params += "--pdb"
|
|
||||||
}
|
|
||||||
|
|
||||||
$crossgen2Params += $AssemblyPath
|
|
||||||
|
|
||||||
& $CrossgenPath $crossgen2Params
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (Test-Path $PublishPath)) {
|
|
||||||
throw "Path '$PublishPath' does not exist."
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get the path to crossgen
|
|
||||||
$crossGenExe = if ($environment.IsWindows) { "crossgen2.exe" } else { "crossgen2" }
|
|
||||||
|
|
||||||
# The crossgen tool is only published for these particular runtimes
|
|
||||||
$crossGenRuntime = if ($environment.IsWindows) {
|
|
||||||
# for windows the tool architecture is the host machine architecture, so it is always x64.
|
|
||||||
# we can cross compile for x86, arm and arm64
|
|
||||||
"win-x64"
|
|
||||||
} else {
|
|
||||||
$Runtime
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not $crossGenRuntime) {
|
|
||||||
throw "crossgen is not available for this platform"
|
|
||||||
}
|
|
||||||
|
|
||||||
$dotnetRuntimeVersion = $script:Options.Framework -replace 'net'
|
|
||||||
|
|
||||||
# Get the CrossGen.exe for the correct runtime with the latest version
|
|
||||||
$crossGenPath = Get-ChildItem $script:Environment.nugetPackagesRoot $crossGenExe -Recurse | `
|
|
||||||
Where-Object { $_.FullName -match $crossGenRuntime } | `
|
|
||||||
Where-Object { $_.FullName -match $dotnetRuntimeVersion } | `
|
|
||||||
Where-Object { (Split-Path $_.FullName -Parent).EndsWith('tools') } | `
|
|
||||||
Sort-Object -Property FullName -Descending | `
|
|
||||||
Select-Object -First 1 | `
|
|
||||||
ForEach-Object { $_.FullName }
|
|
||||||
if (-not $crossGenPath) {
|
|
||||||
throw "Unable to find latest version of crossgen2.exe. 'Please run Start-PSBuild -Clean' first, and then try again."
|
|
||||||
}
|
|
||||||
Write-Verbose "Matched CrossGen2.exe: $crossGenPath" -Verbose
|
|
||||||
|
|
||||||
# Common assemblies used by Add-Type or assemblies with high JIT and no pdbs to crossgen
|
|
||||||
$commonAssembliesForAddType = @(
|
|
||||||
"Microsoft.CodeAnalysis.CSharp.dll"
|
|
||||||
"Microsoft.CodeAnalysis.dll"
|
|
||||||
"System.Linq.Expressions.dll"
|
|
||||||
"Microsoft.CSharp.dll"
|
|
||||||
"System.Runtime.Extensions.dll"
|
|
||||||
"System.Linq.dll"
|
|
||||||
"System.Collections.Concurrent.dll"
|
|
||||||
"System.Collections.dll"
|
|
||||||
"Newtonsoft.Json.dll"
|
|
||||||
"System.IO.FileSystem.dll"
|
|
||||||
"System.Diagnostics.Process.dll"
|
|
||||||
"System.Threading.Tasks.Parallel.dll"
|
|
||||||
"System.Security.AccessControl.dll"
|
|
||||||
"System.Text.Encoding.CodePages.dll"
|
|
||||||
"System.Private.Uri.dll"
|
|
||||||
"System.Threading.dll"
|
|
||||||
"System.Security.Principal.Windows.dll"
|
|
||||||
"System.Console.dll"
|
|
||||||
"Microsoft.Win32.Registry.dll"
|
|
||||||
"System.IO.Pipes.dll"
|
|
||||||
"System.Diagnostics.FileVersionInfo.dll"
|
|
||||||
"System.Collections.Specialized.dll"
|
|
||||||
"Microsoft.ApplicationInsights.dll"
|
|
||||||
)
|
|
||||||
|
|
||||||
$fullAssemblyList = $commonAssembliesForAddType
|
|
||||||
|
|
||||||
$assemblyFullPaths = @()
|
|
||||||
$assemblyFullPaths += foreach ($assemblyName in $fullAssemblyList) {
|
|
||||||
Join-Path $PublishPath $assemblyName
|
|
||||||
}
|
|
||||||
|
|
||||||
New-CrossGenAssembly -CrossgenPath $crossGenPath -AssemblyPath $assemblyFullPaths -Runtime $Runtime
|
|
||||||
|
|
||||||
#
|
|
||||||
# With the latest dotnet.exe, the default load context is only able to load TPAs, and TPA
|
|
||||||
# only contains IL assembly names. In order to make the default load context able to load
|
|
||||||
# the NI PS assemblies, we need to replace the IL PS assemblies with the corresponding NI
|
|
||||||
# PS assemblies, but with the same IL assembly names.
|
|
||||||
#
|
|
||||||
Write-Verbose "PowerShell Ngen assemblies have been generated. Deploying ..." -Verbose
|
|
||||||
foreach ($assemblyName in $fullAssemblyList) {
|
|
||||||
|
|
||||||
# Remove the IL assembly and its symbols.
|
|
||||||
$assemblyPath = Join-Path $PublishPath $assemblyName
|
|
||||||
$symbolsPath = [System.IO.Path]::ChangeExtension($assemblyPath, ".pdb")
|
|
||||||
|
|
||||||
Remove-Item $assemblyPath -Force -ErrorAction Stop
|
|
||||||
|
|
||||||
# Rename the corresponding ni.dll assembly to be the same as the IL assembly
|
|
||||||
$niAssemblyPath = [System.IO.Path]::ChangeExtension($assemblyPath, "ni.dll")
|
|
||||||
Rename-Item $niAssemblyPath $assemblyPath -Force -ErrorAction Stop
|
|
||||||
|
|
||||||
# No symbols are available for Microsoft.CodeAnalysis.CSharp.dll, Microsoft.CodeAnalysis.dll,
|
|
||||||
# Microsoft.CodeAnalysis.VisualBasic.dll, and Microsoft.CSharp.dll.
|
|
||||||
if ($commonAssembliesForAddType -notcontains $assemblyName) {
|
|
||||||
Remove-Item $symbolsPath -Force -ErrorAction Stop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Cleans the PowerShell repo - everything but the root folder
|
# Cleans the PowerShell repo - everything but the root folder
|
||||||
function Clear-PSRepo
|
function Clear-PSRepo
|
||||||
{
|
{
|
||||||
|
@ -3087,7 +2866,6 @@ function Restore-PSOptions {
|
||||||
-RootInfo $options.RootInfo `
|
-RootInfo $options.RootInfo `
|
||||||
-Top $options.Top `
|
-Top $options.Top `
|
||||||
-Runtime $options.Runtime `
|
-Runtime $options.Runtime `
|
||||||
-Crossgen $options.Crossgen `
|
|
||||||
-Configuration $options.Configuration `
|
-Configuration $options.Configuration `
|
||||||
-PSModuleRestore $options.PSModuleRestore `
|
-PSModuleRestore $options.PSModuleRestore `
|
||||||
-Framework $options.Framework `
|
-Framework $options.Framework `
|
||||||
|
@ -3111,10 +2889,6 @@ function New-PSOptionsObject
|
||||||
[String]
|
[String]
|
||||||
$Runtime,
|
$Runtime,
|
||||||
|
|
||||||
[Parameter(Mandatory)]
|
|
||||||
[Bool]
|
|
||||||
$CrossGen,
|
|
||||||
|
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
[String]
|
[String]
|
||||||
$Configuration,
|
$Configuration,
|
||||||
|
@ -3143,7 +2917,6 @@ function New-PSOptionsObject
|
||||||
Framework = $Framework
|
Framework = $Framework
|
||||||
Runtime = $Runtime
|
Runtime = $Runtime
|
||||||
Output = $Output
|
Output = $Output
|
||||||
CrossGen = $CrossGen
|
|
||||||
PSModuleRestore = $PSModuleRestore
|
PSModuleRestore = $PSModuleRestore
|
||||||
ForMinimalSize = $ForMinimalSize
|
ForMinimalSize = $ForMinimalSize
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ function Invoke-CIBuild
|
||||||
Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore -CI -ReleaseTag $releaseTag
|
Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore -CI -ReleaseTag $releaseTag
|
||||||
}
|
}
|
||||||
|
|
||||||
Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -CI -ReleaseTag $releaseTag
|
Start-PSBuild -PSModuleRestore -Configuration 'Release' -CI -ReleaseTag $releaseTag
|
||||||
Save-PSOptions
|
Save-PSOptions
|
||||||
|
|
||||||
$options = (Get-PSOptions)
|
$options = (Get-PSOptions)
|
||||||
|
@ -470,7 +470,7 @@ function Invoke-CIFinish
|
||||||
$prereleaseIteration = (get-date).Day
|
$prereleaseIteration = (get-date).Day
|
||||||
$preReleaseVersion = "$previewPrefix-$previewLabel.$prereleaseIteration"
|
$preReleaseVersion = "$previewPrefix-$previewLabel.$prereleaseIteration"
|
||||||
# Build clean before backing to remove files from testing
|
# Build clean before backing to remove files from testing
|
||||||
Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json"
|
Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json"
|
||||||
$options = Get-PSOptions
|
$options = Get-PSOptions
|
||||||
# Remove symbol files.
|
# Remove symbol files.
|
||||||
$filter = Join-Path -Path (Split-Path $options.Output) -ChildPath '*.pdb'
|
$filter = Join-Path -Path (Split-Path $options.Output) -ChildPath '*.pdb'
|
||||||
|
@ -481,7 +481,7 @@ function Invoke-CIFinish
|
||||||
$releaseTagParts = $releaseTag.split('.')
|
$releaseTagParts = $releaseTag.split('.')
|
||||||
$preReleaseVersion = $releaseTagParts[0]+ ".9.9"
|
$preReleaseVersion = $releaseTagParts[0]+ ".9.9"
|
||||||
Write-Verbose "newPSReleaseTag: $preReleaseVersion" -Verbose
|
Write-Verbose "newPSReleaseTag: $preReleaseVersion" -Verbose
|
||||||
Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json"
|
Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json"
|
||||||
$options = Get-PSOptions
|
$options = Get-PSOptions
|
||||||
# Remove symbol files.
|
# Remove symbol files.
|
||||||
$filter = Join-Path -Path (Split-Path $options.Output) -ChildPath '*.pdb'
|
$filter = Join-Path -Path (Split-Path $options.Output) -ChildPath '*.pdb'
|
||||||
|
|
|
@ -117,17 +117,6 @@ function Start-PSPackage {
|
||||||
$Script:Options = Get-PSOptions
|
$Script:Options = Get-PSOptions
|
||||||
$actualParams = @()
|
$actualParams = @()
|
||||||
|
|
||||||
$crossGenCorrect = $false
|
|
||||||
if ($Runtime -match "arm" -or $Type -eq 'min-size') {
|
|
||||||
## crossgen doesn't support arm32/64;
|
|
||||||
## For the min-size package, we intentionally avoid crossgen.
|
|
||||||
$crossGenCorrect = $true
|
|
||||||
}
|
|
||||||
elseif ($Script:Options.CrossGen) {
|
|
||||||
$actualParams += '-CrossGen'
|
|
||||||
$crossGenCorrect = $true
|
|
||||||
}
|
|
||||||
|
|
||||||
$PSModuleRestoreCorrect = $false
|
$PSModuleRestoreCorrect = $false
|
||||||
|
|
||||||
# Require PSModuleRestore for packaging without symbols
|
# Require PSModuleRestore for packaging without symbols
|
||||||
|
@ -144,14 +133,13 @@ function Start-PSPackage {
|
||||||
}
|
}
|
||||||
|
|
||||||
$precheckFailed = if ($Type -like 'fxdependent*' -or $Type -eq 'tar-alpine') {
|
$precheckFailed = if ($Type -like 'fxdependent*' -or $Type -eq 'tar-alpine') {
|
||||||
## We do not check for runtime and crossgen for framework dependent package.
|
## We do not check on runtime for framework dependent package.
|
||||||
-not $Script:Options -or ## Start-PSBuild hasn't been executed yet
|
-not $Script:Options -or ## Start-PSBuild hasn't been executed yet
|
||||||
-not $PSModuleRestoreCorrect -or ## Last build didn't specify '-PSModuleRestore' correctly
|
-not $PSModuleRestoreCorrect -or ## Last build didn't specify '-PSModuleRestore' correctly
|
||||||
$Script:Options.Configuration -ne $Configuration -or ## Last build was with configuration other than 'Release'
|
$Script:Options.Configuration -ne $Configuration -or ## Last build was with configuration other than 'Release'
|
||||||
$Script:Options.Framework -ne $script:netCoreRuntime ## Last build wasn't for CoreCLR
|
$Script:Options.Framework -ne $script:netCoreRuntime ## Last build wasn't for CoreCLR
|
||||||
} else {
|
} else {
|
||||||
-not $Script:Options -or ## Start-PSBuild hasn't been executed yet
|
-not $Script:Options -or ## Start-PSBuild hasn't been executed yet
|
||||||
-not $crossGenCorrect -or ## Last build didn't specify '-CrossGen' correctly
|
|
||||||
-not $PSModuleRestoreCorrect -or ## Last build didn't specify '-PSModuleRestore' correctly
|
-not $PSModuleRestoreCorrect -or ## Last build didn't specify '-PSModuleRestore' correctly
|
||||||
$Script:Options.Runtime -ne $Runtime -or ## Last build wasn't for the required RID
|
$Script:Options.Runtime -ne $Runtime -or ## Last build wasn't for the required RID
|
||||||
$Script:Options.Configuration -ne $Configuration -or ## Last build was with configuration other than 'Release'
|
$Script:Options.Configuration -ne $Configuration -or ## Last build was with configuration other than 'Release'
|
||||||
|
@ -171,14 +159,8 @@ function Start-PSPackage {
|
||||||
# also ensure `Start-PSPackage` does what the user asks/expects, because once packages
|
# also ensure `Start-PSPackage` does what the user asks/expects, because once packages
|
||||||
# are generated, it'll be hard to verify if they were built from the correct content.
|
# are generated, it'll be hard to verify if they were built from the correct content.
|
||||||
|
|
||||||
|
|
||||||
$params = @('-Clean')
|
$params = @('-Clean')
|
||||||
|
|
||||||
# CrossGen cannot be done for framework dependent package as it is runtime agnostic.
|
|
||||||
if ($Type -notlike 'fxdependent*') {
|
|
||||||
$params += '-CrossGen'
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$IncludeSymbols.IsPresent) {
|
if (!$IncludeSymbols.IsPresent) {
|
||||||
$params += '-PSModuleRestore'
|
$params += '-PSModuleRestore'
|
||||||
}
|
}
|
||||||
|
@ -4147,9 +4129,6 @@ function Invoke-AzDevOpsLinuxPackageBuild {
|
||||||
# We are cross compiling, so we can't generate experimental features
|
# We are cross compiling, so we can't generate experimental features
|
||||||
$buildParams.Add("SkipExperimentalFeatureGeneration", $true)
|
$buildParams.Add("SkipExperimentalFeatureGeneration", $true)
|
||||||
}
|
}
|
||||||
default {
|
|
||||||
$buildParams.Add("Crossgen", $true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${mainLinuxBuildFolder}"
|
$buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${mainLinuxBuildFolder}"
|
||||||
|
@ -4169,7 +4148,6 @@ function Invoke-AzDevOpsLinuxPackageBuild {
|
||||||
Remove-Item -Path $binDir -Recurse -Force
|
Remove-Item -Path $binDir -Recurse -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
$buildParams['Crossgen'] = $false
|
|
||||||
$buildParams['ForMinimalSize'] = $true
|
$buildParams['ForMinimalSize'] = $true
|
||||||
$buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${minSizeLinuxBuildFolder}"
|
$buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${minSizeLinuxBuildFolder}"
|
||||||
Start-PSBuild -Clean @buildParams @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json"
|
Start-PSBuild -Clean @buildParams @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json"
|
||||||
|
|
|
@ -63,7 +63,6 @@ function BuildPackages {
|
||||||
} else {
|
} else {
|
||||||
# make the artifact name unique
|
# make the artifact name unique
|
||||||
$projectAssetsZipName = "linuxProjectAssets-$((Get-Date).Ticks)-symbols.zip"
|
$projectAssetsZipName = "linuxProjectAssets-$((Get-Date).Ticks)-symbols.zip"
|
||||||
$buildParams.Add("Crossgen", $true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Start-PSBuild @buildParams @releaseTagParam
|
Start-PSBuild @buildParams @releaseTagParam
|
||||||
|
@ -89,7 +88,6 @@ function BuildPackages {
|
||||||
Remove-Item -Path $binDir -Recurse -Force
|
Remove-Item -Path $binDir -Recurse -Force
|
||||||
|
|
||||||
## Build 'min-size' and create 'tar.gz' package for it.
|
## Build 'min-size' and create 'tar.gz' package for it.
|
||||||
$buildParams['Crossgen'] = $false
|
|
||||||
$buildParams['ForMinimalSize'] = $true
|
$buildParams['ForMinimalSize'] = $true
|
||||||
Start-PSBuild @buildParams @releaseTagParam
|
Start-PSBuild @buildParams @releaseTagParam
|
||||||
Start-PSPackage -Type min-size @releaseTagParam -LTS:$LTS
|
Start-PSPackage -Type min-size @releaseTagParam -LTS:$LTS
|
||||||
|
|
|
@ -97,7 +97,6 @@ try
|
||||||
{
|
{
|
||||||
Write-Verbose "Starting powershell build for RID: $Runtime and ReleaseTag: $ReleaseTag ..." -Verbose
|
Write-Verbose "Starting powershell build for RID: $Runtime and ReleaseTag: $ReleaseTag ..." -Verbose
|
||||||
$buildParams = @{
|
$buildParams = @{
|
||||||
CrossGen = !$ForMinimalSize -and $Runtime -notmatch "arm" -and $Runtime -notlike "fxdependent*"
|
|
||||||
ForMinimalSize = $ForMinimalSize
|
ForMinimalSize = $ForMinimalSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,15 +104,14 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Build) {
|
if ($Build) {
|
||||||
$runCrossgen = $Runtime -eq 'osx-x64'
|
|
||||||
if ($Symbols) {
|
if ($Symbols) {
|
||||||
Start-PSBuild -Clean -Configuration 'Release' -Crossgen:$runCrossgen -NoPSModuleRestore @releaseTagParam -Runtime $Runtime
|
Start-PSBuild -Clean -Configuration 'Release' -NoPSModuleRestore @releaseTagParam -Runtime $Runtime
|
||||||
$pspackageParams['Type']='zip'
|
$pspackageParams['Type']='zip'
|
||||||
$pspackageParams['IncludeSymbols']=$Symbols.IsPresent
|
$pspackageParams['IncludeSymbols']=$Symbols.IsPresent
|
||||||
Write-Verbose "Starting powershell packaging(zip)..." -Verbose
|
Write-Verbose "Starting powershell packaging(zip)..." -Verbose
|
||||||
Start-PSPackage @pspackageParams @releaseTagParam
|
Start-PSPackage @pspackageParams @releaseTagParam
|
||||||
} else {
|
} else {
|
||||||
Start-PSBuild -Configuration 'Release' -Crossgen:$runCrossgen -PSModuleRestore @releaseTagParam -Runtime $Runtime
|
Start-PSBuild -Configuration 'Release' -PSModuleRestore @releaseTagParam -Runtime $Runtime
|
||||||
Start-PSPackage @pspackageParams @releaseTagParam
|
Start-PSPackage @pspackageParams @releaseTagParam
|
||||||
switch ($ExtraPackage) {
|
switch ($ExtraPackage) {
|
||||||
"tar" { Start-PSPackage -Type tar @pspackageParams @releaseTagParam }
|
"tar" { Start-PSPackage -Type tar @pspackageParams @releaseTagParam }
|
||||||
|
|
Loading…
Reference in a new issue