This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.bat
executable file
·107 lines (93 loc) · 4.34 KB
/
build.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
@echo off
set _KEY="DistroLauncher-Appx\DistroLauncher-Appx_TemporaryKey"
set VERSION=2004.2020.415.0
rem Add path to MSBuild Binaries
set MSBUILD=()
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe" (
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\MSBuild\14.0\bin" (
set MSBUILD="%ProgramFiles(x86)%\MSBuild\14.0\bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles%\MSBuild\14.0\bin" (
set MSBUILD="%ProgramFiles%\MSBuild\14.0\bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" (
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if %MSBUILD%==() (
echo "I couldn't find MSBuild on your PC. Make sure it's installed somewhere, and if it's not in the above if statements (in build.bat), add it."
goto :EXIT
)
:FOUND_MSBUILD
set _MSBUILD_TARGET=Build
set _MSBUILD_CONFIG=Debug
if not exist "%_KEY%".pfx (
echo "Generating some test certs/keys to test sideloading with."
echo "This is going to prompt you for a name and password, and then that password again, and then the password again."
echo "You can enter whatever you want, these should only be used for local testing."
@rem Creates keys for local testing.
@rem Note that "CN=%_OWNER%" needs to match the Publisher in your appxmanifest
makecert -r -h 0 -n "CN=23596F84-C3EA-4CD8-A7DF-550DCE37BCD0" -eku "1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13" -pe -sv %_KEY%.pvk %_KEY%.cer
pvk2pfx -pvk %_KEY%.pvk -spc %_KEY%.cer -pfx %_KEY%.pfx
echo "You will need to install that cert before you can sideload the appx. "
echo "You can install it with the following command (in an admin window)"
echo
echo CertMgr /add %_KEY%.cer /s /r localMachine root
)
:ARGS_LOOP
if (%1) == () goto :POST_ARGS_LOOP
if (%1) == (clean) (
set _MSBUILD_TARGET=Clean,Build
)
if (%1) == (rel) (
set _MSBUILD_CONFIG=Release
)
shift
goto :ARGS_LOOP
:POST_ARGS_LOOP
mkdir DistroLauncher-Appx\x64
powershell -File DistroLauncher-Appx/create_appxmainfest.ps1 DistroLauncher-Appx/MyDistro.appxmanifest %VERSION% x64 DistroLauncher-Appx/x64/Ubuntu.appxmanifest
%MSBUILD% %~dp0\DistroLauncher.sln /t:%_MSBUILD_TARGET% /m /nr:true /p:Configuration=%_MSBUILD_CONFIG%;Platform=x64
if (%ERRORLEVEL%) == (0) (
echo.
echo Created appx in %~dp0x64\%_MSBUILD_CONFIG%\Ubuntu\
echo.
)
mkdir DistroLauncher-Appx\ARM64
powershell -File DistroLauncher-Appx/create_appxmainfest.ps1 DistroLauncher-Appx/MyDistro.appxmanifest %VERSION% arm64 DistroLauncher-Appx/ARM64/Ubuntu.appxmanifest
%MSBUILD% %~dp0\DistroLauncher.sln /t:%_MSBUILD_TARGET% /m /nr:true /p:Configuration=%_MSBUILD_CONFIG%;Platform=ARM64
if (%ERRORLEVEL%) == (0) (
echo.
echo Created appx in %~dp0arm64\%_MSBUILD_CONFIG%\Ubuntu\
echo.
)
:EXIT