blob: 6d4496a91a55cc8b169490fa01aa4dd317321e53 [file] [log] [blame]
robert.tomczyk18692522020-11-27 07:08:24 +00001# ============LICENSE_START=======================================================
2# Copyright (C) 2018-2020 Nordix Foundation.
3# ================================================================================
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16# SPDX-License-Identifier: Apache-2.0
17# ============LICENSE_END=========================================================
18
19# Wrapper function for choco (Software management automation for Windows)
20function Install-Choco {
21 [CmdletBinding()]
22 param(
23 [Parameter(Mandatory)]
24 [string] $PackageName,
25 [string[]] $ArgumentList
26 )
27
28 process {
29 $count = 1
30 while($true)
31 {
32 Write-Host "Running [#$count]: choco install $packageName -y $ArgumentList"
33 choco install $packageName -y @ArgumentList
34
35 $pkg = choco list --localonly $packageName --exact --all --limitoutput
36 if ($pkg) {
37 Write-Host "Package installed: $pkg"
38 break
39 }
40 else {
41 $count++
42 if ($count -ge 5) {
43 Write-Host "Could not install $packageName after $count attempts"
44 exit 1
45 }
46 Start-Sleep -Seconds 30
47 }
48 }
49 }
50}
51
52# Get required version of geode server to execute geode-native (client) tests
53function Get-GeodeServer {
54 [CmdletBinding()]
55 param(
56 [Parameter(Mandatory)]
57 [string] $GeodeVersion,
58 [Parameter(Mandatory)]
59 [string] $LocationPath
60 )
61 process {
62 $GeodeURL = "https://downloads.apache.org/geode/" + $GeodeVersion + "/apache-geode-" + $GeodeVersion + ".tgz"
63 $GeodePackage = "apache-geode-" + $GeodeVersion + ".tgz"
64 Write-Host "`nDownloading Geode Server version: $GeodeVersion"
65 Write-Host "from URL: $GeodeURL `n"
66 wget -Verbose $GeodeURL -OutFile $GeodePackage
67 If(!(test-path $LocationPath))
68 {
69 New-Item -ItemType Directory -Force -Path $LocationPath
70 }
71 Write-Host "`nExtracting Geode Server to: ${LocationPath}apache-geode-${GeodeVersion} `n"
72 tar -xzvf $GeodePackage -C $LocationPath
73 $env:GEODE_HOME = $LocationPath + "\apache-geode-" + $GeodeVersion
74 }
75}
76
77Write-Host "Install Git, version: latest"
78Install-Choco -PackageName git.install
79
80Write-Host "Install Doxygen, version: latest"
81Install-Choco -PackageName doxygen.install
82
83Write-Host "Install NUnit, version: ${ENV:NUNIT_VERSION}"
84Install-Choco -PackageName nunit.install -ArgumentList "--version",${ENV:NUNIT_VERSION},"--allow-downgrade"
85
86Write-Host "Install OpenSSL, version: latest"
87Install-Choco -PackageName openssl
88
89Write-Host "Install CMake, version: latest"
90Install-Choco -PackageName cmake.portable
91
robert.tomczykbe33f3d2020-11-27 16:09:19 +000092Write-Host "Install Dogtail, version: ${ENV:DOTNET_VERSION}"
93Install-Choco -PackageName dotnet${ENV:DOTNET_VERSION}
robert.tomczyk18692522020-11-27 07:08:24 +000094
robert.tomczykbe33f3d2020-11-27 16:09:19 +000095Write-Host "Install .NET Framework and DevPack, version: ${ENV:DEV_DOTNET_VERSION}"
96Install-Choco -PackageName "dotnet${ENV:DEV_DOTNET_VERSION}"
97Install-Choco -PackageName "netfx-${ENV:DEV_DOTNET_VERSION}-devpack" -ArgumentList "--allowEmptyChecksums","-confirm"
robert.tomczyk18692522020-11-27 07:08:24 +000098
99Write-Host "Install GNU Win32 Core utilities, version: latest"
100Install-Choco -PackageName gnuwin32-coreutils.portable
101
102Write-Host "Install NSIS, version: latest"
103Install-Choco -PackageName nsis
104
105Write-Host "Install patch, version: latest"
106Install-Choco -PackageName patch
107
108Write-Host "Install NuGet, version: latest"
109Install-Choco -PackageName nuget.commandline
110
111Get-GeodeServer -GeodeVersion ${ENV:GEODE_SERVER_VERSION} -LocationPath ${ENV:GEODE_SERVER_PATH}