diff options
author | Dan Siegel <me@dansiegel.net> | 2017-05-22 03:22:28 +0300 |
---|---|---|
committer | Dan Siegel <me@dansiegel.net> | 2017-05-22 04:50:13 +0300 |
commit | 1c6ef007f8c6582035428e7dd2b7d059372d7813 (patch) | |
tree | 88efa631f4a374d8e1f3c0f38e710ab66e370417 | |
parent | 34dc22549e0b961d86829fd41d7244847fd677e5 (diff) |
check for windows desktop & make sure we’re building in the correct directory
-rw-r--r-- | Source/nuspecs/nuget.ps1 | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/Source/nuspecs/nuget.ps1 b/Source/nuspecs/nuget.ps1 index a2bf9e9..7919cd4 100644 --- a/Source/nuspecs/nuget.ps1 +++ b/Source/nuspecs/nuget.ps1 @@ -25,7 +25,7 @@ function Get-FileVersion throw "Could not locate the assembly '$assemblyPath'" } -function Build-NuGetExpression +function ConvertTo-NuGetExpression { [OutputType([string])] Param ( @@ -56,7 +56,7 @@ function Build-NuGetExpression return $expression } -function Pack-Project ($project) { +function Save-NuGetPackage ($project) { $nuspecPath = $project["nuspec"] $wpfAssemblyPath = $project["projects"]["wpf"] $uwpAssemblyPath = $project["projects"]["uwp"] @@ -64,7 +64,13 @@ function Pack-Project ($project) { $wpfVersion = Get-FileVersion -assemblyPath $wpfAssemblyPath $uwpVersion = Get-FileVersion -assemblyPath $uwpAssemblyPath - Invoke-Expression | Build-NuGetExpression -nuspecPath $nuspecPath -wpfVersion $wpfVersion -uwpVersion $uwpVersion + Invoke-Expression | ConvertTo-NuGetExpression -nuspecPath $nuspecPath -wpfVersion $wpfVersion -uwpVersion $uwpVersion +} + +if(Test-Path ./Source) +{ + $returnPath = "../.." + Set-Location ./Source/nuspecs } if (!(Test-Path $nugetFileName)) @@ -76,15 +82,25 @@ if (!(Test-Path $nugetFileName)) $projectsJson = Get-Content -Raw -Path projects.json | ConvertFrom-Json $coreFileVersion = Get-FileVersion -assemblyPath $projectsJson["core"] -if($IsWindows) +Write-Host "Is Windows: $IsWindows" +Write-Host "Is CoreCLR: $IsCoreCLR" +Write-Host "Is Linux: $IsLinux" +Write-Host "Is OSX: $IsOSX" + +if($IsWindows -or $PSEdition -eq "Desktop") { - foreach ($project in $projects["projects"].GetEnumerator()) + foreach ($project in $projectsJson["projects"].GetEnumerator()) { Write-Host "Building package for $($project.Name)" - Pack-Project -project $project.Value + Save-NuGetPackage -project $project.Value } } else { Write-Host "This script must be executed on Windows" +} + +if($returnPath) +{ + Set-Location $returnPath }
\ No newline at end of file |