Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
version 7 prerelease 1 (#77)
Browse files Browse the repository at this point in the history
* Make sure that TokenTraits type has the proper attribute

* remove deleted types and methods

* Remove extraneous whitespace

* A number of types (and some associated methods) have been
removed from Standard 7

* A number of changes needed to nuspec file to bring it up to MS standard
  • Loading branch information
JamesWTruher authored Apr 8, 2020
1 parent 6c56952 commit c7c7ad3
Show file tree
Hide file tree
Showing 13 changed files with 885 additions and 936 deletions.
38 changes: 28 additions & 10 deletions PowerShellStandard.psm1
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
function Start-Build {
param ( [switch]$CoreOnly )
$versions = 3,5
# $versions = 3,5
$versions = 5
$srcBase = Join-Path $PsScriptRoot src
foreach ( $version in $versions ) {
try {
$srcDir = Join-Path $srcBase $version
Push-Location $srcDir
dotnet restore
Write-Verbose -Verbose "restoring in $srcDir"
$result = dotnet restore
if ( ! $? ) { throw "$result" }
if ( $CoreOnly ) {
dotnet build --configuration Release --framework netstandard2.0
Write-Verbose -Verbose "building netstandard in $srcDir"
$result = dotnet build --configuration Release --framework netstandard2.0
if ( ! $? ) { throw "$result" }
}
else {
dotnet build --configuration Release
Write-Verbose -Verbose "building default in $srcDir"
$result = dotnet build --configuration Release
if ( ! $? ) { throw "$result" } else { Write-Verbose -Verbose "$result" }
}
}
finally {
Expand All @@ -23,8 +30,12 @@ function Start-Build {
try {
$templateBase = Join-Path $srcBase dotnetTemplate
Push-Location $templateBase
dotnet restore
dotnet build --configuration Release
Write-Verbose -Verbose "restoring in $templateBase"
$result = dotnet restore
if ( ! $? ) { throw "$result" }
Write-Verbose -Verbose "building in $templateBase"
$result = dotnet build --configuration Release
if ( ! $? ) { throw "$result" } else { Write-Verbose -Verbose "$result" }
}
finally {
Pop-Location
Expand All @@ -41,7 +52,9 @@ function Start-Clean {
try {
$fileDir = Join-Path $baseDir $version
Push-Location $fileDir
dotnet clean
"Cleaning in $fileDir"
$result = dotnet clean
if ( ! $? ) { write-error "$result" }
if ( test-path obj ) { remove-item -recurse -force obj }
if ( test-path bin ) { remove-item -recurse -force bin }
remove-item "PowerShellStandard.Library.${version}*.nupkg" -ErrorAction SilentlyContinue
Expand Down Expand Up @@ -77,11 +90,13 @@ function Invoke-Test {
try {
Push-Location $framework
if ( $CoreOnly ) {
dotnet build --configuration Release --framework netstandard2.0
$result = dotnet build --configuration Release --framework netstandard2.0
if ( ! $? ) { throw "$result" }
Invoke-Pester
}
else {
dotnet build --configuration Release
$result = dotnet build --configuration Release
if ( ! $? ) { throw "$result" }
Invoke-Pester
}
}
Expand All @@ -108,12 +123,14 @@ function Export-NuGetPackage
{
# create the package
# it will automatically build
$versions = 3,5
# $versions = 3,5
$versions = 5
$srcBase = Join-Path $PsScriptRoot src
foreach ( $version in $versions ) {
try {
$srcDir = Join-Path $srcBase $version
Push-Location $srcDir
Write-Verbose -Verbose "Creating nupkg for $version"
$result = dotnet pack --configuration Release
if ( $? ) {
Copy-Item -verbose:$true (Join-Path $srcDir "bin/Release/PowerShellStandard.Library*.nupkg") $PsScriptRoot
Expand All @@ -130,6 +147,7 @@ function Export-NuGetPackage
try {
$templateDir = Join-Path $PsScriptRoot src/dotnetTemplate
Push-Location $templateDir
Write-Verbose -Verbose "creating nupkg in $templateDir"
$result = dotnet pack --configuration Release
if ( $? ) {
Copy-Item -verbose:$true (Join-Path $templateDir "bin/Release/*.nupkg") $PsScriptRoot
Expand Down
5 changes: 5 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ param (
[Parameter(HelpMessage="Build only for netstandard2.0")][switch]$CoreOnly
)

Write-Progress -Activity "Importing module"
import-module $PSScriptRoot/PowerShellStandard.psm1 -force

if ( $Clean ) {
Expand All @@ -20,6 +21,7 @@ if ( $IsLinux -or $IsMacOS ) {
$CoreOnly = $true
}

Write-Progress -Activity "Starting Build"
if ( $Pack ) {
if ( $CoreOnly ) {
Write-Warning "Must build both netstandard2.0 and net452 to build package"
Expand All @@ -32,6 +34,9 @@ else {
}

if ( $Test ) {
if ( $psversiontable.psversion.major -lt 6 ) {
throw "Must run tests on PowerShell Core 6 or above"
}
Invoke-Test -CoreOnly:$CoreOnly
}

Loading

0 comments on commit c7c7ad3

Please sign in to comment.