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. | |
gab
2012/07/31 22:23:24
nit: Replace [...|...] by (...|...)
(...|...) is
grt (UTC plus 2)
2012/08/01 08:10:30
[foo|bar] is closer the convention for optional ar
| |
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) to on the command line in | |
gab
2012/07/31 22:23:24
nit: "to on the command line" -> "on the command l
grt (UTC plus 2)
2012/08/01 08:10:30
Done.
| |
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. | |
gab
2012/07/31 22:23:24
optional: I feel BUILDTYPE (which is something I i
grt (UTC plus 2)
2012/08/01 08:10:30
Done.
| |
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 FLAVOR there). | |
32 IF EXIST "%FROM%\..\copy-installer.cfg" CALL "%FROM%\..\copy-installer.cfg" | |
33 | |
34 REM Read OUTPUT and/or FLAVOR 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 FLAVOR=Debug | |
39 IF "%%a"=="Release" SET FLAVOR=Release | |
40 ) | |
41 | |
42 CALL :_find_build | |
43 IF "%OUTPUT%%FLAVOR%"=="" ( | |
44 ECHO No build found to copy. | |
45 EXIT 1 | |
46 ) | |
47 | |
48 SET FROM=%FROM%\%OUTPUT%\%FLAVOR% | |
49 SET TO=\%OUTPUT%\%FLAVOR% | |
50 | |
51 REM Figure out what files to copy based on the build type (shared/static). | |
52 IF EXIST "%FROM%\base.dll" ( | |
53 SET TOCOPY=*.pdb setup.exe setup.exe.manifest chrome.packed.7z *.dll | |
gab
2012/07/31 22:23:24
I would really like an option to NOT copy pdb's (I
grt (UTC plus 2)
2012/08/01 08:10:30
patches welcome. :-)
gab
2012/08/01 20:14:37
ok ok..!
I guess it's not that bad given robocopy
| |
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). | |
gab
2012/07/31 22:23:24
As *.dll is so big what I do is only copy the file
grt (UTC plus 2)
2012/08/01 08:10:30
robocopy skips files that haven't changed.
gab
2012/08/01 20:14:37
Oh :)! Awesome!
| |
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 "%FLAVOR%"=="" ( | |
91 SET FLAVORS=Debug Release | |
92 ) ELSE ( | |
93 SET FLAVORS=%FLAVOR% | |
94 SET FLAVOR= | |
95 ) | |
96 | |
97 FOR %%o IN (%OUTPUTS%) DO ( | |
98 FOR %%f IN (%FLAVORS%) DO ( | |
99 IF EXIST "%FROM%\%%o\%%f\mini_installer.exe" ( | |
100 SET OUTPUT=%%o | |
101 SET FLAVOR=%%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 |