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 set GIT_BIN_DIR=git-1.8.0_bin |
14 | 14 |
15 :: 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). |
16 pushd %~dp0..\.. | 16 pushd %~dp0..\.. |
17 set WIN_TOOLS_ROOT_DIR=%CD% | 17 set WIN_TOOLS_ROOT_DIR=%CD% |
18 popd | 18 popd |
19 | 19 |
20 if "%1" == "force" ( | 20 if "%1" == "force" ( |
21 set WIN_TOOLS_FORCE=1 | 21 set WIN_TOOLS_FORCE=1 |
22 shift /1 | 22 shift /1 |
23 ) | 23 ) |
24 | 24 |
25 | 25 |
26 :GIT_CHECK | 26 :GIT_CHECK |
27 :: If the batch file exists, skip the git check. | 27 :: If the batch file exists, skip the git check. |
28 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_TERM_CHECK | 28 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK |
29 if "%CHROME_HEADLESS%" == "1" goto :MSYS_TERM_CHECK | 29 if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK |
30 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL | 30 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
31 call git --version 2>nul 1>nul | 31 call git --version 2>nul 1>nul |
32 if errorlevel 1 goto :GIT_INSTALL | 32 if errorlevel 1 goto :GIT_INSTALL |
33 goto :MSYS_TERM_CHECK | 33 goto :SVN_CHECK |
| 34 |
| 35 |
| 36 :MSYS_PATH_CHECK |
| 37 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul |
| 38 if errorlevel 1 goto :SVN_CHECK |
| 39 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" |
34 | 40 |
35 | 41 |
36 :GIT_INSTALL | 42 :GIT_INSTALL |
37 echo Installing git (avg 1-2 min download) ... | 43 echo Installing git (avg 1-2 min download) ... |
38 :: git is not accessible; check it out and create 'proxy' files. | 44 :: git is not accessible; check it out and create 'proxy' files. |
39 if exist "%~dp0git.zip" del "%~dp0git.zip" | 45 if exist "%~dp0git.zip" del "%~dp0git.zip" |
40 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/git-1.8.0_bin.zip "%~dp0git.zip" | 46 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/git-1.8.0_bin.zip "%~dp0git.zip" |
41 if errorlevel 1 goto :GIT_FAIL | 47 if errorlevel 1 goto :GIT_FAIL |
42 :: Cleanup svn directory if it was existing. | 48 :: Cleanup svn directory if it was existing. |
43 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\%
GIT_BIN_DIR%" | 49 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\%
GIT_BIN_DIR%" |
44 :: Will create %GIT_BIN_DIR%\... | 50 :: Will create %GIT_BIN_DIR%\... |
45 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0git.zip" "%WIN_TOOLS_ROOT_DIR
%" | 51 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0git.zip" "%WIN_TOOLS_ROOT_DIR
%" |
46 if errorlevel 1 goto :GIT_FAIL | 52 if errorlevel 1 goto :GIT_FAIL |
47 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL | 53 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL |
48 del "%~dp0git.zip" | 54 del "%~dp0git.zip" |
49 :: Create the batch files. | 55 :: Create the batch files. |
50 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\
git.bat" 1>nul | 56 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\
git.bat" 1>nul |
51 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR%
\gitk.bat" 1>nul | 57 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR%
\gitk.bat" 1>nul |
52 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\
ssh.bat" 1>nul | 58 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\
ssh.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 | 59 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO
T_DIR%\ssh-keygen.bat" 1>nul |
54 :: Ensure autocrlf and filemode are set correctly. | 60 :: Ensure autocrlf and filemode are set correctly. |
55 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false | 61 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false |
56 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false | 62 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false |
57 goto :MSYS_TERM_CHECK | 63 goto :SVN_CHECK |
58 | 64 |
59 | 65 |
60 :GIT_FAIL | 66 :GIT_FAIL |
61 echo ... Failed to checkout git automatically. | 67 echo ... Failed to checkout git automatically. |
62 echo Please visit http://code.google.com/p/msysgit to download the latest git | 68 echo Please visit http://code.google.com/p/msysgit to download the latest git |
63 echo client before continuing. | 69 echo client before continuing. |
64 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/ | 70 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/ |
65 set ERRORLEVEL=1 | 71 set ERRORLEVEL=1 |
66 goto :END | 72 goto :END |
67 | 73 |
68 | 74 |
69 :MSYS_TERM_CHECK | |
70 :: Tweak git.bat to set TERM appropriately | |
71 call FIND "TERM" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul | |
72 IF errorlevel 1 ( | |
73 FINDSTR /V "git\.cmd" "%WIN_TOOLS_ROOT_DIR%\git.bat" > git.bat.new | |
74 echo set TERM=msys >> git.bat.new | |
75 FINDSTR "git\.cmd" "%WIN_TOOLS_ROOT_DIR%\git.bat" >> git.bat.new | |
76 MOVE /Y git.bat.new "%WIN_TOOLS_ROOT_DIR%\git.bat" >nul | |
77 ) | |
78 | |
79 | |
80 :SVN_CHECK | 75 :SVN_CHECK |
81 :: If the batch file exists, skip the svn check. | 76 :: If the batch file exists, skip the svn check. |
82 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK | 77 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK |
83 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL | 78 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL |
84 call svn --version 2>nul 1>nul | 79 call svn --version 2>nul 1>nul |
85 if errorlevel 1 goto :SVN_INSTALL | 80 if errorlevel 1 goto :SVN_INSTALL |
86 goto :PYTHON_CHECK | 81 goto :PYTHON_CHECK |
87 | 82 |
88 | 83 |
89 :SVN_INSTALL | 84 :SVN_INSTALL |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 goto :END | 145 goto :END |
151 | 146 |
152 | 147 |
153 :returncode | 148 :returncode |
154 set WIN_TOOLS_ROOT_URL= | 149 set WIN_TOOLS_ROOT_URL= |
155 set WIN_TOOLS_ROOT_DIR= | 150 set WIN_TOOLS_ROOT_DIR= |
156 exit /b %ERRORLEVEL% | 151 exit /b %ERRORLEVEL% |
157 | 152 |
158 :END | 153 :END |
159 call :returncode %ERRORLEVEL% | 154 call :returncode %ERRORLEVEL% |
OLD | NEW |