forked from telegramdesktop/dependencies_windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleanup.bat
134 lines (111 loc) · 5.57 KB
/
cleanup.bat
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
133
134
@echo off
:: This script should be executed after build the dependencies.
:: It removes all files, which are not necessary for building TDesktop.
call:deleteSourceFiles
call:deleteProjectFiles
call:deleteScripts
call:deleteLogFiles
call:deleteImages
call:deleteDocumentation
call:deleteOther
GOTO:EOF
:: FUNCTIONS
:logInfo
echo [INFO] %~1
GOTO:EOF
:deleteSourceFiles
call:logInfo "Deleting source files"
PowerShell Remove-Item .\*\* -include *.cpp -force -recurse
PowerShell Remove-Item .\*\* -include *.c -force -recurse
PowerShell Remove-Item .\*\* -include *.cc -force -recurse
PowerShell Remove-Item .\*\* -include *.cs -force -recurse
PowerShell Remove-Item .\*\* -include *.asm -force -recurse
PowerShell Remove-Item .\*\* -include *.S -force -recurse
PowerShell Remove-Item .\*\* -include *.v -force -recurse
PowerShell Remove-Item .\*\* -include *.java -force -recurse
PowerShell Remove-Item .\*\* -include *.pl -force -recurse
PowerShell Remove-Item .\*\* -include *.m -force -recurse
PowerShell Remove-Item .\*\* -include *.o -force -recurse
PowerShell Remove-Item .\*\* -include *.d -force -recurse
PowerShell Remove-Item .\*\* -include *.py -force -recurse
PowerShell Remove-Item .\*\* -include *.pyc -force -recurse
PowerShell Remove-Item .\*\* -include *.pyo -force -recurse
PowerShell Remove-Item .\*\* -include *.pyd -force -recurse
GOTO:EOF
:deleteProjectFiles
call:logInfo "Deleting solution and project files"
PowerShell Remove-Item .\*\* -include *.mk -force -recurse
PowerShell Remove-Item .\*\* -include *.sln -force -recurse
PowerShell Remove-Item .\*\* -include *.vcproj -force -recurse
PowerShell Remove-Item .\*\* -include *.vcxproj -force -recurse
PowerShell Remove-Item .\*\* -include *.gyp -force -recurse
PowerShell Remove-Item .\*\* -include *.pro -force -recurse
GOTO:EOF
:deleteScripts
call:logInfo "Deleting scripts"
::keep ninja/ninja.exe, qt5_6_2\qtbase\bin\moc.exe, qt5_6_2\qtbase\bin\rcc.exe
rename .\ninja\ninja.exe ninja.KEEP_ME
rename .\qt5_6_2\qtbase\bin\moc.exe moc.KEEP_ME
rename .\qt5_6_2\qtbase\bin\rcc.exe rcc.KEEP_ME
PowerShell Remove-Item .\*\* -include *.exe -force -recurse
rename .\ninja\ninja.KEEP_ME ninja.exe
rename .\qt5_6_2\qtbase\bin\moc.KEEP_ME moc.exe
rename .\qt5_6_2\qtbase\bin\rcc.KEEP_ME rcc.exe
PowerShell Remove-Item .\*\* -include *.sh -force -recurse
PowerShell Remove-Item .\*\* -include *.ps1 -force -recurse
PowerShell Remove-Item .\*\* -include *.bat -force -recurse
PowerShell Remove-Item .\*\* -include *.dll -force -recurse
GOTO:EOF
:deleteLogFiles
call:logInfo "Deleting log files"
PowerShell Remove-Item .\*\* -include *.log -force -recurse
PowerShell Remove-Item .\*\* -include *.tlog -force -recurse
GOTO:EOF
:deleteImages
call:logInfo "Deleting images"
PowerShell Remove-Item .\*\* -include *.jpg -force -recurse
PowerShell Remove-Item .\*\* -include *.jpeg -force -recurse
PowerShell Remove-Item .\*\* -include *.png -force -recurse
PowerShell Remove-Item .\*\* -include *.bmp -force -recurse
PowerShell Remove-Item .\*\* -include *.gif -force -recurse
PowerShell Remove-Item .\*\* -include *.tif -force -recurse
PowerShell Remove-Item .\*\* -include *.tiff -force -recurse
PowerShell Remove-Item .\*\* -include *.svg -force -recurse
GOTO:EOF
:deleteDocumentation
call:logInfo "Deleting documentation"
PowerShell Remove-Item .\*\* -include *.md -force -recurse
PowerShell Remove-Item .\*\* -include *.qdoc -force -recurse
PowerShell Remove-Item .\*\* -include *.qdocconf -force -recurse
PowerShell Remove-Item .\*\* -include *.qdocinc -force -recurse
PowerShell Remove-Item .\*\* -include *.txt -force -recurse
GOTO:EOF
:deleteOther
call:logInfo "Deleting other files"
PowerShell -command "& { Get-ChildItem *.obj -File -Recurse | Foreach-Object {Remove-Item $_.FullName} }"
PowerShell Remove-Item .\*\* -include *.js -force -recurse
PowerShell Remove-Item .\*\* -include *.css -force -recurse
PowerShell Remove-Item .\*\* -include *.htm -force -recurse
PowerShell Remove-Item .\*\* -include *.html -force -recurse
PowerShell Remove-Item .\*\* -include *.ttf -force -recurse
PowerShell Remove-Item .\*\* -include *.eot -force -recurse
PowerShell Remove-Item .\*\* -include *.woff -force -recurse
PowerShell Remove-Item .\*\* -include *.xml -force -recurse
PowerShell Remove-Item .\*\* -include *.xsl -force -recurse
PowerShell Remove-Item .\*\* -include *.mo -force -recurse
PowerShell Remove-Item .\*\* -include *.po -force -recurse
PowerShell Remove-Item .\*\* -include *.m4 -force -recurse
PowerShell Remove-Item .\*\* -include *.gitignore -force -recurse
PowerShell Remove-Item .\*\* -include *.tmp -force -recurse
PowerShell Remove-Item .\*\* -include *.cache -force -recurse
PowerShell Remove-Item .\*\* -include *.test -force -recurse
PowerShell Remove-Item .\*\* -include *.conf -force -recurse
:: Remove git folders
IF EXIST .git (
PowerShell Rename-Item '.git' '.KEEP_ME' -Force
)
PowerShell "Get-ChildItem -path . -Include '.git' -Recurse -force | Remove-Item -force -Recurse"
IF EXIST .KEEP_ME (
PowerShell Rename-Item '.KEEP_ME' '.git' -Force
)
GOTO:EOF