[Feature] Clean up FullCLR related scripts/docs (#4580)
This commit is contained in:
parent
3a8f923e03
commit
feeb8e1d25
300
build.psm1
300
build.psm1
|
@ -92,11 +92,10 @@ function Get-PSCommitId
|
|||
function Get-EnvironmentInformation
|
||||
{
|
||||
$environment = @{}
|
||||
# Use the .NET Core APIs to determine the current platform
|
||||
# if a runtime exception is thrown, we are on FullCLR, not .NET Core.
|
||||
# Use the .NET Core APIs to determine the current platform.
|
||||
# If a runtime exception is thrown, we are on Windows PowerShell, not PowerShell Core,
|
||||
# because System.Runtime.InteropServices.RuntimeInformation
|
||||
# and System.Runtime.InteropServices.OSPlatform
|
||||
# do not exist in FullCLR
|
||||
# and System.Runtime.InteropServices.OSPlatform do not exist in Windows PowerShell.
|
||||
try {
|
||||
$Runtime = [System.Runtime.InteropServices.RuntimeInformation]
|
||||
$OSPlatform = [System.Runtime.InteropServices.OSPlatform]
|
||||
|
@ -267,7 +266,7 @@ cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$Arch" "&" cmake "$
|
|||
}
|
||||
|
||||
function Start-PSBuild {
|
||||
[CmdletBinding(DefaultParameterSetName='CoreCLR')]
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
# When specified this switch will stops running dev powershell
|
||||
# to help avoid compilation error, because file are in use.
|
||||
|
@ -295,29 +294,16 @@ function Start-PSBuild {
|
|||
"win7-x86",
|
||||
"win81-x64",
|
||||
"win10-x64",
|
||||
"osx.10.11-x64",
|
||||
"osx.10.12-x64",
|
||||
"opensuse.13.2-x64",
|
||||
"opensuse.42.1-x64")]
|
||||
[Parameter(ParameterSetName='CoreCLR')]
|
||||
[string]$Runtime,
|
||||
|
||||
[Parameter(ParameterSetName='FullCLR', Mandatory=$true)]
|
||||
[switch]$FullCLR,
|
||||
|
||||
[Parameter(ParameterSetName='FullCLR')]
|
||||
[switch]$XamlGen,
|
||||
|
||||
[ValidateSet('Linux', 'Debug', 'Release', 'CodeCoverage', '')] # We might need "Checked" as well
|
||||
[string]$Configuration,
|
||||
|
||||
[Parameter(ParameterSetName='CoreCLR')]
|
||||
[switch]$Publish,
|
||||
|
||||
[Parameter(ParameterSetName='CoreCLR')]
|
||||
[switch]$CrossGen,
|
||||
|
||||
[Parameter(ParameterSetName='CoreCLR')]
|
||||
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+\.\d+)?$")]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$ReleaseTag
|
||||
|
@ -360,15 +346,6 @@ function Start-PSBuild {
|
|||
# create the telemetry flag file
|
||||
$null = new-item -force -type file "$psscriptroot/DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY"
|
||||
|
||||
# simplify ParameterSetNames
|
||||
if ($PSCmdlet.ParameterSetName -eq 'FullCLR') {
|
||||
$FullCLR = $true
|
||||
|
||||
## Stop building 'FullCLR', but keep the parameters and related scripts for now.
|
||||
## Once we confirm that portable modules is supported with .NET Core 2.0, we will clean up all FullCLR related scripts.
|
||||
throw "Building against FullCLR is not supported"
|
||||
}
|
||||
|
||||
# Add .NET CLI tools to PATH
|
||||
Find-Dotnet
|
||||
|
||||
|
@ -411,7 +388,6 @@ Fix steps:
|
|||
$OptionsArguments = @{
|
||||
CrossGen=$CrossGen
|
||||
Output=$Output
|
||||
FullCLR=$FullCLR
|
||||
Runtime=$Runtime
|
||||
Configuration=$Configuration
|
||||
Verbose=$true
|
||||
|
@ -464,13 +440,6 @@ Fix steps:
|
|||
Start-ResGen
|
||||
}
|
||||
|
||||
# handle xaml files
|
||||
# Heuristic to resolve xaml on the fresh machine
|
||||
if ($FullCLR -and ($XamlGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.Activities/gen/*.g.cs"))) {
|
||||
log "Run XamlGen (generating .g.cs and .resources for .xaml files)"
|
||||
Start-XamlGen -MSBuildConfiguration $msbuildConfiguration
|
||||
}
|
||||
|
||||
# Build native components
|
||||
if (($Environment.IsLinux -or $Environment.IsOSX) -and -not $SMAOnly) {
|
||||
$Ext = if ($Environment.IsLinux) {
|
||||
|
@ -603,7 +572,7 @@ function New-PSOptions {
|
|||
[ValidateSet("Linux", "Debug", "Release", "CodeCoverage", "")]
|
||||
[string]$Configuration,
|
||||
|
||||
[ValidateSet("netcoreapp2.0", "net451")]
|
||||
[ValidateSet("netcoreapp2.0")]
|
||||
[string]$Framework,
|
||||
|
||||
# These are duplicated from Start-PSBuild
|
||||
|
@ -618,7 +587,6 @@ function New-PSOptions {
|
|||
"win7-x64",
|
||||
"win81-x64",
|
||||
"win10-x64",
|
||||
"osx.10.11-x64",
|
||||
"osx.10.12-x64",
|
||||
"opensuse.13.2-x64",
|
||||
"opensuse.42.1-x64")]
|
||||
|
@ -628,20 +596,12 @@ function New-PSOptions {
|
|||
|
||||
[string]$Output,
|
||||
|
||||
[switch]$FullCLR,
|
||||
|
||||
[switch]$SMAOnly
|
||||
)
|
||||
|
||||
# Add .NET CLI tools to PATH
|
||||
Find-Dotnet
|
||||
|
||||
if ($FullCLR) {
|
||||
## Stop building 'FullCLR', but keep the parameters and related scripts for now.
|
||||
## Once we confirm that portable modules is supported with .NET Core 2.0, we will clean up all FullCLR related scripts.
|
||||
throw "Building against FullCLR is not supported"
|
||||
}
|
||||
|
||||
$ConfigWarningMsg = "The passed-in Configuration value '{0}' is not supported on '{1}'. Use '{2}' instead."
|
||||
if (-not $Configuration) {
|
||||
$Configuration = if ($Environment.IsLinux -or $Environment.IsOSX) {
|
||||
|
@ -673,9 +633,7 @@ function New-PSOptions {
|
|||
}
|
||||
Write-Verbose "Using configuration '$Configuration'"
|
||||
|
||||
$PowerShellDir = if ($FullCLR) {
|
||||
"powershell-win-full"
|
||||
} elseif ($Configuration -eq 'Linux') {
|
||||
$PowerShellDir = if ($Configuration -eq 'Linux') {
|
||||
"powershell-unix"
|
||||
} else {
|
||||
"powershell-win-core"
|
||||
|
@ -683,13 +641,8 @@ function New-PSOptions {
|
|||
$Top = [IO.Path]::Combine($PSScriptRoot, "src", $PowerShellDir)
|
||||
Write-Verbose "Top project directory is $Top"
|
||||
|
||||
|
||||
if (-not $Framework) {
|
||||
$Framework = if ($FullCLR) {
|
||||
"net451"
|
||||
} else {
|
||||
"netcoreapp2.0"
|
||||
}
|
||||
$Framework = "netcoreapp2.0"
|
||||
Write-Verbose "Using framework '$Framework'"
|
||||
}
|
||||
|
||||
|
@ -869,8 +822,7 @@ function Start-PSPester {
|
|||
[string[]]$Tag = @("CI","Feature"),
|
||||
[string[]]$Path = @("$PSScriptRoot/test/common","$PSScriptRoot/test/powershell"),
|
||||
[switch]$ThrowOnFailure,
|
||||
[switch]$FullCLR,
|
||||
[string]$binDir = (Split-Path (New-PSOptions -FullCLR:$FullCLR).Output),
|
||||
[string]$binDir = (Split-Path (New-PSOptions).Output),
|
||||
[string]$powershell = (Join-Path $binDir 'powershell'),
|
||||
[string]$Pester = ([IO.Path]::Combine($binDir, "Modules", "Pester")),
|
||||
[switch]$Unelevate,
|
||||
|
@ -878,12 +830,6 @@ function Start-PSPester {
|
|||
[switch]$PassThru
|
||||
)
|
||||
|
||||
if ($FullCLR) {
|
||||
## Stop building 'FullCLR', but keep the parameters and related scripts for now.
|
||||
## Once we confirm that portable modules is supported with .NET Core 2.0, we will clean up all FullCLR related scripts.
|
||||
throw "Building against FullCLR is not supported"
|
||||
}
|
||||
|
||||
# we need to do few checks and if user didn't provide $ExcludeTag explicitly, we should alternate the default
|
||||
if ($Unelevate)
|
||||
{
|
||||
|
@ -923,12 +869,8 @@ function Start-PSPester {
|
|||
if ($Environment.IsWindows) {
|
||||
$Command += "Set-ExecutionPolicy -Scope Process Unrestricted; "
|
||||
}
|
||||
$startParams = @{binDir=$binDir}
|
||||
|
||||
if(!$FullCLR)
|
||||
{
|
||||
$Command += "Import-Module '$Pester'; "
|
||||
}
|
||||
$Command += "Import-Module '$Pester'; "
|
||||
|
||||
if ($Unelevate)
|
||||
{
|
||||
|
@ -962,49 +904,44 @@ function Start-PSPester {
|
|||
Write-Verbose $Command
|
||||
|
||||
# To ensure proper testing, the module path must not be inherited by the spawned process
|
||||
if($FullCLR)
|
||||
{
|
||||
Start-DevPowerShell -binDir $binDir -FullCLR -NoNewWindow -ArgumentList '-noprofile', '-noninteractive' -Command $command
|
||||
}
|
||||
else {
|
||||
try {
|
||||
$originalModulePath = $env:PSModulePath
|
||||
if ($Unelevate)
|
||||
try {
|
||||
$originalModulePath = $env:PSModulePath
|
||||
if ($Unelevate)
|
||||
{
|
||||
Start-UnelevatedProcess -process $powershell -arguments @('-noprofile', '-c', $Command)
|
||||
$currentLines = 0
|
||||
while ($true)
|
||||
{
|
||||
Start-UnelevatedProcess -process $powershell -arguments @('-noprofile', '-c', $Command)
|
||||
$currentLines = 0
|
||||
while ($true)
|
||||
$lines = Get-Content $outputBufferFilePath | Select-Object -Skip $currentLines
|
||||
$lines | Write-Host
|
||||
if ($lines | Where-Object { $_ -eq '__UNELEVATED_TESTS_THE_END__'})
|
||||
{
|
||||
$lines = Get-Content $outputBufferFilePath | Select-Object -Skip $currentLines
|
||||
$lines | Write-Host
|
||||
if ($lines | Where-Object { $_ -eq '__UNELEVATED_TESTS_THE_END__'})
|
||||
{
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
$count = ($lines | measure-object).Count
|
||||
if ($count -eq 0)
|
||||
{
|
||||
sleep 1
|
||||
}
|
||||
else
|
||||
{
|
||||
$currentLines += $count
|
||||
}
|
||||
$count = ($lines | measure-object).Count
|
||||
if ($count -eq 0)
|
||||
{
|
||||
sleep 1
|
||||
}
|
||||
else
|
||||
{
|
||||
$currentLines += $count
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
& $powershell -noprofile -c $Command
|
||||
}
|
||||
} finally {
|
||||
$env:PSModulePath = $originalModulePath
|
||||
if ($Unelevate)
|
||||
{
|
||||
Remove-Item $outputBufferFilePath
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
& $powershell -noprofile -c $Command
|
||||
}
|
||||
} finally {
|
||||
$env:PSModulePath = $originalModulePath
|
||||
if ($Unelevate)
|
||||
{
|
||||
Remove-Item $outputBufferFilePath
|
||||
}
|
||||
}
|
||||
|
||||
if($ThrowOnFailure)
|
||||
{
|
||||
Test-PSPesterResults -TestResultsFile $OutputFile
|
||||
|
@ -1439,22 +1376,14 @@ function Publish-NuGetFeed
|
|||
|
||||
function Start-DevPowerShell {
|
||||
param(
|
||||
[switch]$FullCLR,
|
||||
[switch]$ZapDisable,
|
||||
[string[]]$ArgumentList = '',
|
||||
[switch]$LoadProfile,
|
||||
[string]$binDir = (Split-Path (New-PSOptions -FullCLR:$FullCLR).Output),
|
||||
[string]$binDir = (Split-Path (New-PSOptions).Output),
|
||||
[switch]$NoNewWindow,
|
||||
[string]$Command,
|
||||
[switch]$KeepPSModulePath
|
||||
)
|
||||
|
||||
if ($FullCLR) {
|
||||
## Stop building 'FullCLR', but keep the parameters and related scripts for now.
|
||||
## Once we confirm that portable modules is supported with .NET Core 2.0, we will clean up all FullCLR related scripts.
|
||||
throw "Building against FullCLR is not supported"
|
||||
}
|
||||
|
||||
try {
|
||||
if ((-not $NoNewWindow) -and ($Environment.IsCoreCLR)) {
|
||||
Write-Warning "Start-DevPowerShell -NoNewWindow is currently implied in PowerShellCore edition https://github.com/PowerShell/PowerShell/issues/1543"
|
||||
|
@ -1477,21 +1406,6 @@ function Start-DevPowerShell {
|
|||
}
|
||||
|
||||
$env:DEVPATH = $binDir
|
||||
if ($ZapDisable) {
|
||||
$env:COMPLUS_ZapDisable = 1
|
||||
}
|
||||
|
||||
if ($FullCLR -and (-not (Test-Path $binDir\powershell.exe.config))) {
|
||||
$configContents = @"
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<developmentMode developerInstallation="true"/>
|
||||
</runtime>
|
||||
</configuration>
|
||||
"@
|
||||
$configContents | Out-File -Encoding Ascii $binDir\powershell.exe.config
|
||||
}
|
||||
|
||||
# splatting for the win
|
||||
$startProcessArgs = @{
|
||||
|
@ -1619,120 +1533,6 @@ function Convert-TxtResourceToXml
|
|||
}
|
||||
}
|
||||
|
||||
function Start-XamlGen
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter()]
|
||||
[ValidateSet("Debug", "Release")]
|
||||
[string]
|
||||
$MSBuildConfiguration = "Release"
|
||||
)
|
||||
|
||||
Use-MSBuild
|
||||
Get-ChildItem -Path "$PSScriptRoot/src" -Directory | ForEach-Object {
|
||||
$XamlDir = Join-Path -Path $_.FullName -ChildPath Xamls
|
||||
if ((Test-Path -Path $XamlDir -PathType Container) -and
|
||||
(@(Get-ChildItem -Path "$XamlDir\*.xaml").Count -gt 0)) {
|
||||
$OutputDir = Join-Path -Path $env:TEMP -ChildPath "_Resolve_Xaml_"
|
||||
Remove-Item -Path $OutputDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
mkdir -Path $OutputDir -Force > $null
|
||||
|
||||
# we will get failures, but it's ok: we only need to copy *.g.cs files in the dotnet cli project.
|
||||
$SourceDir = ConvertFrom-Xaml -Configuration $MSBuildConfiguration -OutputDir $OutputDir -XamlDir $XamlDir -IgnoreMsbuildFailure:$true
|
||||
$DestinationDir = Join-Path -Path $_.FullName -ChildPath gen
|
||||
|
||||
New-Item -ItemType Directory $DestinationDir -ErrorAction SilentlyContinue > $null
|
||||
$filesToCopy = Get-Item "$SourceDir\*.cs", "$SourceDir\*.g.resources"
|
||||
if (-not $filesToCopy) {
|
||||
throw "No .cs or .g.resources files are generated for $XamlDir, something went wrong. Run 'Start-XamlGen -Verbose' for details."
|
||||
}
|
||||
|
||||
$filesToCopy | ForEach-Object {
|
||||
$sourcePath = $_.FullName
|
||||
Write-Verbose "Copy generated xaml artifact: $sourcePath -> $DestinationDir"
|
||||
Copy-Item -Path $sourcePath -Destination $DestinationDir
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Script:XamlProj = @"
|
||||
<Project DefaultTargets="ResolveAssemblyReferences;MarkupCompilePass1;PrepareResources" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Language>C#</Language>
|
||||
<AssemblyName>Microsoft.PowerShell.Activities</AssemblyName>
|
||||
<OutputType>library</OutputType>
|
||||
<Configuration>{0}</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<OutputPath>{1}</OutputPath>
|
||||
<Do_CodeGenFromXaml>true</Do_CodeGenFromXaml>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="`$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="`$(MSBuildBinPath)\Microsoft.WinFX.targets" Condition="'`$(TargetFrameworkVersion)' == 'v2.0' OR '`$(TargetFrameworkVersion)' == 'v3.0' OR '`$(TargetFrameworkVersion)' == 'v3.5'" />
|
||||
|
||||
<ItemGroup>
|
||||
{2}
|
||||
<Reference Include="WindowsBase.dll">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore.dll">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationFramework.dll">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
"@
|
||||
|
||||
$Script:XamlProjPage = @'
|
||||
<Page Include="{0}" />
|
||||
|
||||
'@
|
||||
|
||||
function script:ConvertFrom-Xaml {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string] $Configuration,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string] $OutputDir,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string] $XamlDir,
|
||||
|
||||
[switch] $IgnoreMsbuildFailure
|
||||
)
|
||||
|
||||
log "ConvertFrom-Xaml for $XamlDir"
|
||||
|
||||
$Pages = ""
|
||||
Get-ChildItem -Path "$XamlDir\*.xaml" | ForEach-Object {
|
||||
$Page = $Script:XamlProjPage -f $_.FullName
|
||||
$Pages += $Page
|
||||
}
|
||||
|
||||
$XamlProjContent = $Script:XamlProj -f $Configuration, $OutputDir, $Pages
|
||||
$XamlProjPath = Join-Path -Path $OutputDir -ChildPath xaml.proj
|
||||
Set-Content -Path $XamlProjPath -Value $XamlProjContent -Encoding Ascii -NoNewline -Force
|
||||
|
||||
msbuild $XamlProjPath | Write-Verbose
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
$message = "When processing $XamlDir 'msbuild $XamlProjPath > `$null' failed with exit code $LASTEXITCODE"
|
||||
if ($IgnoreMsbuildFailure) {
|
||||
Write-Verbose $message
|
||||
} else {
|
||||
throw $message
|
||||
}
|
||||
}
|
||||
|
||||
return (Join-Path -Path $OutputDir -ChildPath "obj\Any CPU\$Configuration")
|
||||
}
|
||||
|
||||
|
||||
function script:Use-MSBuild {
|
||||
# TODO: we probably should require a particular version of msbuild, if we are taking this dependency
|
||||
|
@ -1778,23 +1578,6 @@ function script:precheck([string]$command, [string]$missedMessage) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function script:Get-InvertedOrderedMap {
|
||||
param(
|
||||
$h
|
||||
)
|
||||
$res = [ordered]@{}
|
||||
foreach ($q in $h.GetEnumerator()) {
|
||||
if ($res.Contains($q.Value)) {
|
||||
throw "Cannot invert hashtable: duplicated key $($q.Value)"
|
||||
}
|
||||
|
||||
$res[$q.Value] = $q.Key
|
||||
}
|
||||
return $res
|
||||
}
|
||||
|
||||
|
||||
# this function wraps native command Execution
|
||||
# for more information, read https://mnaoumov.wordpress.com/2015/01/11/execution-of-external-commands-in-powershell-done-right/
|
||||
function script:Start-NativeExecution([scriptblock]$sb, [switch]$IgnoreExitcode)
|
||||
|
@ -1981,7 +1764,6 @@ function Start-CrossGen {
|
|||
"win7-x64",
|
||||
"win81-x64",
|
||||
"win10-x64",
|
||||
"osx.10.11-x64",
|
||||
"osx.10.12-x64",
|
||||
"opensuse.13.2-x64",
|
||||
"opensuse.42.1-x64")]
|
||||
|
|
|
@ -6,14 +6,12 @@ The ultimate source of truth is the code in `.\build.psm1` that's getting execut
|
|||
|
||||
This document assumes that you can successfully build PowerShell from sources for your platform.
|
||||
|
||||
|
||||
## Top directory
|
||||
|
||||
We are calling `dotnet` tool build for `$Top` directory
|
||||
|
||||
- `src\powershell-win-core` for CoreCLR on Windows.
|
||||
- `src\powershell-unix` for CoreCLR on Linux and macOS.
|
||||
- `src\powershell-win-full` for FullCLR builds (Windows only)
|
||||
|
||||
### Dummy dependencies
|
||||
|
||||
|
@ -25,11 +23,8 @@ Dummy dependencies allows us to build just `$Top` folder, instead of building se
|
|||
|
||||
### Dummy dependencies rules
|
||||
|
||||
- If assembly is part of FullCLR build,
|
||||
it should be listed as a dependency for FullCLR $Top folder (src\powershell-win-full)
|
||||
|
||||
- If assembly is part of CoreCLR build,
|
||||
it should be listed as a dependency for $Top folder (src\powershell-unix or src\powershell-win-core)
|
||||
If assembly is part of CoreCLR build,
|
||||
it should be listed as a dependency for $Top folder (src\powershell-unix or src\powershell-win-core)
|
||||
|
||||
## Preliminary steps
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ Note that `New-PSSession` and `Enter-PSSession` invocations that do not specify
|
|||
|
||||
## Artifact Installation Instructions
|
||||
|
||||
We publish an archive with CoreCLR and FullCLR bits on every CI build with [AppVeyor][].
|
||||
We publish an archive with CoreCLR bits on every CI build with [AppVeyor][].
|
||||
|
||||
[releases]: https://github.com/PowerShell/PowerShell/releases
|
||||
[signing]: ../../tools/Sign-Package.ps1
|
||||
|
|
|
@ -1,165 +0,0 @@
|
|||
$originalPSModulePath = $env:PSModulePath
|
||||
try
|
||||
{
|
||||
# load all modules only from $env:DEVPATH !!!
|
||||
$env:PSModulePath = "$($env:DEVPATH)\Modules"
|
||||
|
||||
# this Describe makes sure we build all the dlls we want and load them from the right place
|
||||
Describe 'build.psm1 and powershell.exe' {
|
||||
Context '$env:DEVPATH assemblies loading' {
|
||||
It 'has $env:DEVPATH set' {
|
||||
$env:DEVPATH | Should Not Be $null
|
||||
}
|
||||
|
||||
It 'loads System.Management.Automation.dll' {
|
||||
[psobject].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH System.Management.Automation.dll)
|
||||
}
|
||||
|
||||
It 'loads Microsoft.PowerShell.Commands.Management.dll' {
|
||||
[Microsoft.PowerShell.Commands.GetChildItemCommand].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH Microsoft.PowerShell.Commands.Management.dll)
|
||||
}
|
||||
|
||||
It 'loads Microsoft.PowerShell.Commands.Utility.dll' {
|
||||
[Microsoft.PowerShell.Commands.UtilityResources].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH Microsoft.PowerShell.Commands.Utility.dll)
|
||||
}
|
||||
|
||||
It 'loads Microsoft.PowerShell.ConsoleHost.dll' {
|
||||
[Microsoft.PowerShell.ConsoleShell].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH Microsoft.PowerShell.ConsoleHost.dll)
|
||||
}
|
||||
|
||||
It 'loads Microsoft.PowerShell.Security.dll' {
|
||||
[Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH Microsoft.PowerShell.Security.dll)
|
||||
}
|
||||
|
||||
It 'loads Microsoft.PowerShell.Workflow.ServiceCore.dll' {
|
||||
workflow wfTest { Split-Path $pwd }
|
||||
wfTest | Should Not Be $null ## Also trigger the loading of ServiceCore.dll
|
||||
[Microsoft.PowerShell.Workflow.PSWorkflowJob].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH Microsoft.PowerShell.Workflow.ServiceCore.dll)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# this Describe makes sure we binplace all the files, like psd1, psm1, ps1xml and load usable modules from them
|
||||
Describe 'Modules for the package' {
|
||||
Context '$env:DEVPATH Modules loading' {
|
||||
<#
|
||||
removed due to #4272
|
||||
It 'loads Microsoft.PowerShell.LocalAccounts' {
|
||||
try
|
||||
{
|
||||
Import-Module Microsoft.PowerShell.LocalAccounts -ErrorAction Stop
|
||||
Get-LocalUser | Should Not Be $null
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Module -ErrorAction SilentlyContinue Microsoft.PowerShell.LocalAccounts
|
||||
}
|
||||
}
|
||||
#>
|
||||
|
||||
It 'loads Microsoft.PowerShell.Archive' {
|
||||
try
|
||||
{
|
||||
Import-Module Microsoft.PowerShell.LocalAccounts -ErrorAction Stop
|
||||
Set-Content -Path TestDrive:\1.txt -Value ''
|
||||
Compress-Archive -Path TestDrive:\1.txt -DestinationPath TestDrive:\1.zip
|
||||
Get-ChildItem -Path TestDrive:\1.zip | Should Not Be $null
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Module -ErrorAction SilentlyContinue Microsoft.PowerShell.Archive
|
||||
}
|
||||
}
|
||||
|
||||
It 'loads PsScheduledJob' {
|
||||
try
|
||||
{
|
||||
Import-Module PsScheduledJob -ErrorAction Stop
|
||||
New-ScheduledJobOption | Should Not Be $null
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Module -ErrorAction SilentlyContinue PsScheduledJob
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
It 'loads PSWorkflowUtility' {
|
||||
try
|
||||
{
|
||||
Import-Module PSWorkflowUtility -ErrorAction Stop
|
||||
Invoke-AsWorkflow -Expression { 'foo' } | Should Be 'foo'
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Module -ErrorAction SilentlyContinue PSWorkflowUtility
|
||||
}
|
||||
}
|
||||
|
||||
It 'loads PSWorkflow' {
|
||||
try
|
||||
{
|
||||
Import-Module PSWorkflow -ErrorAction Stop
|
||||
New-PSWorkflowExecutionOption | Should Not Be $null
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Module -ErrorAction SilentlyContinue PSWorkflow
|
||||
}
|
||||
}
|
||||
|
||||
It 'loads CimCmdlets' {
|
||||
try
|
||||
{
|
||||
Import-Module CimCmdlets -ErrorAction Stop
|
||||
Get-CimClass -ClassName CIM_Error | Should Not Be $null
|
||||
[Microsoft.Management.Infrastructure.CimCmdlets.AsyncResultType].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH Microsoft.Management.Infrastructure.CimCmdlets.dll)
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Module -ErrorAction SilentlyContinue CimCmdlets
|
||||
}
|
||||
}
|
||||
|
||||
It 'loads Microsoft.WSMan.Management' {
|
||||
try
|
||||
{
|
||||
Import-Module Microsoft.WSMan.Management -ErrorAction Stop
|
||||
Test-WSMan | Should Not Be $null
|
||||
[Microsoft.WSMan.Management.TestWSManCommand].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH Microsoft.WSMan.Management.dll)
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Module -ErrorAction SilentlyContinue Microsoft.WSMan.Management
|
||||
}
|
||||
}
|
||||
|
||||
It 'loads Microsoft.PowerShell.Diagnostics' {
|
||||
try
|
||||
{
|
||||
Import-Module Microsoft.PowerShell.Diagnostics -ErrorAction Stop
|
||||
Get-WinEvent -LogName System -MaxEvents 1 | Should Not Be $null
|
||||
[Microsoft.PowerShell.Commands.GetWinEventCommand].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH Microsoft.PowerShell.Commands.Diagnostics.dll)
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Module -ErrorAction SilentlyContinue Microsoft.PowerShell.Diagnostics
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
$env:PSModulePath = $originalPSModulePath
|
||||
}
|
|
@ -180,9 +180,6 @@ function Invoke-AppVeyorBuild
|
|||
Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore
|
||||
}
|
||||
|
||||
## Stop building 'FullCLR', but keep the parameters and related scripts for now.
|
||||
## Once we confirm that portable modules is supported with .NET Core 2.0, we will clean up all FullCLR related scripts.
|
||||
<# Start-PSBuild -FullCLR -PSModuleRestore # Disable FullCLR Build #>
|
||||
Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release'
|
||||
}
|
||||
|
||||
|
@ -327,7 +324,6 @@ function Invoke-AppVeyorTest
|
|||
Write-Host -Foreground Green 'Run CoreCLR tests'
|
||||
$testResultsNonAdminFile = "$pwd\TestsResultsNonAdmin.xml"
|
||||
$testResultsAdminFile = "$pwd\TestsResultsAdmin.xml"
|
||||
<# $testResultsFileFullCLR = "$pwd\TestsResults.FullCLR.xml" # Disable FullCLR Build #>
|
||||
if(!(Test-Path "$env:CoreOutput\powershell.exe"))
|
||||
{
|
||||
throw "CoreCLR PowerShell.exe was not built"
|
||||
|
@ -361,23 +357,11 @@ function Invoke-AppVeyorTest
|
|||
Write-Host -Foreground Green 'Upload CoreCLR Admin test results'
|
||||
Update-AppVeyorTestResults -resultsFile $testResultsAdminFile
|
||||
|
||||
<#
|
||||
#
|
||||
# FullCLR # Disable FullCLR Build
|
||||
$env:FullOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -FullCLR))
|
||||
Write-Host -Foreground Green 'Run FullCLR tests'
|
||||
Start-PSPester -FullCLR -bindir $env:FullOutput -outputFile $testResultsFileFullCLR -Tag $null -path 'test/fullCLR'
|
||||
|
||||
Write-Host -Foreground Green 'Upload FullCLR test results'
|
||||
Update-AppVeyorTestResults -resultsFile $testResultsFileFullCLR
|
||||
#>
|
||||
|
||||
#
|
||||
# Fail the build, if tests failed
|
||||
@(
|
||||
$testResultsNonAdminFile,
|
||||
$testResultsAdminFile
|
||||
<# $testResultsFileFullCLR # Disable FullCLR Build #>
|
||||
) | ForEach-Object {
|
||||
Test-PSPesterResults -TestResultsFile $_
|
||||
}
|
||||
|
@ -453,16 +437,10 @@ function Invoke-AppveyorFinish
|
|||
$name = Get-PackageName
|
||||
|
||||
$zipFilePath = Join-Path $pwd "$name.zip"
|
||||
<# $zipFileFullPath = Join-Path $pwd "$name.FullCLR.zip" # Disable FullCLR Build #>
|
||||
|
||||
Add-Type -assemblyname System.IO.Compression.FileSystem
|
||||
Write-Verbose "Zipping ${env:CoreOutput} into $zipFilePath" -verbose
|
||||
[System.IO.Compression.ZipFile]::CreateFromDirectory($env:CoreOutput, $zipFilePath)
|
||||
<#
|
||||
# Disable FullCLR Build
|
||||
Write-Verbose "Zipping ${env:FullOutput} into $zipFileFullPath" -verbose
|
||||
[System.IO.Compression.ZipFile]::CreateFromDirectory($env:FullOutput, $zipFileFullPath)
|
||||
#>
|
||||
|
||||
$artifacts = New-Object System.Collections.ArrayList
|
||||
foreach ($package in $packages) {
|
||||
|
@ -470,7 +448,6 @@ function Invoke-AppveyorFinish
|
|||
}
|
||||
|
||||
$null = $artifacts.Add($zipFilePath)
|
||||
<# $null = $artifacts.Add($zipFileFullPath) # Disable FullCLR Build #>
|
||||
|
||||
if ($env:APPVEYOR_REPO_TAG_NAME)
|
||||
{
|
||||
|
|
|
@ -60,10 +60,7 @@ function Start-PSPackage {
|
|||
$Script:Options.Framework -ne "netcoreapp2.0") ## Last build wasn't for CoreCLR
|
||||
{
|
||||
# It's possible that the most recent build doesn't satisfy the package requirement but
|
||||
# an earlier build does. e.g., run the following in order on win10-x64:
|
||||
# Start-PSBuild -Clean -CrossGen -Runtime win10-x64 -Configuration Release
|
||||
# Start-PSBuild -FullCLR
|
||||
# Start-PSPackage -Type msi
|
||||
# an earlier build does.
|
||||
# It's also possible that the last build actually satisfies the package requirement but
|
||||
# then `Start-PSPackage` runs from a new PS session or `build.psm1` was reloaded.
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue