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