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\src\chrome\tools\win\copy-installer.bat | |
robertshield
2012/07/31 14:05:59
is this under src\chrome\tools\win or src\tools\wi
grt (UTC plus 2)
2012/07/31 14:19:43
Yeah, the latter. That's what I get for trying to
robertshield
2012/07/31 16:28:06
Yep, although I would suggest "..." -> "<path_to_c
| |
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) to on the command line in | |
17 REM any order to influence selection. The defaults for build type and location | |
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 FLAVOR variables. | |
robertshield
2012/07/31 14:05:59
Mention that this uses robocopy if available, reco
grt (UTC plus 2)
2012/07/31 14:19:43
Robocopy is included with Vista+. Does this affec
robertshield
2012/07/31 16:28:06
SGTM
| |
21 | |
22 SETLOCAL | |
23 | |
24 REM Get the path to the build tree's src directory. | |
25 CALL :_canonicalize "%~dp0..\.." | |
26 SET FROM=%RET% | |
27 | |
28 REM Read local configuration (set OUTPUT and FLAVOR there). | |
29 IF EXIST "%FROM%\..\copy-installer.cfg" CALL "%FROM%\..\copy-installer.cfg" | |
30 | |
31 REM Read OUTPUT and/or FLAVOR from command line. | |
32 FOR %%a IN (%1 %2) do ( | |
33 IF "%%a"=="out" SET OUTPUT=out | |
34 IF "%%a"=="build" SET OUTPUT=build | |
35 IF "%%a"=="Debug" SET FLAVOR=Debug | |
36 IF "%%a"=="Release" SET FLAVOR=Release | |
37 ) | |
38 | |
39 CALL :_find_build | |
40 IF "%OUTPUT%%FLAVOR%"=="" ( | |
41 ECHO No build found to copy. | |
42 EXIT 1 | |
43 ) | |
44 | |
45 SET FROM=%FROM%\%OUTPUT%\%FLAVOR% | |
46 SET TO=\%OUTPUT%\%FLAVOR% | |
47 | |
48 REM Figure out what files to copy based on the build type (shared/static). | |
49 IF EXIST "%FROM%\base.dll" ( | |
50 SET TOCOPY=*.pdb setup.exe setup.exe.manifest chrome.packed.7z *.dll | |
51 SET INSTALLER=setup.exe | |
52 ) ELSE ( | |
53 SET TOCOPY=*.pdb mini_installer.exe | |
54 SET INSTALLER=mini_installer.exe | |
55 ) | |
56 | |
57 REM Branch to handle copying via robocopy (fast) or xcopy (slow). | |
58 robocopy /? 1> nul 2> nul | |
59 IF "%ERRORLEVEL%"=="9009" GOTO _xcopy else GOTO _robocopy | |
60 | |
61 REM robocopy is rsync, basically. | |
62 :_robocopy | |
63 robocopy "%FROM%" "%TO%" %TOCOPY% /J /MT | |
64 GOTO _copydone | |
65 | |
66 REM xcopy is not. | |
67 :_xcopy | |
68 IF NOT exist "%TO%" mkdir "%TO%" | |
69 call :_xcopy_hack %TOCOPY% | |
70 GOTO _copydone | |
71 | |
72 :_copydone | |
73 ECHO Ready to run/debug %TO%\%INSTALLER%. | |
74 GOTO :EOF | |
75 | |
76 REM All labels henceforth are subroutines intended to be invoked by CALL. | |
77 | |
78 REM Search for a mini_installer.exe in the candidate build outputs. | |
79 :_find_build | |
80 IF "%OUTPUT%"=="" ( | |
81 SET OUTPUTS=out build | |
82 ) ELSE ( | |
83 SET OUTPUTS=%OUTPUT% | |
84 SET OUTPUT= | |
85 ) | |
86 | |
87 IF "%FLAVOR%"=="" ( | |
88 SET FLAVORS=Debug Release | |
89 ) ELSE ( | |
90 SET FLAVORS=%FLAVOR% | |
91 SET FLAVOR= | |
92 ) | |
93 | |
94 FOR %%o IN (%OUTPUTS%) DO ( | |
95 FOR %%f IN (%FLAVORS%) DO ( | |
96 IF EXIST "%FROM%\%%o\%%f\mini_installer.exe" ( | |
97 SET OUTPUT=%%o | |
98 SET FLAVOR=%%f | |
99 GOTO :EOF | |
100 ) | |
101 ) | |
102 ) | |
103 GOTO :EOF | |
104 | |
105 REM We can't use a for..in..do loop since we have wildcards, so we make a call | |
106 REM to this with the files to copy. | |
107 :_xcopy_hack | |
108 SHIFT | |
109 IF "%0"=="" GOTO :EOF | |
110 xcopy "%FROM%\%0" "%TO%" /y | |
111 GOTO _xcopy_hack | |
112 | |
113 REM Canonicalize the first argument, returning it in RET. | |
114 :_canonicalize | |
115 SET RET=%~f1 | |
116 GOTO :EOF | |
OLD | NEW |