OLD | NEW |
(Empty) | |
| 1 ECHO OFF |
| 2 |
| 3 REM Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 REM Use of this source code is governed by a BSD-style license that can be |
| 5 REM found in the LICENSE file. |
| 6 |
| 7 REM Copies an installer and symbols from a build directory on a network share |
| 8 REM into the directory \[out|build]\[Debug|Release] on the current drive. |
| 9 REM |
| 10 REM Usage: |
| 11 REM \\build.share\<path_to_checkout>\src\tools\win\copy-installer.bat |
| 12 REM |
| 13 REM By default, the script will copy the Debug build in the tree, falling back |
| 14 REM to the Release build if one is not found. Similarly, the ninja output |
| 15 REM directory is preferred over the devenv output directory. Specify |
| 16 REM "out|build" and/or "Debug|Release" (case matters) on the command line in |
| 17 REM any order to influence selection. The defaults for location and build type |
| 18 REM can also be overridden in a given build tree by creating a |
| 19 REM "copy-installer.cfg" file alongside the .gclient file that sets the OUTPUT |
| 20 REM and/or BUILDTYPE variables. |
| 21 REM |
| 22 REM Install Robocopy for superior performance on Windows XP if desired (it is |
| 23 REM present by default on Vista+). |
| 24 |
| 25 SETLOCAL |
| 26 |
| 27 REM Get the path to the build tree's src directory. |
| 28 CALL :_canonicalize "%~dp0..\.." |
| 29 SET FROM=%RET% |
| 30 |
| 31 REM Read local configuration (set OUTPUT and BUILDTYPE there). |
| 32 IF EXIST "%FROM%\..\copy-installer.cfg" CALL "%FROM%\..\copy-installer.cfg" |
| 33 |
| 34 REM Read OUTPUT and/or BUILDTYPE from command line. |
| 35 FOR %%a IN (%1 %2) do ( |
| 36 IF "%%a"=="out" SET OUTPUT=out |
| 37 IF "%%a"=="build" SET OUTPUT=build |
| 38 IF "%%a"=="Debug" SET BUILDTYPE=Debug |
| 39 IF "%%a"=="Release" SET BUILDTYPE=Release |
| 40 ) |
| 41 |
| 42 CALL :_find_build |
| 43 IF "%OUTPUT%%BUILDTYPE%"=="" ( |
| 44 ECHO No build found to copy. |
| 45 EXIT 1 |
| 46 ) |
| 47 |
| 48 SET FROM=%FROM%\%OUTPUT%\%BUILDTYPE% |
| 49 SET TO=\%OUTPUT%\%BUILDTYPE% |
| 50 |
| 51 REM Figure out what files to copy based on the component type (shared/static). |
| 52 IF EXIST "%FROM%\base.dll" ( |
| 53 SET TOCOPY=*.pdb setup.exe setup.exe.manifest chrome.packed.7z *.dll |
| 54 SET INSTALLER=setup.exe |
| 55 ) ELSE ( |
| 56 SET TOCOPY=*.pdb mini_installer.exe |
| 57 SET INSTALLER=mini_installer.exe |
| 58 ) |
| 59 |
| 60 REM Branch to handle copying via robocopy (fast) or xcopy (slow). |
| 61 robocopy /? 1> nul 2> nul |
| 62 IF "%ERRORLEVEL%"=="9009" GOTO _xcopy else GOTO _robocopy |
| 63 |
| 64 REM robocopy is rsync, basically. |
| 65 :_robocopy |
| 66 robocopy "%FROM%" "%TO%" %TOCOPY% /J /MT |
| 67 GOTO _copydone |
| 68 |
| 69 REM xcopy is not. |
| 70 :_xcopy |
| 71 IF NOT exist "%TO%" mkdir "%TO%" |
| 72 call :_xcopy_hack %TOCOPY% |
| 73 GOTO _copydone |
| 74 |
| 75 :_copydone |
| 76 ECHO Ready to run/debug %TO%\%INSTALLER%. |
| 77 GOTO :EOF |
| 78 |
| 79 REM All labels henceforth are subroutines intended to be invoked by CALL. |
| 80 |
| 81 REM Search for a mini_installer.exe in the candidate build outputs. |
| 82 :_find_build |
| 83 IF "%OUTPUT%"=="" ( |
| 84 SET OUTPUTS=out build |
| 85 ) ELSE ( |
| 86 SET OUTPUTS=%OUTPUT% |
| 87 SET OUTPUT= |
| 88 ) |
| 89 |
| 90 IF "%BUILDTYPE%"=="" ( |
| 91 SET BUILDTYPES=Debug Release |
| 92 ) ELSE ( |
| 93 SET BUILDTYPES=%BUILDTYPE% |
| 94 SET BUILDTYPE= |
| 95 ) |
| 96 |
| 97 FOR %%o IN (%OUTPUTS%) DO ( |
| 98 FOR %%f IN (%BUILDTYPES%) DO ( |
| 99 IF EXIST "%FROM%\%%o\%%f\mini_installer.exe" ( |
| 100 SET OUTPUT=%%o |
| 101 SET BUILDTYPE=%%f |
| 102 GOTO :EOF |
| 103 ) |
| 104 ) |
| 105 ) |
| 106 GOTO :EOF |
| 107 |
| 108 REM We can't use a for..in..do loop since we have wildcards, so we make a call |
| 109 REM to this with the files to copy. |
| 110 :_xcopy_hack |
| 111 SHIFT |
| 112 IF "%0"=="" GOTO :EOF |
| 113 xcopy "%FROM%\%0" "%TO%" /y |
| 114 GOTO _xcopy_hack |
| 115 |
| 116 REM Canonicalize the first argument, returning it in RET. |
| 117 :_canonicalize |
| 118 SET RET=%~f1 |
| 119 GOTO :EOF |
OLD | NEW |