1 @if not defined _echo @echo off
4 set __ThisScriptShort=%0
5 set __ThisScriptFull=%~f0
6 set __ThisScriptPath=%~dp0
8 REM =========================================================================================
10 REM === Parse arguments
12 REM =========================================================================================
18 if "%1" == "" goto ArgsDone
20 if /i "%1" == "/?" goto Usage
21 if /i "%1" == "-?" goto Usage
22 if /i "%1" == "/h" goto Usage
23 if /i "%1" == "-h" goto Usage
24 if /i "%1" == "/help" goto Usage
25 if /i "%1" == "-help" goto Usage
27 if /i "%1" == "/arch" (set __Arch=%2&shift&shift&goto Arg_Loop)
28 if /i "%1" == "/outputdir" (set __OutputDir=%2&shift&shift&goto Arg_Loop)
30 echo Invalid command-line argument: %1
35 if not defined __OutputDir goto Usage
36 if not defined __Arch goto Usage
38 REM Check if the platform is supported
39 if /i %__Arch% == "arm" (
40 echo No runtime dependencies for Arm32.
44 REM =========================================================================================
46 REM === Check if dotnet CLI and necessary directories exist
48 REM =========================================================================================
50 set __DotNetToolDir=%__ThisScriptPath%..\Tools
51 set __DotNetCmd=%__DotNetToolDir%\dotnetcli\dotnet.exe
52 set __PackageDir=%__ThisScriptPath%..\Packages
53 set __CsprojPath=%__ThisScriptPath%\src\Common\stress_dependencies\stress_dependencies.csproj
55 REM Check if dotnet cli exists
56 if not exist "%__DotNetToolDir%" (
57 echo Directory containing dotnet CLI does not exist: %__DotNetToolDir%
60 if not exist "%__DotNetCmd%" (
61 echo dotnet.exe does not exist: %__DotNetCmd%
65 REM Create directories needed
66 if not exist "%__PackageDir%" md "%__PackageDir%"
67 if not exist "%__OutputDir%" md "%__OutputDir%"
69 REM =========================================================================================
71 REM === Download packages
73 REM =========================================================================================
75 REM Download the package
76 echo Downloading CoreDisTools package
77 set DOTNETCMD="%__DotNetCmd%" restore "%__CsprojPath%" --source https://dotnet.myget.org/F/dotnet-core/ --packages "%__PackageDir%"
80 if errorlevel 1 goto Fail
82 REM Get downloaded dll path
83 echo Locating coredistools.dll
84 FOR /F "delims=" %%i IN ('dir %__PackageDir%\coredistools.dll /b/s ^| findstr /R "runtime.win[0-9]*-%__Arch%"') DO set __LibPath=%%i
85 echo CoreDisTools library path: %__LibPath%
86 if not exist "%__LibPath%" (
87 echo Failed to locate the downloaded library: %__LibPath%
91 REM Copy library to output directory
92 echo Copy library: %__LibPath% to %__OutputDir%
93 copy /y "%__LibPath%" "%__OutputDir%"
95 echo Failed to copy %__LibPath% to %__OutputDir%
104 REM =========================================================================================
106 REM === Helper routines
108 REM =========================================================================================
112 echo Download coredistools for GC stress testing
115 echo %__ThisScriptShort% /arch ^<TargetArch^> /outputdir ^<coredistools_lib_install_path^>