forked from qtproject/installer-framework
-
Notifications
You must be signed in to change notification settings - Fork 5
/
clean.ps1
97 lines (78 loc) · 2.7 KB
/
clean.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
88
89
90
91
92
93
94
95
96
97
param
(
[switch]$SkipBuildDir,
[switch]$DeepClean,
[switch]$Verbose
)
if ($Verbose) {
$DebugPreference = 'Continue'
}
function RemoveDir ($dir) {
if (Test-Path "$PSScriptRoot\$dir") {
Remove-Item "$PSScriptRoot\$dir" -Force -Recurse
Write-Debug " -> d: $dir"
}
}
function RemoveFile ($file) {
if (Test-Path "$PSScriptRoot\$file") {
Remove-Item "$PSScriptRoot\$file" -Force
Write-Debug " -> f: $file"
}
}
Write-Debug "Cleanup starting"
Write-Debug "Removing the following (f)iles and (d)irectories:"
if (!$SkipBuildDir) { RemoveDir "build" }
RemoveDir "bin"
$baseFiles = ".qmake.stash",
"src\libs\7zip\mocinclude.opt",
"src\libs\installer\mocinclude.opt",
"src\sdk\installerbase.qrc",
"src\sdk\mocinclude.opt",
"src\sdk\translations\ifw_en.ts",
"tools\archivegen\mocinclude.opt",
"tools\binarycreator\mocinclude.opt",
"tools\devtool\mocinclude.opt",
"tools\repocompare\mocinclude.opt",
"tools\repogen\mocinclude.opt"
foreach ($file in $baseFiles) {
RemoveFile $file
}
# Remove the built translation files
Get-ChildItem -Path "$PSScriptRoot\src\sdk\translations" *.qm | ForEach-Object { Remove-Item -Path $_.FullName -Force }
if ($DeepClean) {
Write-Debug "---"
Write-Debug "Removing additional (f)iles and (d)irectories since -DeepClean was provided:"
$sources = "libs\7zip", "libs\installer", "sdk", "sdk\translations"
$tools = "archivegen", "binarycreator", "devtool", "repocompare", "repogen"
$alldirs = @{ "src" = $sources; "tools" = $tools }
foreach ($pair in $alldirs.GetEnumerator()) {
RemoveFile "$($pair.Name)\Makefile"
foreach ($subDir in ($pair.Value)) {
# Dirs
RemoveDir "$($pair.Name)\$subDir\debug"
RemoveDir "$($pair.Name)\$subDir\release"
# Files
RemoveFile "$($pair.Name)\$subDir\Makefile"
RemoveFile "$($pair.Name)\$subDir\Makefile.Debug"
RemoveFile "$($pair.Name)\$subDir\Makefile.Release"
if (($pair.Name) -eq "tools") {
RemoveFile "$($pair.Name)\$tool\${tool}_plugin_import.cpp"
}
}
}
RemoveDir "lib"
$additionalFiles = "src\libs\Makefile",
"Makefile",
"src\libs\installer\ui_authenticationdialog.h",
"src\libs\installer\ui_proxycredentialsdialog.h",
"src\libs\installer\ui_serverauthenticationdialog.h",
"src\sdk\installerbase_plugin_import.cpp",
"src\sdk\ui_settingsdialog.h",
"tools\repocompare\ui_mainwindow.h"
foreach ($file in $additionalFiles) {
RemoveFile $file
}
}
Write-Debug "---"
Write-Debug "Cleanup completed"
$DebugPreference = 'SilentlyContinue'