3 REM Copyright (c) 2012 The Chromium Authors. All rights reserved.
\r
4 REM Use of this source code is governed by a BSD-style license that can be
\r
5 REM found in the LICENSE file.
\r
7 REM Copies an installer and symbols from a build directory on a network share
\r
8 REM into the directory \[out|build]\[Debug|Release] on the current drive.
\r
11 REM \\build.share\<path_to_checkout>\src\tools\win\copy-installer.bat
\r
13 REM By default, the script will copy the Debug build in the tree, falling back
\r
14 REM to the Release build if one is not found. Similarly, the ninja output
\r
15 REM directory is preferred over the devenv output directory. The x86 build is
\r
16 REM preferred over the x64 build. Specify any of "out|build", "Debug|Release"
\r
17 REM (case matters), or "x64" on the command line in any order to influence
\r
18 REM selection. The defaults for location and build type can also be overridden
\r
19 REM in a given build tree by creating a "copy-installer.cfg" file alongside the
\r
20 REM .gclient file that sets any of OUTPUT, BUILDTYPE, or ARCH variables.
\r
22 REM Install Robocopy for superior performance on Windows XP if desired (it is
\r
23 REM present by default on Vista+).
\r
27 REM Get the path to the build tree's src directory.
\r
28 CALL :_canonicalize "%~dp0..\.."
\r
31 REM Read local configuration (set OUTPUT and BUILDTYPE there).
\r
32 IF EXIST "%FROM%\..\copy-installer.cfg" CALL "%FROM%\..\copy-installer.cfg"
\r
34 REM Read any of OUTPUT, BUILDTYPE, or ARCH from command line.
\r
35 FOR %%a IN (%1 %2) do (
\r
36 IF "%%a"=="out" SET OUTPUT=out
\r
37 IF "%%a"=="build" SET OUTPUT=build
\r
38 IF "%%a"=="Debug" SET BUILDTYPE=Debug
\r
39 IF "%%a"=="Release" SET BUILDTYPE=Release
\r
40 IF "%%s"=="x64" SET ARCH=_x64
\r
44 IF "%OUTPUT%%BUILDTYPE%%ARCH%"=="" (
\r
45 ECHO No build found to copy.
\r
49 SET FROM=%FROM%\%OUTPUT%\%BUILDTYPE%%ARCH%
\r
50 SET TO=\%OUTPUT%\%BUILDTYPE%%ARCH%
\r
52 REM Figure out what files to copy based on the component type (shared/static).
\r
53 IF EXIST "%FROM%\base.dll" (
\r
54 SET TOCOPY=setup.exe chrome.7z *.dll
\r
55 SET ARCHIVETODELETE=chrome.packed.7z
\r
56 SET INSTALLER=setup.exe
\r
58 SET TOCOPY=mini_installer.exe mini_installer.exe.pdb
\r
59 SET INSTALLER=mini_installer.exe
\r
62 SET TOCOPY=%TOCOPY% *.dll.pdb chrome.exe.pdb setup.exe.pdb^
\r
63 delegate_execute.exe.pdb
\r
67 REM incremental_chrome_dll=1 puts chrome_dll.pdb into the "initial" dir.
\r
68 IF EXIST "%FROM%\initial" (
\r
69 SET FROM=%FROM%\initial
\r
74 REM Keeping the old chrome.packed.7z around could cause the new setup.exe to
\r
75 REM use it instead of the new chrome.7z, delete it to save developers from
\r
76 REM debugging nightmares!
\r
77 IF NOT "%ARCHIVETODELETE%"=="" (
\r
78 IF EXIST "%TO%\%ARCHIVETODELETE%" (
\r
79 ECHO Deleting old/deprecated %ARCHIVETODELETE%
\r
80 del /Q "%TO%\%ARCHIVETODELETE%"
\r
84 ECHO Ready to run/debug %TO%\%INSTALLER%.
\r
87 REM All labels henceforth are subroutines intended to be invoked by CALL.
\r
89 REM Canonicalize the first argument, returning it in RET.
\r
94 REM Search for a mini_installer.exe in the candidate build outputs.
\r
97 SET OUTPUTS=out build
\r
99 SET OUTPUTS=%OUTPUT%
\r
103 IF "%BUILDTYPE%"=="" (
\r
104 SET BUILDTYPES=Debug Release
\r
106 SET BUILDTYPES=%BUILDTYPE%
\r
110 FOR %%o IN (%OUTPUTS%) DO (
\r
111 FOR %%f IN (%BUILDTYPES%) DO (
\r
112 IF EXIST "%FROM%\%%o\%%f\mini_installer.exe" (
\r
117 IF EXIST "%FROM%\%%o\%%f_x64\mini_installer.exe" (
\r
127 REM Branch to handle copying via robocopy (fast) or xcopy (slow).
\r
129 robocopy /? 1> nul 2> nul
\r
130 IF NOT "%ERRORLEVEL%"=="9009" (
\r
131 robocopy "%FROM%" "%TO%" %TOCOPY% /MT /XX
\r
133 IF NOT EXIST "%TO%" mkdir "%TO%"
\r
134 call :_xcopy_hack %TOCOPY%
\r
138 REM We can't use a for..in..do loop since we have wildcards, so we make a call
\r
139 REM to this with the files to copy.
\r
142 IF "%0"=="" GOTO :EOF
\r
143 xcopy "%FROM%\%0" "%TO%" /d /y
\r