OLD | NEW |
1 @echo off | 1 @echo off |
2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 :: Use of this source code is governed by a BSD-style license that can be | 3 :: Use of this source code is governed by a BSD-style license that can be |
4 :: found in the LICENSE file. | 4 :: found in the LICENSE file. |
5 | 5 |
6 :: This script will try to find if svn and python are accessible and it not, | 6 :: This script will try to find if svn and python are accessible and it not, |
7 :: it will try to download it and 'install' it in depot_tools. | 7 :: it will try to download it and 'install' it in depot_tools. |
8 | 8 |
9 :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly | 9 :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly |
10 :: returned. | 10 :: returned. |
11 | 11 |
12 set WIN_TOOLS_ROOT_URL=https://src.chromium.org/svn/trunk/tools | 12 set WIN_TOOLS_ROOT_URL=https://src.chromium.org/svn/trunk/tools |
13 set GIT_BIN_DIR=git-1.8.0_bin | |
14 :: It used to be %~dp0 but ADODB.Stream may fail to write to this directory if | 13 :: It used to be %~dp0 but ADODB.Stream may fail to write to this directory if |
15 :: the directory DACL is set to elevated integrity level. | 14 :: the directory DACL is set to elevated integrity level. |
16 set ZIP_DIR=%TEMP% | 15 set ZIP_DIR=%TEMP% |
17 | 16 |
18 :: Get absolute root directory (.js scripts don't handle relative paths well). | 17 :: Get absolute root directory (.js scripts don't handle relative paths well). |
19 pushd %~dp0..\.. | 18 pushd %~dp0..\.. |
20 set WIN_TOOLS_ROOT_DIR=%CD% | 19 set WIN_TOOLS_ROOT_DIR=%CD% |
21 popd | 20 popd |
22 | 21 |
23 if "%1" == "force" ( | 22 if "%1" == "force" ( |
24 set WIN_TOOLS_FORCE=1 | 23 set WIN_TOOLS_FORCE=1 |
25 shift /1 | 24 shift /1 |
26 ) | 25 ) |
27 | 26 |
28 | 27 |
29 :GIT_CHECK | 28 :GIT_CHECK |
| 29 if "%DEPOT_TOOLS_GIT_1852%" == "1" goto :GIT_1852_CHECK |
| 30 goto :GIT_180_CHECK |
| 31 |
| 32 |
| 33 :GIT_1852_CHECK |
| 34 set GIT_VERSION=1.8.5.2.chromium.1 |
| 35 set GIT_BIN_DIR=git-%GIT_VERSION%_bin |
| 36 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip |
| 37 set GIT_ZIP_URL=http://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_FI
LE% |
| 38 goto :GIT_COMMON |
| 39 |
| 40 |
| 41 :GIT_180_CHECK |
| 42 set GIT_VERSION=1.8.0 |
| 43 set GIT_BIN_DIR=git-%GIT_VERSION%_bin |
| 44 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip |
| 45 set GIT_ZIP_URL=%WIN_TOOLS_ROOT_URL%/third_party/%GIT_ZIP_FILE% |
| 46 goto :GIT_COMMON |
| 47 |
| 48 |
| 49 :GIT_COMMON |
30 :: If the batch file exists, skip the git check. | 50 :: If the batch file exists, skip the git check. |
31 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK | 51 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK |
32 if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK | 52 if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK |
33 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL | 53 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
34 call git --version 2>nul 1>nul | 54 call git --version 2>nul 1>nul |
35 if errorlevel 1 goto :GIT_INSTALL | 55 if errorlevel 1 goto :GIT_INSTALL |
36 goto :SVN_CHECK | 56 goto :SVN_CHECK |
37 | 57 |
38 | 58 |
39 :MSYS_PATH_CHECK | 59 :MSYS_PATH_CHECK |
40 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul | 60 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul |
41 if errorlevel 1 goto :SVN_CHECK | 61 if errorlevel 1 goto :SVN_CHECK |
42 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" | 62 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" |
43 | 63 |
44 | 64 |
45 :GIT_INSTALL | 65 :GIT_INSTALL |
46 echo Installing git (avg 1-2 min download) ... | 66 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... |
47 :: git is not accessible; check it out and create 'proxy' files. | 67 :: git is not accessible; check it out and create 'proxy' files. |
48 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip" | 68 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip" |
49 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/git-1.8.0_bin.zip | 69 echo Fetching from %GIT_ZIP_URL% |
50 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/git-1.8.0_bin.zip "%ZIP_DIR%\git.zip" | 70 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_ZIP_URL% "%ZIP_DIR%\git.zip
" |
51 if errorlevel 1 goto :GIT_FAIL | 71 if errorlevel 1 goto :GIT_FAIL |
52 :: Cleanup svn directory if it was existing. | 72 :: Cleanup svn directory if it was existing. |
53 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\%
GIT_BIN_DIR%" | 73 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\%
GIT_BIN_DIR%" |
54 :: Will create %GIT_BIN_DIR%\... | 74 :: Will create %GIT_BIN_DIR%\... |
55 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO
T_DIR%" | 75 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO
T_DIR%" |
56 if errorlevel 1 goto :GIT_FAIL | 76 if errorlevel 1 goto :GIT_FAIL |
57 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL | 77 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL |
58 del "%ZIP_DIR%\git.zip" | 78 del "%ZIP_DIR%\git.zip" |
59 :: Create the batch files. | 79 :: Create the batch files. |
60 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\
git.bat" 1>nul | 80 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\
git.bat" 1>nul |
61 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR%
\gitk.bat" 1>nul | 81 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR%
\gitk.bat" 1>nul |
62 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\
ssh.bat" 1>nul | 82 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\
ssh.bat" 1>nul |
63 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO
T_DIR%\ssh-keygen.bat" 1>nul | 83 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO
T_DIR%\ssh-keygen.bat" 1>nul |
64 :: Ensure autocrlf and filemode are set correctly. | 84 :: Ensure autocrlf and filemode are set correctly. |
65 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false | 85 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false |
66 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false | 86 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false |
67 goto :SVN_CHECK | 87 goto :SVN_CHECK |
68 | 88 |
69 | 89 |
70 :GIT_FAIL | 90 :GIT_FAIL |
71 echo ... Failed to checkout git automatically. | 91 echo ... Failed to checkout git automatically. |
72 echo Please visit http://code.google.com/p/msysgit to download the latest git | 92 echo Please visit http://code.google.com/p/msysgit to download the latest git |
73 echo client before continuing. | 93 echo client before continuing. |
74 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/ | 94 echo You can also get the "prebaked" version used at %GIT_ZIP_URL% |
75 set ERRORLEVEL=1 | 95 set ERRORLEVEL=1 |
76 goto :END | 96 goto :END |
77 | 97 |
78 | 98 |
79 :SVN_CHECK | 99 :SVN_CHECK |
80 :: If the batch file exists, skip the svn check. | 100 :: If the batch file exists, skip the svn check. |
81 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK | 101 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK |
82 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL | 102 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL |
83 call svn --version 2>nul 1>nul | 103 call svn --version 2>nul 1>nul |
84 if errorlevel 1 goto :SVN_INSTALL | 104 if errorlevel 1 goto :SVN_INSTALL |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 goto :END | 197 goto :END |
178 | 198 |
179 | 199 |
180 :returncode | 200 :returncode |
181 set WIN_TOOLS_ROOT_URL= | 201 set WIN_TOOLS_ROOT_URL= |
182 set WIN_TOOLS_ROOT_DIR= | 202 set WIN_TOOLS_ROOT_DIR= |
183 exit /b %ERRORLEVEL% | 203 exit /b %ERRORLEVEL% |
184 | 204 |
185 :END | 205 :END |
186 call :returncode %ERRORLEVEL% | 206 call :returncode %ERRORLEVEL% |
OLD | NEW |