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=http://src.chromium.org/svn/trunk/tools | 12 set WIN_TOOLS_ROOT_URL=http://src.chromium.org/svn/trunk/tools |
| 13 set GIT_BIN_DIR=git-1.8.0_bin |
13 | 14 |
14 :: Get absolute root directory (.js scripts don't handle relative paths well). | 15 :: Get absolute root directory (.js scripts don't handle relative paths well). |
15 pushd %~dp0..\.. | 16 pushd %~dp0..\.. |
16 set WIN_TOOLS_ROOT_DIR=%CD% | 17 set WIN_TOOLS_ROOT_DIR=%CD% |
17 popd | 18 popd |
18 | 19 |
19 if "%1" == "force" ( | 20 if "%1" == "force" ( |
20 set WIN_TOOLS_FORCE=1 | 21 set WIN_TOOLS_FORCE=1 |
21 shift /1 | 22 shift /1 |
22 ) | 23 ) |
23 | 24 |
24 | 25 |
25 :GIT_CHECK | 26 :GIT_CHECK |
26 :: If the batch file exists, skip the git check. | 27 :: If the batch file exists, skip the git check. |
27 if exist "%WIN_TOOLS_ROOT_DIR%\git.bat" goto :SVN_CHECK | 28 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :GIT_INSTALL |
28 if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK | 29 if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK |
29 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL | 30 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
30 call git --version 2>nul 1>nul | 31 call git --version 2>nul 1>nul |
31 if errorlevel 1 goto :GIT_INSTALL | 32 if errorlevel 1 goto :GIT_INSTALL |
32 goto :SVN_CHECK | 33 goto :SVN_CHECK |
33 | 34 |
34 | 35 |
35 :GIT_INSTALL | 36 :GIT_INSTALL |
36 echo Installing git (avg 1-2 min download) ... | 37 echo Installing git (avg 1-2 min download) ... |
37 :: git is not accessible; check it out and create 'proxy' files. | 38 :: git is not accessible; check it out and create 'proxy' files. |
38 if exist "%~dp0git.zip" del "%~dp0git.zip" | 39 if exist "%~dp0git.zip" del "%~dp0git.zip" |
39 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/git_bin.zip "%~dp0git.zip" | 40 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/git-1.8.0_bin.zip "%~dp0git.zip" |
40 if errorlevel 1 goto :GIT_FAIL | 41 if errorlevel 1 goto :GIT_FAIL |
41 :: Cleanup svn directory if it was existing. | 42 :: Cleanup svn directory if it was existing. |
42 if exist "%WIN_TOOLS_ROOT_DIR%\git_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\git_bin
" | 43 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\%
GIT_BIN_DIR%" |
43 :: Will create git_bin\... | 44 :: Will create %GIT_BIN_DIR%\... |
44 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0git.zip" "%WIN_TOOLS_ROOT_DIR
%" | 45 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0git.zip" "%WIN_TOOLS_ROOT_DIR
%" |
45 if errorlevel 1 goto :GIT_FAIL | 46 if errorlevel 1 goto :GIT_FAIL |
46 if not exist "%WIN_TOOLS_ROOT_DIR%\git_bin\." goto :GIT_FAIL | 47 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL |
47 del "%~dp0git.zip" | 48 del "%~dp0git.zip" |
48 :: Create the batch files. | 49 :: Create the batch files. |
49 call copy /y "%WIN_TOOLS_ROOT_DIR%\git_bin\git.bat" "%WIN_TOOLS_ROOT_DIR%\git.ba
t" 1>nul | 50 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\
git.bat" 1>nul |
50 call copy /y "%WIN_TOOLS_ROOT_DIR%\git_bin\gitk.bat" "%WIN_TOOLS_ROOT_DIR%\gitk.
bat" 1>nul | 51 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR%
\gitk.bat" 1>nul |
51 call copy /y "%WIN_TOOLS_ROOT_DIR%\git_bin\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ssh.ba
t" 1>nul | 52 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\
ssh.bat" 1>nul |
52 call copy /y "%WIN_TOOLS_ROOT_DIR%\git_bin\ssh-keygen.bat" "%WIN_TOOLS_ROOT_DIR%
\ssh-keygen.bat" 1>nul | 53 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO
T_DIR%\ssh-keygen.bat" 1>nul |
53 :: Ensure autocrlf and filemode are set correctly. | 54 :: Ensure autocrlf and filemode are set correctly. |
54 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false | 55 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false |
55 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false | 56 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false |
56 goto :SVN_CHECK | 57 goto :SVN_CHECK |
57 | 58 |
58 | 59 |
59 :GIT_FAIL | 60 :GIT_FAIL |
60 echo ... Failed to checkout git automatically. | 61 echo ... Failed to checkout git automatically. |
61 echo Please visit http://code.google.com/p/msysgit to download the latest git | 62 echo Please visit http://code.google.com/p/msysgit to download the latest git |
62 echo client before continuing. | 63 echo client before continuing. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 goto :END | 139 goto :END |
139 | 140 |
140 | 141 |
141 :returncode | 142 :returncode |
142 set WIN_TOOLS_ROOT_URL= | 143 set WIN_TOOLS_ROOT_URL= |
143 set WIN_TOOLS_ROOT_DIR= | 144 set WIN_TOOLS_ROOT_DIR= |
144 exit /b %ERRORLEVEL% | 145 exit /b %ERRORLEVEL% |
145 | 146 |
146 :END | 147 :END |
147 call :returncode %ERRORLEVEL% | 148 call :returncode %ERRORLEVEL% |
OLD | NEW |