forked from FlaUI/FlaUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateArtefacts.ps1
87 lines (76 loc) · 4.03 KB
/
CreateArtefacts.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
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
$artefactDir = "Artefacts"
$tempDir = "Temp"
$version = "1.2.0"
$rootPath = "."
function Main {
if (Test-Path $artefactDir) {
rd $artefactDir -Recurse | Out-Null
}
md -Name $artefactDir | Out-Null
if (Test-Path $tempDir) {
rd $tempDir -Recurse | Out-Null
}
md -Name $tempDir | Out-Null
# FlaUI.Core
$coreDir = Join-Path $tempDir "FlaUI.Core"
$coren45Dir = Join-Path $coreDir net45
$coren40Dir = Join-Path $coreDir net40
$coren35Dir = Join-Path $coreDir net35
md -Name $coreDir | Out-Null
md -Name $coren45Dir | Out-Null
md -Name $coren40Dir | Out-Null
md -Name $coren35Dir | Out-Null
Get-ChildItem $rootPath\src\FlaUI.Core\bin\net-4.5 | Where-Object { !$_.PSIsContainer } | Copy-Item -Destination $coren45Dir
Get-ChildItem $rootPath\src\FlaUI.Core\bin\net-4.0 | Where-Object { !$_.PSIsContainer } | Copy-Item -Destination $coren40Dir
Get-ChildItem $rootPath\src\FlaUI.Core\bin\net-3.5 | Where-Object { !$_.PSIsContainer } | Copy-Item -Destination $coren35Dir
Get-ChildItem $coreDir -Include *.pdb,*.vshost.*,*RANDOM_SEED* -Recurse | Remove-Item
Deploy-License $coreDir
# FlaUI.UIA2
$uia2Dir = Join-Path $tempDir "FlaUI.UIA2"
$uia2n45Dir = Join-Path $uia2Dir net45
$uia2n40Dir = Join-Path $uia2Dir net40
$uia2n35Dir = Join-Path $uia2Dir net35
md -Name $uia2Dir | Out-Null
md -Name $uia2n45Dir | Out-Null
md -Name $uia2n40Dir | Out-Null
md -Name $uia2n35Dir | Out-Null
Get-ChildItem $rootPath\src\FlaUI.UIA2\bin\net-4.5 | Where-Object { !$_.PSIsContainer } | Copy-Item -Destination $uia2n45Dir
Get-ChildItem $rootPath\src\FlaUI.UIA2\bin\net-4.0 | Where-Object { !$_.PSIsContainer } | Copy-Item -Destination $uia2n40Dir
Get-ChildItem $rootPath\src\FlaUI.UIA2\bin\net-3.5 | Where-Object { !$_.PSIsContainer } | Copy-Item -Destination $uia2n35Dir
Get-ChildItem $uia2Dir -Include *.pdb,*.vshost.*,*RANDOM_SEED* -Recurse | Remove-Item
Deploy-License $uia2Dir
# FlaUI.UIA3
$uia3Dir = Join-Path $tempDir "FlaUI.UIA3"
$uia3n45Dir = Join-Path $uia3Dir net45
$uia3n40Dir = Join-Path $uia3Dir net40
$uia3n35Dir = Join-Path $uia3Dir net35
md -Name $uia3Dir | Out-Null
md -Name $uia3n45Dir | Out-Null
md -Name $uia3n40Dir | Out-Null
md -Name $uia3n35Dir | Out-Null
Get-ChildItem $rootPath\src\FlaUI.UIA3\bin\net-4.5 | Where-Object { !$_.PSIsContainer } | Copy-Item -Destination $uia3n45Dir
Get-ChildItem $rootPath\src\FlaUI.UIA3\bin\net-4.0 | Where-Object { !$_.PSIsContainer } | Copy-Item -Destination $uia3n40Dir
Get-ChildItem $rootPath\src\FlaUI.UIA3\bin\net-3.5 | Where-Object { !$_.PSIsContainer } | Copy-Item -Destination $uia3n35Dir
Get-ChildItem $uia3Dir -Include *.pdb,*.vshost.*,*RANDOM_SEED* -Recurse | Remove-Item
Deploy-License $uia3Dir
# Create Zips
[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null
$compression = [System.IO.Compression.CompressionLevel]::Optimal
$includeBaseDirectory = $false
[System.IO.Compression.ZipFile]::CreateFromDirectory($coreDir, (Join-Path $artefactDir "FlaUI.Core-$version.zip"), $compression, $includeBaseDirectory)
[System.IO.Compression.ZipFile]::CreateFromDirectory($uia2Dir, (Join-Path $artefactDir "FlaUI.UIA2-$version.zip"), $compression, $includeBaseDirectory)
[System.IO.Compression.ZipFile]::CreateFromDirectory($uia3Dir, (Join-Path $artefactDir "FlaUI.UIA3-$version.zip"), $compression, $includeBaseDirectory)
Create-Packages
# Cleanup
rd $tempDir -Recurse
}
function Deploy-License($dest) {
Copy-Item -Path $rootPath\CHANGELOG.md -Destination $dest
Copy-Item -Path $rootPath\LICENSE.txt -Destination $dest
}
function Create-Packages() {
nuget pack "$rootPath\nuspec\FlaUI.Core.nuspec" -OutputDirectory $artefactDir -properties version=$version
nuget pack "$rootPath\nuspec\FlaUI.UIA2.nuspec" -OutputDirectory $artefactDir -properties version=$version
nuget pack "$rootPath\nuspec\FlaUI.UIA3.nuspec" -OutputDirectory $artefactDir -properties version=$version
}
Main