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