forked from apache/cassandra-java-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappveyor.ps1
More file actions
132 lines (119 loc) · 5.11 KB
/
appveyor.ps1
File metadata and controls
132 lines (119 loc) · 5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
Add-Type -AssemblyName System.IO.Compression.FileSystem
$dep_dir="C:\Users\appveyor\deps"
If (!(Test-Path $dep_dir)) {
Write-Host "Creating $($dep_dir)"
New-Item -Path $dep_dir -ItemType Directory -Force
}
$apr_platform = "Win32"
$openssl_platform = "Win32"
$vc_platform = "x86"
$env:PYTHON="C:\Python27"
$env:OPENSSL_PATH="C:\OpenSSL-Win32"
If ($env:PLATFORM -eq "X64") {
$apr_platform = "x64"
$vc_platform = "x64"
$env:PYTHON="C:\Python27-x64"
$env:OPENSSL_PATH="C:\OpenSSL-Win64"
}
$env:JAVA_HOME="C:\Program Files\Java\jdk$($env:java_version)"
# The configured java version to test with.
$env:JAVA_PLATFORM_HOME="$($env:JAVA_HOME)"
$env:JAVA_8_HOME="C:\Program Files\Java\jdk1.8.0"
$env:PATH="$($env:PYTHON);$($env:PYTHON)\Scripts;$($env:JAVA_HOME)\bin;$($env:OPENSSL_PATH)\bin;$($env:PATH)"
$env:CCM_PATH="$($dep_dir)\ccm"
$apr_dist_path = "$($dep_dir)\apr"
# Build APR if it hasn't been previously built.
If (!(Test-Path $apr_dist_path)) {
Write-Host "Cloning APR"
$apr_path = "C:\Users\appveyor\apr"
Start-Process git -ArgumentList "clone --branch=1.5.2 --depth=1 https://github.com/apache/apr.git $($apr_path)" -Wait -nnw
Write-Host "Setting Visual Studio Environment to VS 2015"
Push-Location "$($env:VS140COMNTOOLS)\..\..\VC"
cmd /c "vcvarsall.bat $vc_platform & set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); Set-Item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
Pop-Location
Write-Host "Building APR (an error may be printed, but it will still build)"
Push-Location $($apr_path)
cmd /c nmake -f Makefile.win ARCH="$apr_platform Release" PREFIX=$($apr_dist_path) buildall install
Pop-Location
Write-Host "Done Building APR"
}
$env:PATH="$($apr_dist_path)\bin;$($env:PATH)"
# Install Ant and Maven
$ant_base = "$($dep_dir)\ant"
$ant_path = "$($ant_base)\apache-ant-1.9.7"
If (!(Test-Path $ant_path)) {
Write-Host "Installing Ant"
$ant_url = "https://www.dropbox.com/s/lgx95x1jr6s787l/apache-ant-1.9.7-bin.zip?dl=1"
$ant_zip = "C:\Users\appveyor\apache-ant-1.9.7-bin.zip"
(new-object System.Net.WebClient).DownloadFile($ant_url, $ant_zip)
[System.IO.Compression.ZipFile]::ExtractToDirectory($ant_zip, $ant_base)
}
$env:PATH="$($ant_path)\bin;$($env:PATH)"
$maven_base = "$($dep_dir)\maven"
$maven_path = "$($maven_base)\apache-maven-3.2.5"
If (!(Test-Path $maven_path)) {
Write-Host "Installing Maven"
$maven_url = "https://www.dropbox.com/s/fh9kffmexprsmha/apache-maven-3.2.5-bin.zip?dl=1"
$maven_zip = "C:\Users\appveyor\apache-maven-3.2.5-bin.zip"
(new-object System.Net.WebClient).DownloadFile($maven_url, $maven_zip)
[System.IO.Compression.ZipFile]::ExtractToDirectory($maven_zip, $maven_base)
}
$env:M2_HOME="$($maven_path)"
$env:PATH="$($maven_path)\bin;$($env:PATH)"
$jdks = @("1.6.0", "1.7.0", "1.8.0")
foreach ($jdk in $jdks) {
$java_dir = "C:\Program Files\Java\jdk$jdk"
$jce_target = "$java_dir\jre\lib\security"
$jce_indicator = "$jce_target\README.txt"
# Install Java Cryptographic Extensions, needed for SSL.
# If this file doesn't exist we know JCE hasn't been installed.
If (!(Test-Path $jce_indicator)) {
Write-Host "Installing JCE for $jdk"
$zip = "$dep_dir\jce_policy-$jdk.zip"
$url = "https://www.dropbox.com/s/po4308hlwulpvep/UnlimitedJCEPolicyJDK7.zip?dl=1"
$extract_folder = "UnlimitedJCEPolicy"
If ($jdk -eq "1.8.0") {
$url = "https://www.dropbox.com/s/al1e6e92cjdv7m7/jce_policy-8.zip?dl=1"
$extract_folder = "UnlimitedJCEPolicyJDK8"
}
ElseIf ($jdk -eq "1.6.0") {
$url = "https://www.dropbox.com/s/dhrtucxcif4n11k/jce_policy-6.zip?dl=1"
$extract_folder = "jce"
}
# Download zip to staging area if it doesn't exist, we do this because
# we extract it to the directory based on the platform and we want to cache
# this file so it can apply to all platforms.
if(!(Test-Path $zip)) {
(new-object System.Net.WebClient).DownloadFile($url, $zip)
}
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $jce_target)
$jcePolicyDir = "$jce_target\$extract_folder"
Move-Item $jcePolicyDir\* $jce_target\ -force
Remove-Item $jcePolicyDir
}
}
# Install Python Dependencies for CCM.
Write-Host "Installing Python Dependencies for CCM"
Start-Process python -ArgumentList "-m pip install psutil pyYaml six" -Wait -nnw
# Clone ccm from git and use master.
If (!(Test-Path $env:CCM_PATH)) {
Write-Host "Cloning CCM"
Start-Process git -ArgumentList "clone https://github.com/pcmanus/ccm.git $($env:CCM_PATH)" -Wait -nnw
}
# Copy ccm -> ccm.py so windows knows to run it.
If (!(Test-Path $env:CCM_PATH\ccm.py)) {
Copy-Item "$env:CCM_PATH\ccm" "$env:CCM_PATH\ccm.py"
}
$env:PYTHONPATH="$($env:CCM_PATH);$($env:PYTHONPATH)"
$env:PATH="$($env:CCM_PATH);$($env:PATH)"
# Predownload cassandra version for CCM if it isn't already downloaded.
If (!(Test-Path C:\Users\appveyor\.ccm\repository\$env:cassandra_version)) {
Write-Host "Preinstalling C* $($env:cassandra_version)"
Start-Process python -ArgumentList "$($env:CCM_PATH)\ccm.py create -v $($env:cassandra_version) -n 1 predownload" -Wait -nnw
Start-Process python -ArgumentList "$($env:CCM_PATH)\ccm.py remove predownload" -Wait -nnw
}