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