-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild.ps1
More file actions
106 lines (84 loc) · 2.64 KB
/
Copy pathBuild.ps1
File metadata and controls
106 lines (84 loc) · 2.64 KB
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
#!/usr/bin/env powershell -File
param(
[string] $platform,
[string] $configuration,
[switch] $clean,
[switch] $run
)
$projectname = "Wetzikon"
$displayname = "Scrolliris Desktop for Windows"
$packagename = "Scrolliris.Desktop.Windows"
$log = "Trace"
$version = "0.0.1.0"
# NOTE
#
# ```powershell
# > powershell.exe -ExecutionPolicy Bypass -File .\Build.ps1 `
# -Platform "x64" -Configuration "Debug" -Run
# ```
if ($platform -ne "x86" -and $platform -ne "x64" -and $platform -ne "ARM") {
Write-Host "Unknown platform: ${platform}"
exit 1
}
if ($configuration -ne "Debug" -and $configuration -ne "Release") {
Write-Host "Unknown configuration: ${configuration}"
exit 1
}
Write-Host
Write-Host "Configuration: $configuration"
Write-Host "Platform: $platform"
Write-Host "Log: $log"
Write-Host "Clean: $clean"
Write-Host "Run: $run"
Write-Host
taskkill /im 'MSBuild.exe' /f
taskkill /im "${displayname}.exe" /f
$currentDir = (Get-Item ".\").FullName
$packageDir = "${currentDir}\${projectname}" + `
"\AppPackages\${projectname}_${version}_${configuration}_Test"
$scriptPath = "${packageDir}\Add-AppDevPackage.ps1"
# Clean (resources and cache etc.)
if ($clean) {
wsl rm -f `
"${projectname}/{bin,obj}/${platform}/${configuration}/${displayname}.exe"
wsl rm -fr "${projectname}/{bin,obj}/${platform}/${configuration}/*"
wsl rm -fr "${packageDir}/*"
Remove-Item "${packageDir}" -Recurse -Force
MSBuild.exe .\"${projectname}"\"${projectname}".csproj /t:Clean
MSBuild.exe .\"${projectname}"\"${projectname}".csproj /t:Restore
}
# Build
MSBuild.exe .\"${projectname}"\"${projectname}".csproj /t:Build `
/p:Configuration="${configuration}" `
/p:Platform="${platform}" `
/p:Log="${log}" `
/p:AppxBundle=Always `
/p:AppxBundlePlatforms="${platform}" `
/p:UapAppxPackageBuildMode=StoreUpload
if ($lastexitcode -ne 0) {
Write-Host
Write-Host "Build faild with status: ${lastexitcode}"
exit
}
# Register
Write-Host ""
Get-AppXPackage | findstr /i "${packagename}$" | Out-Null
if ($lastexitcode -eq 0) {
Get-AppXPackage -Name "${packagename}" | Remove-AppxPackage
}
# https://docs.microsoft.com/en-us/previous-versions/windows/apps/hh454036(v=vs.140)#sideload-your-app-package
PowerShell.exe -ExecutionPolicy ByPass -Command `
"& ${scriptPath} -Force"
Write-Host ""
Get-AppXPackage | findstr /i "${packagename}$" | Out-Null
if ($lastexitcode -ne 0) {
Write-Host
Write-Host "Registration faild with status: ${lastexitcode}"
exit
}
# Run
if ($run) {
Write-Host "Application '${displayname}' is starting..."
explorer.exe shell:AppsFolder\$(Get-AppXPackage -name "$packagename" | `
select -expandproperty PackageFamilyName)!App
}