-
Notifications
You must be signed in to change notification settings - Fork 0
/
dependence.ps1
106 lines (94 loc) · 3.68 KB
/
dependence.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
98
99
100
101
102
103
104
105
106
param($type,$sourceDir)
$buildtype=""
$pwdPath=Get-Location
Write-Output "source dir: $sourceDir"
Write-Output "build dir: $pwdPath"
$exePath="$pwdPath/DesktopManager/$buildtype/"
Add-Type -AssemblyName PresentationFramework
# line 7 line 8 please enter your Qt environment
$path1="C:\Qt\Qt5.14.2\5.14.2\mingw13_64\bin"
$path2="C:\Qt\Qt5.14.2\Tools\mingw1310_64\bin"
$env:path+="$path2;$path2"
if(!(Test-Path -Path $path1) -and !(Test-Path -Path $path2)){
[System.Windows.MessageBox]::Show('please check Qt evn is right')
return -1
}
if($type -eq "debug"){
$buildtype="debug"
}
elseif($type -eq "release"){
$buildtype="release"
}
elseif($type -eq "profile"){
$buildtype="release"
}
# define what plugin do you have and what type they are
$AssistantPlugins=@("EverythingPlugin","ProgramsPlugin")
$WallpaperPlugins=@("BaseWallPaperPlugin")
$PendantPlugins=@("MonitorPlugin")
$allTypePlugins=@{AssistantPlugins = $AssistantPlugins;WallpaperPlugins = $WallpaperPlugins;PendantPlugins = $PendantPlugins}
Write-Output "coping plugins..."
foreach ($pluginType in $allTypePlugins.Keys){
foreach($pluginName in $($allTypePlugins[$pluginType])){
$dependenceShPath = "$sourceDir/$pluginType/$pluginName/dependence.ps1"
if(Test-Path -Path $dependenceShPath){
$exePath="$pwdPath/DesktopManager/$buildtype/"
invoke-expression -Command "$dependenceShPath $buildtype $sourceDir"
}
$dllPath="$pwdPath/$pluginType/$pluginName/$buildtype/*.dll"
$exePath="$pwdPath/$pluginType/$pluginName/$buildtype/*.exe"
$debugPath="$pwdPath/DesktopManager/$pluginType/$pluginName"
if (-Not (Test-Path -Path $debugPath)) {
New-Item -Path $debugPath -ItemType Directory
}
Copy-Item -Path $dllPath $debugPath -Recurse -Force
Copy-Item -Path $exePath $debugPath -Recurse -Force
if($buildtype -eq "release"){
$buildPath="$pwdPath/DesktopManager/$buildtype/$pluginType/$pluginName"
if (-Not (Test-Path -Path $buildPath)) {
New-Item -Path $buildPath -ItemType Directory
}
Copy-Item -Path $dllPath $buildPath -Recurse -Force
Copy-Item -Path $exePath $buildPath -Recurse -Force
}
Write-Output "finished $pluginName"
}
}
Write-Output "copy finished "
Write-Output "coping settings..."
if($buildtype -eq "release"){
$settingsPath="$sourceDir/setting.ini"
$exePath="$pwdPath/DesktopManager/$buildtype/"
Copy-Item -Path $settingsPath $exePath -Recurse -Force
}
Write-Output "copy finished "
Write-Output "coping hook..."
#because it use exe Relative paths to inject hook so it just copy to exe path
$hookPath = "$sourceDir/MinHookDllDemo/MinHookDllDemo.dll"
$exePath="$pwdPath/DesktopManager/$buildtype/"
Copy-Item -Path $hookPath $exePath -Recurse -Force
Write-Output "copy finished "
Write-Output "create some dir"
$thumbnailDir = "$pwdPath/DesktopManager/thumbnail"
if (-Not (Test-Path -Path $thumbnailDir)) {
New-Item -Path $thumbnailDir -ItemType Directory
}
if($buildtype -eq "release"){
$thumbnailDir="$pwdPath/DesktopManager/$buildtype/thumbnail"
New-Item -Path $thumbnailDir -ItemType Directory
}
Write-Output "create finished "
windeployqt $pwdPath/DesktopManager/$buildtype
Write-Output "copy Qt plugins"
$QtPluginPath = "$path1/../plugins"
Copy-Item -Path $QtPluginPath $exePath -Recurse -Force
$QtQmlPath = "$path1/../qml"
Copy-Item -Path $QtQmlPath $exePath -Recurse -Force
Write-Output "copy finished "
if($buildtype -eq "release"){
Write-Output "cleaning....."
remove-item "$exePath/*.o"
remove-item "$exePath/*.cpp"
remove-item "$exePath/*.h"
Write-Output "cleaned"
}