OLD | NEW |
1 @echo off | 1 @echo off |
2 :: Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 :: Copyright (c) 2009 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 :: Batch file run as build command for chrome_dll.vcproj | 6 :: Batch file run as build command for chrome_dll.vcproj |
7 | 7 |
8 setlocal | 8 setlocal |
9 | 9 |
10 set InFile=%~1 | 10 set InFile=%~1 |
11 set SolutionDir=%~2 | 11 set SolutionDir=%~2 |
12 set IntDir=%~3 | 12 set IntDir=%~3 |
13 set OutFile=%~4 | 13 set OutFile=%~4 |
| 14 set LastChangeDir=%~5 |
14 set VarsBat=%IntDir%/vers-vars.bat | 15 set VarsBat=%IntDir%/vers-vars.bat |
15 | 16 |
16 :: Put cygwin in the path | 17 :: Put cygwin in the path |
17 call %SolutionDir%\..\third_party\cygwin\setup_env.bat | 18 call %SolutionDir%\..\third_party\cygwin\setup_env.bat |
18 | 19 |
19 :: Load version digits as environment variables | 20 :: Load version digits as environment variables |
20 cat %SolutionDir%\VERSION | sed "s/\(.*\)/set \1/" > %VarsBat% | 21 cat %SolutionDir%\VERSION | sed "s/\(.*\)/set \1/" > %VarsBat% |
21 | 22 |
22 :: Load branding strings as environment variables | 23 :: Load branding strings as environment variables |
23 set Distribution="chromium" | 24 set Distribution="chromium" |
24 if "%CHROMIUM_BUILD%" == "_google_chrome" set Distribution="google_chrome" | 25 if "%CHROMIUM_BUILD%" == "_google_chrome" set Distribution="google_chrome" |
25 cat %SolutionDir%app\theme\%Distribution%\BRANDING | sed "s/\(.*\)/set \1/" >> %
VarsBat% | 26 cat %SolutionDir%app\theme\%Distribution%\BRANDING | sed "s/\(.*\)/set \1/" >> %
VarsBat% |
26 | 27 |
27 set OFFICIAL_BUILD=0 | 28 set OFFICIAL_BUILD=0 |
28 if "%CHROME_BUILD_TYPE%" == "_official" set OFFICIAL_BUILD=1 | 29 if "%CHROME_BUILD_TYPE%" == "_official" set OFFICIAL_BUILD=1 |
29 | 30 |
30 :: Look if subversion client is available. It may not be available on Windows | 31 :: Look if subversion client is available. It may not be available on Windows |
31 :: if downloaded with a tarball or depot_tools is not in the PATH. | 32 :: if downloaded with a tarball or depot_tools is not in the PATH. |
32 call svn --version 2>nul 1>nul | 33 call svn --version 2>nul 1>nul |
33 :: If not available, just skip getting the revision number. | 34 :: If not available, just skip getting the revision number. |
34 if errorlevel 1 goto :NO_SVN | 35 if errorlevel 1 goto :NO_SVN |
35 goto :SET_ENV | 36 goto :SET_ENV |
36 | 37 |
37 | |
38 :NO_SVN | 38 :NO_SVN |
39 :: Not having svn makes it impossible to determine the current checkout revision | 39 :: Not having svn makes it impossible to determine the current checkout revision |
40 :: number. On normal build, this is not an issue but for official builds, this | 40 :: number. On normal build, this is not an issue but for official builds, this |
41 :: *can't* be tolerated so issue an error instead. VS will pick it up corectly. | 41 :: *can't* be tolerated so issue an error instead. VS will pick it up corectly. |
42 set NO_SVN_LEVEL=error | 42 set NO_SVN_LEVEL=error |
43 if "%OFFICIAL_BUILD%" == "0" set NO_SVN_LEVEL=warning | 43 if "%OFFICIAL_BUILD%" == "0" set NO_SVN_LEVEL=warning |
44 echo %0(28) : %NO_SVN_LEVEL% : svn is not installed. Can't determine the revisio
n number. | 44 echo %0(28) : %NO_SVN_LEVEL% : svn is not installed. |
45 echo set LASTCHANGE=0 >> %VarsBat% | |
46 goto :GEN_FILE | |
47 | |
48 | 45 |
49 :SET_ENV | 46 :SET_ENV |
50 call svn info | grep.exe "Revision:" | cut -d" " -f2- | sed "s/\(.*\)/set LASTCH
ANGE=\1/" >> %VarsBat% | 47 python %LastChangeDir%\lastchange.py | sed "s/\(.*\)/set \1/" >> %VarsBat% |
51 goto :GEN_FILE | |
52 | 48 |
53 | |
54 :GEN_FILE | |
55 call %VarsBat% | 49 call %VarsBat% |
56 ::echo LastChange: %LASTCHANGE% | |
57 :: output file | 50 :: output file |
58 cat %InFile% | sed "s/@MAJOR@/%MAJOR%/" ^ | 51 cat %InFile% | sed "s/@MAJOR@/%MAJOR%/" ^ |
59 | sed "s/@MINOR@/%MINOR%/" ^ | 52 | sed "s/@MINOR@/%MINOR%/" ^ |
60 | sed "s/@BUILD@/%BUILD%/" ^ | 53 | sed "s/@BUILD@/%BUILD%/" ^ |
61 | sed "s/@PATCH@/%PATCH%/" ^ | 54 | sed "s/@PATCH@/%PATCH%/" ^ |
62 | sed "s/@COMPANY_FULLNAME@/%COMPANY_FULLNAME%/" ^ | 55 | sed "s/@COMPANY_FULLNAME@/%COMPANY_FULLNAME%/" ^ |
63 | sed "s/@COMPANY_SHORTNAME@/%COMPANY_SHORTNAME%/" ^ | 56 | sed "s/@COMPANY_SHORTNAME@/%COMPANY_SHORTNAME%/" ^ |
64 | sed "s/@PRODUCT_FULLNAME@/%PRODUCT_FULLNAME%/" ^ | 57 | sed "s/@PRODUCT_FULLNAME@/%PRODUCT_FULLNAME%/" ^ |
65 | sed "s/@PRODUCT_SHORTNAME@/%PRODUCT_SHORTNAME%/" ^ | 58 | sed "s/@PRODUCT_SHORTNAME@/%PRODUCT_SHORTNAME%/" ^ |
66 | sed "s/@PRODUCT_EXE@/%PRODUCT_EXE%/" ^ | 59 | sed "s/@PRODUCT_EXE@/%PRODUCT_EXE%/" ^ |
67 | sed "s/@COPYRIGHT@/%COPYRIGHT%/" ^ | 60 | sed "s/@COPYRIGHT@/%COPYRIGHT%/" ^ |
68 | sed "s/@OFFICIAL_BUILD@/%OFFICIAL_BUILD%/" ^ | 61 | sed "s/@OFFICIAL_BUILD@/%OFFICIAL_BUILD%/" ^ |
69 | sed "s/@LASTCHANGE@/%LASTCHANGE%/" > %OutFile% | 62 | sed "s/@LASTCHANGE@/%LASTCHANGE%/" > %OutFile% |
70 | 63 |
71 endlocal | 64 endlocal |
OLD | NEW |