+# ============LICENSE_START=======================================================
+# Copyright (C) 2018-2020 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# Wrapper function for choco (Software management automation for Windows)
+function Install-Choco {
+ [CmdletBinding()]
+ param(
+ [Parameter(Mandatory)]
+ [string] $PackageName,
+ [string[]] $ArgumentList
+ )
+
+ process {
+ $count = 1
+ while($true)
+ {
+ Write-Host "Running [#$count]: choco install $packageName -y $ArgumentList"
+ choco install $packageName -y @ArgumentList
+
+ $pkg = choco list --localonly $packageName --exact --all --limitoutput
+ if ($pkg) {
+ Write-Host "Package installed: $pkg"
+ break
+ }
+ else {
+ $count++
+ if ($count -ge 5) {
+ Write-Host "Could not install $packageName after $count attempts"
+ exit 1
+ }
+ Start-Sleep -Seconds 30
+ }
+ }
+ }
+}
+
+# Get required version of geode server to execute geode-native (client) tests
+function Get-GeodeServer {
+ [CmdletBinding()]
+ param(
+ [Parameter(Mandatory)]
+ [string] $GeodeVersion,
+ [Parameter(Mandatory)]
+ [string] $LocationPath
+ )
+ process {
+ $GeodeURL = "https://downloads.apache.org/geode/" + $GeodeVersion + "/apache-geode-" + $GeodeVersion + ".tgz"
+ $GeodePackage = "apache-geode-" + $GeodeVersion + ".tgz"
+ Write-Host "`nDownloading Geode Server version: $GeodeVersion"
+ Write-Host "from URL: $GeodeURL `n"
+ wget -Verbose $GeodeURL -OutFile $GeodePackage
+ If(!(test-path $LocationPath))
+ {
+ New-Item -ItemType Directory -Force -Path $LocationPath
+ }
+ Write-Host "`nExtracting Geode Server to: ${LocationPath}apache-geode-${GeodeVersion} `n"
+ tar -xzvf $GeodePackage -C $LocationPath
+ $env:GEODE_HOME = $LocationPath + "\apache-geode-" + $GeodeVersion
+ }
+}
+
+Write-Host "Install Git, version: latest"
+Install-Choco -PackageName git.install
+
+Write-Host "Install Doxygen, version: latest"
+Install-Choco -PackageName doxygen.install
+
+Write-Host "Install NUnit, version: ${ENV:NUNIT_VERSION}"
+Install-Choco -PackageName nunit.install -ArgumentList "--version",${ENV:NUNIT_VERSION},"--allow-downgrade"
+
+Write-Host "Install OpenSSL, version: latest"
+Install-Choco -PackageName openssl
+
+Write-Host "Install CMake, version: latest"
+Install-Choco -PackageName cmake.portable
+
+Write-Host "Install Dogtail, version: ${ENV:DOGTAIL_DOTNET_VERSION}"
+Install-Choco -PackageName dogtail.dotnet${ENV:DOGTAIL_DOTNET_VERSION}
+
+Write-Host "Install .NET Framework and DevPack, version: ${ENV:DOTNET_VERSION}"
+Install-Choco -PackageName "dotnet${ENV:DOTNET_VERSION}"
+Install-Choco -PackageName "netfx-${ENV:DOTNET_VERSION}-devpack" -ArgumentList "--allowEmptyChecksums","-confirm"
+
+Write-Host "Install GNU Win32 Core utilities, version: latest"
+Install-Choco -PackageName gnuwin32-coreutils.portable
+
+Write-Host "Install NSIS, version: latest"
+Install-Choco -PackageName nsis
+
+Write-Host "Install patch, version: latest"
+Install-Choco -PackageName patch
+
+Write-Host "Install NuGet, version: latest"
+Install-Choco -PackageName nuget.commandline
+
+Get-GeodeServer -GeodeVersion ${ENV:GEODE_SERVER_VERSION} -LocationPath ${ENV:GEODE_SERVER_PATH}
\ No newline at end of file