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 SET TOCOPY=mini_installer.exe *.dll.pdb chrome.exe.pdb mini_installer.exe.pdb^
\r
53 setup.exe.pdb delegate_execute.exe.pdb
\r
57 REM incremental_chrome_dll=1 puts chrome_dll.pdb into the "initial" dir.
\r
58 IF EXIST "%FROM%\initial" (
\r
59 SET FROM=%FROM%\initial
\r
64 ECHO Ready to run/debug %TO%\mini_installer.exe.
\r
67 REM All labels henceforth are subroutines intended to be invoked by CALL.
\r
69 REM Canonicalize the first argument, returning it in RET.
\r
74 REM Search for a mini_installer.exe in the candidate build outputs.
\r
77 SET OUTPUTS=out build
\r
79 SET OUTPUTS=%OUTPUT%
\r
83 IF "%BUILDTYPE%"=="" (
\r
84 SET BUILDTYPES=Debug Release
\r
86 SET BUILDTYPES=%BUILDTYPE%
\r
90 FOR %%o IN (%OUTPUTS%) DO (
\r
91 FOR %%f IN (%BUILDTYPES%) DO (
\r
92 IF EXIST "%FROM%\%%o\%%f\mini_installer.exe" (
\r
97 IF EXIST "%FROM%\%%o\%%f_x64\mini_installer.exe" (
\r
107 REM Branch to handle copying via robocopy (fast) or xcopy (slow).
\r
109 robocopy /? 1> nul 2> nul
\r
110 IF NOT "%ERRORLEVEL%"=="9009" (
\r
111 robocopy "%FROM%" "%TO%" %TOCOPY% /MT /XX
\r
113 IF NOT EXIST "%TO%" mkdir "%TO%"
\r
114 call :_xcopy_hack %TOCOPY%
\r
118 REM We can't use a for..in..do loop since we have wildcards, so we make a call
\r
119 REM to this with the files to copy.
\r
122 IF "%0"=="" GOTO :EOF
\r
123 xcopy "%FROM%\%0" "%TO%" /d /y
\r