Use new TargetFramwork as net5.0 in packaging scripts (#12503)

This commit is contained in:
Ilya 2020-04-28 04:28:17 +05:00 committed by GitHub
parent 86b6a9d5ca
commit 7c1cc868b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 14 deletions

View file

@ -95,7 +95,7 @@
<Company>Microsoft Corporation</Company>
<Copyright>(c) Microsoft Corporation. All rights reserved.</Copyright>
<TargetFramework>netcoreapp5.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>8.0</LangVersion>
<PublishReadyToRun>true</PublishReadyToRun>

View file

@ -615,7 +615,7 @@ function Install-OpenCover
.Description
Invoke-OpenCover runs tests under OpenCover by executing tests on PowerShell located at $PowerShellExeDirectory.
.EXAMPLE
Invoke-OpenCover -TestPath $PWD/test/powershell -PowerShellExeDirectory $PWD/src/powershell-win-core/bin/CodeCoverage/netcoreapp5.0/win7-x64
Invoke-OpenCover -TestPath $PWD/test/powershell -PowerShellExeDirectory $PWD/src/powershell-win-core/bin/CodeCoverage/net5.0/win7-x64
#>
function Invoke-OpenCover
{
@ -624,7 +624,7 @@ function Invoke-OpenCover
[parameter()]$OutputLog = "$HOME/Documents/OpenCover.xml",
[parameter()]$TestPath = "${script:psRepoPath}/test/powershell",
[parameter()]$OpenCoverPath = "$HOME/OpenCover",
[parameter()]$PowerShellExeDirectory = "${script:psRepoPath}/src/powershell-win-core/bin/CodeCoverage/netcoreapp5.0/win7-x64/publish",
[parameter()]$PowerShellExeDirectory = "${script:psRepoPath}/src/powershell-win-core/bin/CodeCoverage/net5.0/win7-x64/publish",
[parameter()]$PesterLogElevated = "$HOME/Documents/TestResultsElevated.xml",
[parameter()]$PesterLogUnelevated = "$HOME/Documents/TestResultsUnelevated.xml",
[parameter()]$PesterLogFormat = "NUnitXml",

View file

@ -8,6 +8,7 @@ $packagingStrings = Import-PowerShellDataFile "$PSScriptRoot\packaging.strings.p
Import-Module "$PSScriptRoot\..\Xml" -ErrorAction Stop -Force
$DebianDistributions = @("ubuntu.16.04", "ubuntu.18.04", "debian.9", "debian.10", "debian.11")
$RedhatDistributions = @("rhel.7","centos.8")
$script:netCoreRuntime = 'net5.0'
function Start-PSPackage {
[CmdletBinding(DefaultParameterSetName='Version',SupportsShouldProcess=$true)]
@ -131,14 +132,14 @@ function Start-PSPackage {
-not $Script:Options -or ## Start-PSBuild hasn't been executed yet
-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.Framework -ne "net5.0" ## Last build wasn't for CoreCLR
$Script:Options.Framework -ne $script:netCoreRuntime ## Last build wasn't for CoreCLR
} else {
-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
$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.Framework -ne "net5.0" ## Last build wasn't for CoreCLR
$Script:Options.Framework -ne $script:netCoreRuntime ## Last build wasn't for CoreCLR
}
# Make sure the most recent build satisfies the package requirement
@ -1719,7 +1720,7 @@ function CreateNugetPlatformFolder
[string] $PlatformBinPath
)
$destPath = New-Item -ItemType Directory -Path (Join-Path $PackageRuntimesFolder "$Platform/lib/netcoreapp5.0")
$destPath = New-Item -ItemType Directory -Path (Join-Path $PackageRuntimesFolder "$Platform/lib/$script:netCoreRuntime")
$fullPath = Join-Path $PlatformBinPath $file
if (-not(Test-Path $fullPath)) {
@ -1819,7 +1820,7 @@ function New-ILNugetPackage
$packageRuntimesFolder = New-Item (Join-Path $filePackageFolder.FullName 'runtimes') -ItemType Directory
#region ref
$refFolder = New-Item (Join-Path $filePackageFolder.FullName 'ref/netcoreapp5.0') -ItemType Directory -Force
$refFolder = New-Item (Join-Path $filePackageFolder.FullName 'ref/$script:netCoreRuntime') -ItemType Directory -Force
CopyReferenceAssemblies -assemblyName $fileBaseName -refBinPath $refBinPath -refNugetPath $refFolder -assemblyFileList $fileList
#endregion ref
@ -1863,8 +1864,8 @@ function New-ILNugetPackage
"Microsoft.PowerShell.Utility"
)
$winModuleFolder = New-Item (Join-Path $contentFolder "runtimes\win\lib\netcoreapp5.0\Modules") -ItemType Directory -Force
$unixModuleFolder = New-Item (Join-Path $contentFolder "runtimes\unix\lib\netcoreapp5.0\Modules") -ItemType Directory -Force
$winModuleFolder = New-Item (Join-Path $contentFolder "runtimes\win\lib\$script:netCoreRuntime\Modules") -ItemType Directory -Force
$unixModuleFolder = New-Item (Join-Path $contentFolder "runtimes\unix\lib\$script:netCoreRuntime\Modules") -ItemType Directory -Force
foreach ($module in $winBuiltInModules) {
$source = Join-Path $WinFxdBinPath "Modules\$module"
@ -1991,7 +1992,7 @@ function New-ILNugetPackage
}
<#
Copy the generated reference assemblies to the 'ref/netcoreapp5.0' folder properly.
Copy the generated reference assemblies to the 'ref/net5.0' folder properly.
This is a helper function used by 'New-ILNugetPackage'
#>
function CopyReferenceAssemblies
@ -2234,7 +2235,7 @@ function New-ReferenceAssembly
Write-Log "Running: dotnet $arguments"
Start-NativeExecution -sb {dotnet $arguments}
$refBinPath = Join-Path $projectFolder "bin/Release/netcoreapp5.0/$assemblyName.dll"
$refBinPath = Join-Path $projectFolder "bin/Release/$script:netCoreRuntime/$assemblyName.dll"
if ($null -eq $refBinPath) {
throw "Reference assembly was not built."
}
@ -2886,7 +2887,7 @@ function New-MSIPatch
# This example shows how to produce a Debug-x64 installer for development purposes.
cd $RootPathOfPowerShellRepo
Import-Module .\build.psm1; Import-Module .\tools\packaging\packaging.psm1
New-MSIPackage -Verbose -ProductCode (New-Guid) -ProductSourcePath '.\src\powershell-win-core\bin\Debug\netcoreapp5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3'
New-MSIPackage -Verbose -ProductCode (New-Guid) -ProductSourcePath '.\src\powershell-win-core\bin\Debug\net5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3'
#>
function New-MSIPackage
{
@ -3088,7 +3089,7 @@ function New-MSIPackage
# This example shows how to produce a Debug-x64 installer for development purposes.
cd $RootPathOfPowerShellRepo
Import-Module .\build.psm1; Import-Module .\tools\packaging\packaging.psm1
New-MSIXPackage -Verbose -ProductSourcePath '.\src\powershell-win-core\bin\Debug\netcoreapp5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3'
New-MSIXPackage -Verbose -ProductSourcePath '.\src\powershell-win-core\bin\Debug\net5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3'
#>
function New-MSIXPackage
{
@ -3678,7 +3679,7 @@ function New-GlobalToolNupkg
}
$packageInfo | ForEach-Object {
$ridFolder = New-Item -Path (Join-Path $_.RootFolder "tools/netcoreapp5.0/any") -ItemType Directory
$ridFolder = New-Item -Path (Join-Path $_.RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory
$packageType = $_.Type