OLD | NEW |
1 @echo off | 1 @echo off |
2 :: Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 :: Copyright (c) 2011 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 | 13 |
14 :: Get absolute root directory (.js scripts don't handle relative paths well). | 14 :: Get absolute root directory (.js scripts don't handle relative paths well). |
15 pushd %~dp0..\.. | 15 pushd %~dp0..\.. |
16 set WIN_TOOLS_ROOT_DIR=%CD% | 16 set WIN_TOOLS_ROOT_DIR=%CD% |
17 popd | 17 popd |
18 | 18 |
19 if "%1" == "force" ( | 19 if "%1" == "force" ( |
20 set WIN_TOOLS_FORCE=1 | 20 set WIN_TOOLS_FORCE=1 |
21 shift /1 | 21 shift /1 |
22 ) | 22 ) |
23 | 23 |
| 24 |
| 25 :GIT_CHECK |
| 26 :: If the batch file exists, skip the git check. |
| 27 if exist "%WIN_TOOLS_ROOT_DIR%\git.bat" goto :SVN_CHECK |
| 28 if "%GIT_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
| 29 :: The normal initialization will happen here when we're ready to deploy. |
| 30 goto :SVN_CHECK |
| 31 |
| 32 |
| 33 :GIT_INSTALL |
| 34 echo Installing git (avg 1-2 min download) ... |
| 35 :: git is not accessible; check it out and create 'proxy' files. |
| 36 if exist "%~dp0git.zip" del "%~dp0git.zip" |
| 37 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/git_bin.zip "%~dp0git.zip" |
| 38 if errorlevel 1 goto :GIT_FAIL |
| 39 :: Cleanup svn directory if it was existing. |
| 40 if exist "%WIN_TOOLS_ROOT_DIR%\git_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\git_bin
" |
| 41 :: Will create git_bin\... |
| 42 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0git.zip" "%WIN_TOOLS_ROOT_DIR
%" |
| 43 if errorlevel 1 goto :GIT_FAIL |
| 44 if not exist "%WIN_TOOLS_ROOT_DIR%\git_bin\." goto :GIT_FAIL |
| 45 del "%~dp0git.zip" |
| 46 :: Create the batch files. |
| 47 call copy /y "%WIN_TOOLS_ROOT_DIR%\git_bin\git.bat" "%WIN_TOOLS_ROOT_DIR%\git.ba
t" 1>nul |
| 48 call copy /y "%WIN_TOOLS_ROOT_DIR%\git_bin\gitk.bat" "%WIN_TOOLS_ROOT_DIR%\gitk.
bat" 1>nul |
| 49 call copy /y "%WIN_TOOLS_ROOT_DIR%\git_bin\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ssh.ba
t" 1>nul |
| 50 goto :SVN_CHECK |
| 51 |
| 52 |
| 53 :GIT_FAIL |
| 54 echo ... Failed to checkout git automatically. |
| 55 echo Please visit http://code.google.com/p/msysgit to download the latest git |
| 56 echo client before continuing. |
| 57 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/ |
| 58 set ERRORLEVEL=1 |
| 59 goto :END |
| 60 |
| 61 |
24 :SVN_CHECK | 62 :SVN_CHECK |
25 :: If the batch file exists, skip the svn check. | 63 :: If the batch file exists, skip the svn check. |
26 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK | 64 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK |
27 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL | 65 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL |
28 call svn --version 2>nul 1>nul | 66 call svn --version 2>nul 1>nul |
29 if errorlevel 1 goto :SVN_INSTALL | 67 if errorlevel 1 goto :SVN_INSTALL |
30 goto :PYTHON_CHECK | 68 goto :PYTHON_CHECK |
31 | 69 |
32 | 70 |
33 :SVN_INSTALL | 71 :SVN_INSTALL |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 goto :END | 131 goto :END |
94 | 132 |
95 | 133 |
96 :returncode | 134 :returncode |
97 set WIN_TOOLS_ROOT_URL= | 135 set WIN_TOOLS_ROOT_URL= |
98 set WIN_TOOLS_ROOT_DIR= | 136 set WIN_TOOLS_ROOT_DIR= |
99 exit /b %ERRORLEVEL% | 137 exit /b %ERRORLEVEL% |
100 | 138 |
101 :END | 139 :END |
102 call :returncode %ERRORLEVEL% | 140 call :returncode %ERRORLEVEL% |
OLD | NEW |