Elffuss BraidHub

kikocis/java-driver public

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