Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check version of PowerShell in build script #2235

Merged
merged 1 commit into from
Dec 29, 2017

Conversation

HebaruSan
Copy link
Member

Problem

If you run the current build.ps1 script with PowerShell 2 or earlier, the $PSScriptRoot variable isn't set, which means several of the build script's variables are set to either the empty string or incomplete values. This has many consequences, for example the _build directory is created in the root of the drive.

CKAN/build.ps1

Lines 12 to 18 in 700f709

$RootDir = "${PSScriptRoot}"
$ScriptFile = "${RootDir}/build.cake"
$BuildDir = "${RootDir}/_build"
$ToolsDir = "${BuildDir}/tools"
$PackagesDir = "${BuildDir}/lib/nuget"
$NugetExe = "${ToolsDir}/NuGet/${NugetVersion}/nuget.exe"
$PackagesConfigFile = "${RootDir}/packages.config"

Changes

This pull request checks the currently running version of PowerShell and prints an error if it's less than 3.0:

image

We could try to make the script backwards compatible with PowerShell 2.0, but PowerShell is up to 5.1 now, so it's probably better just to upgrade.

I wanted to use Write-Error, but apparently there's no way to turn off its (in this case useless) stack trace output.

@HebaruSan HebaruSan added Build Issues affecting the build system Pull request Windows Issues specific for Windows labels Dec 27, 2017
@politas politas merged commit ccdc7b5 into KSP-CKAN:master Dec 29, 2017
@HebaruSan HebaruSan deleted the fix/powershell-version branch December 29, 2017 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Issues affecting the build system Windows Issues specific for Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants