Fix for Desktop build break
[platform/upstream/coreclr.git] / sync.cmd
1 @if not defined _echo @echo off
2 setlocal EnableDelayedExpansion
3
4 set "__args=%*"
5 set processedArgs=
6 set unprocessedArgs=
7 set __MSBuildArgs=
8
9 REM If no processed arguments are specified, -p is implied.
10 if "%1" == ""   (set __MSBuildArgs=.\build.proj /p:RestoreDuringBuild=true /t:Sync&goto ArgsDone)
11 if "%1" == "--" (set __MSBuildArgs=.\build.proj /p:RestoreDuringBuild=true /t:Sync&goto ArgsDone)
12
13 :ArgLoop
14
15 if "%1" == "" goto ArgsDone
16 if /I [%1] == [-?] goto Usage
17 if /I [%1] == [-help] goto Usage
18
19 REM This for loop splits the remaining arguments, preserving "=".
20 REM x gets the next argument, and y gets all remaining arguments after the first.
21 FOR /f "tokens=1*" %%x IN ("%*") DO (
22     set param=%%x
23     if /i "!param!" == "-p"                     (set __MSBuildArgs=!__MSBuildArgs! .\build.proj /p:RestoreDuringBuild=true /t:Sync)
24     if /i "!param!" == "-ab"                    (set __MSBuildArgs=!__MSBuildArgs! .\src\syncAzure.proj)
25     if /i "!param:~0,14!" == "-AzureAccount="   (set v=!param:~14!&set __MSBuildArgs=!__MSBuildArgs! /p:CloudDropAccountName=!v!)
26     if /i "!param:~0,12!" == "-AzureToken="     (set v=!param:~12!&set __MSBuildArgs=!__MSBuildArgs! /p:CloudDropAccessToken=!v!)
27     if /i "!param:~0,12!" == "-BuildMajor="     (set v=!param:~12!&set __MSBuildArgs=!__MSBuildArgs! /p:BuildNumberMajor=!v!)
28     if /i "!param:~0,12!" == "-BuildMinor="     (set v=!param:~12!&set __MSBuildArgs=!__MSBuildArgs! /p:BuildNumberMinor=!v!)
29     if /i "!param:~0,11!" == "-Container="      (set v=!param:~11!&set __MSBuildArgs=!__MSBuildArgs! /p:ContainerName=!v!)
30     if /i "!param:~0,16!" == "-BlobNamePrefix=" (set v=!param:~16!&set __MSBuildArgs=!__MSBuildArgs! /p:__BlobNamePrefix=!v!)
31     if /i "!param:~0,11!" == "-RuntimeId="      (set v=!param:~11!&set __MSBuildArgs=!__MSBuildArgs! /p:RuntimeId=!v!)
32     REM all other arguments get passed through to msbuild unchanged.
33     if /i not "!param:~0,1!" == "-"             (set __MSBuildArgs=!__MSBuildArgs! !param!)
34
35     REM The innermost recursive invocation of :ArgLoop will execute
36     REM msbuild, and all other invocations simply exit.
37     call :ArgLoop %%y
38     exit /b
39 )
40
41 :ArgsDone
42
43 @call %~dp0dotnet.cmd msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false /flp:v=detailed;LogFile=sync.log %__MSBuildArgs%
44 @exit /b %ERRORLEVEL%
45
46 :Usage
47 echo.
48 echo Repository syncing script.
49 echo.
50 echo Options:
51 echo     -?     - Prints Usage
52 echo     -help  - Prints Usage
53 echo     -p     - Restores all nuget packages for repository
54 echo     -ab    - Downloads the latests product packages from Azure.
55 echo              The following properties are required:
56 echo                 -AzureAccount="Account name"
57 echo                 -AzureToken="Access token"
58 echo              To download a specific group of product packages, specify:
59 echo                 -BuildMajor
60 echo                 -BuildMinor
61 echo              To download from a specific container, specify:
62 echo                 -Container="container name"
63 echo              To download blobs starting with a specific prefix, specify:
64 echo                 -BlobNamePrefix="Blob name prefix"
65 echo              To specify which RID you are downloading binaries for (optional):
66 echo                 -RuntimeId="RID" (Needs to match what's in the container)
67 echo.
68 echo.
69 echo.
70 echo If no option is specified then sync.cmd -p is implied.