Avoid unnecessary memory allocations at PlatformThread::SetName()
[chromium-blink-merge.git] / tools / win / copy-installer.bat
blob7ccc5a73dfa589718210430adcb814a8b0ee5da9
1 ECHO OFF\r
2 \r
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
6 \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
9 REM\r
10 REM Usage:\r
11 REM   \\build.share\<path_to_checkout>\src\tools\win\copy-installer.bat\r
12 REM\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
21 REM\r
22 REM Install Robocopy for superior performance on Windows XP if desired (it is\r
23 REM present by default on Vista+).\r
25 SETLOCAL\r
27 REM Get the path to the build tree's src directory.\r
28 CALL :_canonicalize "%~dp0..\.."\r
29 SET FROM=%RET%\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
41 )\r
43 CALL :_find_build\r
44 IF "%OUTPUT%%BUILDTYPE%%ARCH%"=="" (\r
45 ECHO No build found to copy.\r
46 EXIT 1\r
47 )\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
55 CALL :_copyfiles\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
60 SET TOCOPY=*.pdb\r
61 CALL :_copyfiles\r
62 )\r
64 ECHO Ready to run/debug %TO%\mini_installer.exe.\r
65 GOTO :EOF\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
70 :_canonicalize\r
71 SET RET=%~f1\r
72 GOTO :EOF\r
74 REM Search for a mini_installer.exe in the candidate build outputs.\r
75 :_find_build\r
76 IF "%OUTPUT%"=="" (\r
77 SET OUTPUTS=out build\r
78 ) ELSE (\r
79 SET OUTPUTS=%OUTPUT%\r
80 SET OUTPUT=\r
81 )\r
83 IF "%BUILDTYPE%"=="" (\r
84 SET BUILDTYPES=Debug Release\r
85 ) ELSE (\r
86 SET BUILDTYPES=%BUILDTYPE%\r
87 SET BUILDTYPE=\r
88 )\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
93 SET OUTPUT=%%o\r
94 SET BUILDTYPE=%%f\r
95 GOTO :EOF\r
96 )\r
97 IF EXIST "%FROM%\%%o\%%f_x64\mini_installer.exe" (\r
98 SET OUTPUT=%%o\r
99 SET BUILDTYPE=%%f\r
100 SET ARCH=_x64\r
101 GOTO :EOF\r
105 GOTO :EOF\r
107 REM Branch to handle copying via robocopy (fast) or xcopy (slow).\r
108 :_copyfiles\r
109 robocopy /? 1> nul 2> nul\r
110 IF NOT "%ERRORLEVEL%"=="9009" (\r
111 robocopy "%FROM%" "%TO%" %TOCOPY% /MT /XX\r
112 ) ELSE (\r
113 IF NOT EXIST "%TO%" mkdir "%TO%"\r
114 call :_xcopy_hack %TOCOPY%\r
116 GOTO :EOF\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
120 :_xcopy_hack\r
121 SHIFT\r
122 IF "%0"=="" GOTO :EOF\r
123 xcopy "%FROM%\%0" "%TO%" /d /y\r
124 GOTO _xcopy_hack\r