-
Notifications
You must be signed in to change notification settings - Fork 12
/
.build.ps1
60 lines (48 loc) · 3.41 KB
/
.build.ps1
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
Task 'Build' Selenium, { }
Task 'Selenium' {
if (Test-Path ./src/lib) {
Remove-Item -Path ./src/lib/WebDriver -Force -Recurse -ErrorAction Ignore | Out-Null
Remove-Item -Path ./src/lib/Browsers/*/chromedriver* -Force -Recurse -ErrorAction Stop | Out-Null
Remove-Item -Path ./src/lib/Browsers/*/geckodriver* -Force -Recurse -ErrorAction Stop | Out-Null
Remove-Item -Path ./src/lib/Browsers/*/IEDriverServer* -Force -Recurse -ErrorAction Stop | Out-Null
}
if (Test-Path ./temp) {
Remove-Item -Path ./temp -Force -Recurse -ErrorAction Stop | Out-Null
}
$packages = @{
'Selenium.WebDriver' = '3.141.0'
'Selenium.Support' = '3.141.0'
'Selenium.WebDriver.ChromeDriver' = '85.0.4183.8300'
'Selenium.WebDriver.IEDriver' = '3.150.1.2'
'Selenium.WebDriver.GeckoDriver' = '0.27.0'
}
$packages.Keys | ForEach-Object {
nuget install $_ -source nuget.org -version $packages[$_] -outputdirectory ./temp | Out-Null
}
# web drivers
New-Item -Path ./src/lib/WebDriver -ItemType Directory -Force | Out-Null
Copy-Item -Path "./temp/Selenium.WebDriver.$($packages['Selenium.WebDriver'])/lib/*" -Destination ./src/lib/WebDriver -Recurse -Force | Out-Null
Copy-Item -Path "./temp/Selenium.Support.$($packages['Selenium.Support'])/lib/*" -Destination ./src/lib/WebDriver -Recurse -Force | Out-Null
Remove-Item -Path ./src/lib/WebDriver/net20 -Force -Recurse -ErrorAction Ignore | Out-Null
Remove-Item -Path ./src/lib/WebDriver/net35 -Force -Recurse -ErrorAction Ignore | Out-Null
Remove-Item -Path ./src/lib/WebDriver/net40 -Force -Recurse -ErrorAction Ignore | Out-Null
# browsers
New-Item -Path ./src/lib/Browsers -ItemType Directory -Force | Out-Null
New-Item -Path ./src/lib/Browsers/win -ItemType Directory -Force | Out-Null
New-Item -Path ./src/lib/Browsers/linux -ItemType Directory -Force | Out-Null
New-Item -Path ./src/lib/Browsers/mac -ItemType Directory -Force | Out-Null
# win
Copy-Item -Path "./temp/Selenium.WebDriver.IEDriver.$($packages['Selenium.WebDriver.IEDriver'])/driver/*" -Destination ./src/lib/Browsers/win/ -Recurse -Force | Out-Null
Copy-Item -Path "./temp/Selenium.WebDriver.GeckoDriver.$($packages['Selenium.WebDriver.GeckoDriver'])/driver/win64/*" -Destination ./src/lib/Browsers/win/ -Recurse -Force | Out-Null
Copy-Item -Path "./temp/Selenium.WebDriver.ChromeDriver.$($packages['Selenium.WebDriver.ChromeDriver'])/driver/win32/*" -Destination ./src/lib/Browsers/win/ -Recurse -Force | Out-Null
# linux
Copy-Item -Path "./temp/Selenium.WebDriver.GeckoDriver.$($packages['Selenium.WebDriver.GeckoDriver'])/driver/linux64/*" -Destination ./src/lib/Browsers/linux/ -Recurse -Force | Out-Null
Copy-Item -Path "./temp/Selenium.WebDriver.ChromeDriver.$($packages['Selenium.WebDriver.ChromeDriver'])/driver/linux64/*" -Destination ./src/lib/Browsers/linux/ -Recurse -Force | Out-Null
# mac
Copy-Item -Path "./temp/Selenium.WebDriver.GeckoDriver.$($packages['Selenium.WebDriver.GeckoDriver'])/driver/mac64/*" -Destination ./src/lib/Browsers/mac/ -Recurse -Force | Out-Null
Copy-Item -Path "./temp/Selenium.WebDriver.ChromeDriver.$($packages['Selenium.WebDriver.ChromeDriver'])/driver/mac64/*" -Destination ./src/lib/Browsers/mac/ -Recurse -Force | Out-Null
# clean up temp
if (Test-Path ./temp) {
Remove-Item -Path ./temp -Force -Recurse | Out-Null
}
}