You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.7 KiB

  1. @echo off
  2. setlocal EnableExtensions DisableDelayedExpansion
  3. set VERSION=3.14
  4. del /q *.appx >NUL 2>&1
  5. del /q *.appxbundle >NUL 2>&1
  6. del /q *.map >NUL 2>&1
  7. set WDK_PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64
  8. set MSBUILD_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
  9. set MANIFEST=AppxManifest.xml
  10. set ARCHS=x86 x64 arm arm64
  11. rem if you don't set the temp/tmp you get:
  12. rem error MSB6001: Invalid command line switch for "CL.exe". System.ArgumentExcep Key being added: 'TEMP'
  13. set temp=
  14. set tmp=
  15. cd /d "%~dp0"
  16. setlocal EnableDelayedExpansion
  17. set FILES_TO_SIGN=
  18. for %%a in (%ARCHS%) do (
  19. echo [Building %%a]
  20. "%MSBUILD_PATH%\MSBuild" ..\..\rufus.sln /m /nologo /verbosity:minimal /t:Clean,Build /p:Configuration=Release,Platform=%%a
  21. if ERRORLEVEL 1 goto out
  22. echo.
  23. set FILES_TO_SIGN=!FILES_TO_SIGN! "..\..\%%a\Release\rufus.exe"
  24. )
  25. "%WDK_PATH%\SignTool" sign /v /sha1 9ce9a71ccab3b38a74781b975f1c228222cf7d3b /fd SHA256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp %FILES_TO_SIGN%
  26. if ERRORLEVEL 1 goto out
  27. endlocal
  28. echo [Files]> bundle.map
  29. for %%a in (%ARCHS%) do (
  30. echo Creating %%a appx...
  31. cd /d "%~dp0"
  32. echo "Rufus-%%a.appx" "Rufus-%%a.appx">> bundle.map
  33. mkdir %%a >NUL 2>&1
  34. copy %MANIFEST% %%a\%MANIFEST% >NUL 2>&1
  35. cd %%a
  36. for /f "delims=" %%i in ('type %MANIFEST% ^& break ^> %MANIFEST%') do (
  37. set "line=%%i"
  38. setlocal EnableDelayedExpansion
  39. >>%MANIFEST% echo(!line:@ARCH@=%%a!
  40. endlocal
  41. )
  42. mkdir Assets >NUL 2>&1
  43. copy "..\..\icons\rufus-44.png" "Assets\Square44x44Logo.png" >NUL 2>&1
  44. copy "..\..\icons\rufus-48.png" "Assets\Square44x44Logo.targetsize-48.png" >NUL 2>&1
  45. copy "..\..\icons\rufus-48.png" "Assets\Square44x44Logo.targetsize-48_altform-unplated.png" >NUL 2>&1
  46. copy "..\..\icons\rufus-150.png" "Assets\Square150x150Logo.png" >NUL 2>&1
  47. copy "..\..\..\%%a\Release\rufus.exe" "rufus.exe" >NUL 2>&1
  48. "%WDK_PATH%\MakePri" createconfig /o /dq en-US /cf priconfig.xml
  49. "%WDK_PATH%\MakePri" new /o /pr . /cf priconfig.xml
  50. "%WDK_PATH%\MakeAppx" pack /o /d . /p ../Rufus-%%a.appx
  51. if ERRORLEVEL 1 goto out
  52. )
  53. cd /d "%~dp0"
  54. "%WDK_PATH%\SignTool" sign /v /sha1 9ce9a71ccab3b38a74781b975f1c228222cf7d3b /fd SHA256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp *.appx
  55. if ERRORLEVEL 1 goto out
  56. "%WDK_PATH%\MakeAppx" bundle /f bundle.map /p Rufus-%VERSION%.appxbundle
  57. "%WDK_PATH%\SignTool" sign /v /sha1 9ce9a71ccab3b38a74781b975f1c228222cf7d3b /fd SHA256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp Rufus-%VERSION%.appxbundle
  58. :out
  59. cd /d "%~dp0"
  60. for %%a in (%ARCHS%) do (
  61. rd /S /Q %%a >NUL 2>&1
  62. )
  63. del /q *.map >NUL 2>&1
  64. del /q *.appx >NUL 2>&1
  65. rename *.appxbundle *.appx >NUL 2>&1
  66. pause
  67. exit