appveyor.bat 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. echo on
  2. SetLocal EnableDelayedExpansion
  3. REM This is the recommended way to choose the toolchain version, according to
  4. REM Appveyor's documentation.
  5. SET PATH=C:\Program Files (x86)\MSBuild\%TOOLCHAIN_VERSION%\Bin;%PATH%
  6. set VCVARSALL="C:\Program Files (x86)\Microsoft Visual Studio %TOOLCHAIN_VERSION%\VC\vcvarsall.bat"
  7. if [%Platform%] NEQ [x64] goto win32
  8. set TARGET_ARCH=x86_64
  9. set TARGET_PROGRAM_FILES=%ProgramFiles%
  10. call %VCVARSALL% amd64
  11. if %ERRORLEVEL% NEQ 0 exit 1
  12. goto download
  13. :win32
  14. echo on
  15. if [%Platform%] NEQ [Win32] exit 1
  16. set TARGET_ARCH=i686
  17. set TARGET_PROGRAM_FILES=%ProgramFiles(x86)%
  18. call %VCVARSALL% amd64_x86
  19. if %ERRORLEVEL% NEQ 0 exit 1
  20. goto download
  21. :download
  22. REM vcvarsall turns echo off
  23. echo on
  24. mkdir windows_build_tools
  25. mkdir windows_build_tools\
  26. echo Downloading Yasm...
  27. powershell -Command "(New-Object Net.WebClient).DownloadFile('http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win64.exe', 'windows_build_tools\yasm.exe')"
  28. if %ERRORLEVEL% NEQ 0 (
  29. echo ...downloading Yasm failed.
  30. exit 1
  31. )
  32. set RUST_URL=https://static.rust-lang.org/dist/rust-%RUST%-%TARGET_ARCH%-pc-windows-msvc.msi
  33. echo Downloading %RUST_URL%...
  34. mkdir build
  35. powershell -Command "(New-Object Net.WebClient).DownloadFile('%RUST_URL%', 'build\rust-%RUST%-%TARGET_ARCH%-pc-windows-msvc.msi')"
  36. if %ERRORLEVEL% NEQ 0 (
  37. echo ...downloading Rust failed.
  38. exit 1
  39. )
  40. start /wait msiexec /i build\rust-%RUST%-%TARGET_ARCH%-pc-windows-msvc.msi INSTALLDIR="%TARGET_PROGRAM_FILES%\Rust %RUST%" /quiet /qn /norestart
  41. if %ERRORLEVEL% NEQ 0 exit 1
  42. set PATH="%TARGET_PROGRAM_FILES%\Rust %RUST%\bin";%cd%\windows_build_tools;%PATH%
  43. if [%Configuration%] == [Release] set CARGO_MODE=--release
  44. set
  45. link /?
  46. cl /?
  47. rustc --version
  48. cargo --version
  49. cargo test --all-features -vv %CARGO_MODE%
  50. if %ERRORLEVEL% NEQ 0 exit 1
  51. REM Verify that `cargo build`, independent from `cargo test`, works; i.e.
  52. REM verify that non-test builds aren't trying to use test-only features.
  53. cargo build -vv %CARGO_MODE%
  54. if %ERRORLEVEL% NEQ 0 exit 1
  55. REM Verify that we can build with all features
  56. cargo build --all-features -vv %CARGO_MODE%
  57. if %ERRORLEVEL% NEQ 0 exit 1