blob: 091339982bc37a261cdaa13fc4bf143254986ef6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
@if not defined __echo @echo off
setlocal
set __ThisScriptShort=%0
set __ThisScriptFull=%~f0
set __ThisScriptPath=%~dp0
REM =========================================================================================
REM ===
REM === Parse arguments
REM ===
REM =========================================================================================
set __OutputDir=
set __Arch=
:Arg_Loop
if "%1" == "" goto ArgsDone
if /i "%1" == "/?" goto Usage
if /i "%1" == "-?" goto Usage
if /i "%1" == "/h" goto Usage
if /i "%1" == "-h" goto Usage
if /i "%1" == "/help" goto Usage
if /i "%1" == "-help" goto Usage
if /i "%1" == "/arch" (set __Arch=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "/outputdir" (set __OutputDir=%2&shift&shift&goto Arg_Loop)
echo Invalid command-line argument: %1
goto Usage
:ArgsDone
if not defined __OutputDir goto Usage
if not defined __Arch goto Usage
REM =========================================================================================
REM ===
REM === Check if dotnet CLI and necessary directories exist
REM ===
REM =========================================================================================
set __DotNetToolDir=%__ThisScriptPath%..\Tools
set __DotNetCmd=%__DotNetToolDir%\dotnetcli\dotnet.exe
set __PackageDir=%__ThisScriptPath%..\Packages
set __TmpDir=%Temp%\coreclr_gcstress_%RANDOM%
REM Check if donet cli exists
if not exist "%__DotNetToolDir%" (
echo Directory containing dotnet CLI does not exist: %__DotNetToolDir%
goto Fail
)
if not exist "%__DotNetCmd%" (
echo dotnet.exe does not exist: %__DotNetCmd%
goto Fail
)
REM Create directories needed
if not exist "%__PackageDir%" md "%__PackageDir%"
if not exist "%__OutputDir%" md "%__OutputDir%"
REM Check and create a temp directory
if exist "%__TmpDir%" (
rmdir /S /Q %__TmpDir%
)
mkdir %__TmpDir%
REM Project.json path
set __JasonFilePath=%__TmpDir%\project.json
REM =========================================================================================
REM ===
REM === Download packages
REM ===
REM =========================================================================================
REM Write dependency information to project.json
echo { ^
"dependencies": { ^
"runtime.win7-%__Arch%.Microsoft.NETCore.CoreDisTools": "1.0.1-prerelease-00001" ^
}, ^
"frameworks": { "dnxcore50": { } } ^
} > "%__JasonFilePath%"
echo Jason file: %__JasonFilePath%
type "%__JasonFilePath%"
REM Download the package
echo Downloading CoreDisTools package
set DOTNETCMD="%__DotNetCmd%" restore "%__JasonFilePath%" --source https://dotnet.myget.org/F/dotnet-core/ --packages "%__PackageDir%"
echo %DOTNETCMD%
call %DOTNETCMD%
if errorlevel 1 goto Fail
REM Get downloaded dll path
echo Locating coredistools.dll
FOR /F "delims=" %%i IN ('dir %__PackageDir%\coredistools.dll /b/s ^| findstr /R "runtime.win[0-9]*-%__Arch%"') DO set __LibPath=%%i
echo CoreDisTools library path: %__LibPath%
if not exist "%__LibPath%" (
echo Failed to locate the downloaded library: %__LibPath%
goto Fail
)
REM Copy library to output directory
echo Copy library: %__LibPath% to %__OutputDir%
copy /y "%__LibPath%" "%__OutputDir%"
REM Delete temporary files
if exist "%__TmpDir%" (
rmdir /S /Q "%__TmpDir%"
)
exit /b 0
:Fail
if exist "%__TmpDir%" (
rmdir /S /Q "%__TmpDir%"
)
exit /b 1
REM =========================================================================================
REM ===
REM === Helper routines
REM ===
REM =========================================================================================
:Usage
echo.
echo Download coredistool for GC stress testing
echo.
echo Usage:
echo %__ThisScriptShort% /arch ^<TargetArch^> /outputdir ^<coredistools_lib_install_path^>
echo.
exit /b 1
|