The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.
Please select the desired protocol below to get the URL.
This URL has Read-Only access.
main_repo / vcbuild.bat @ 35a1421e
History | View | Annotate | Download (6.21 KB)
1 |
@echo off |
---|---|
2 |
|
3 |
cd %~dp0 |
4 |
|
5 |
if /i "%1"=="help" goto help |
6 |
if /i "%1"=="--help" goto help |
7 |
if /i "%1"=="-help" goto help |
8 |
if /i "%1"=="/help" goto help |
9 |
if /i "%1"=="?" goto help |
10 |
if /i "%1"=="-?" goto help |
11 |
if /i "%1"=="--?" goto help |
12 |
if /i "%1"=="/?" goto help |
13 |
|
14 |
@rem Process arguments. |
15 |
set config=Release |
16 |
set msiplatform=x86 |
17 |
set target=Build |
18 |
set target_arch=ia32 |
19 |
set debug_arg= |
20 |
set nosnapshot_arg= |
21 |
set noprojgen= |
22 |
set nobuild= |
23 |
set nosign= |
24 |
set nosnapshot= |
25 |
set test= |
26 |
set test_args= |
27 |
set msi= |
28 |
set licensertf= |
29 |
set upload= |
30 |
set jslint= |
31 |
set noetw= |
32 |
set noetw_arg= |
33 |
set noetw_msi_arg= |
34 |
|
35 |
:next-arg |
36 |
if "%1"=="" goto args-done |
37 |
if /i "%1"=="debug" set config=Debug&goto arg-ok |
38 |
if /i "%1"=="release" set config=Release&goto arg-ok |
39 |
if /i "%1"=="clean" set target=Clean&goto arg-ok |
40 |
if /i "%1"=="ia32" set target_arch=ia32&goto arg-ok |
41 |
if /i "%1"=="x86" set target_arch=ia32&goto arg-ok |
42 |
if /i "%1"=="x64" set target_arch=x64&goto arg-ok |
43 |
if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok |
44 |
if /i "%1"=="nobuild" set nobuild=1&goto arg-ok |
45 |
if /i "%1"=="nosign" set nosign=1&goto arg-ok |
46 |
if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok |
47 |
if /i "%1"=="noetw" set noetw=1&goto arg-ok |
48 |
if /i "%1"=="licensertf" set licensertf=1&goto arg-ok |
49 |
if /i "%1"=="test-uv" set test=test-uv&goto arg-ok |
50 |
if /i "%1"=="test-internet" set test=test-internet&goto arg-ok |
51 |
if /i "%1"=="test-pummel" set test=test-pummel&goto arg-ok |
52 |
if /i "%1"=="test-simple" set test=test-simple&goto arg-ok |
53 |
if /i "%1"=="test-message" set test=test-message&goto arg-ok |
54 |
if /i "%1"=="test-all" set test=test-all&goto arg-ok |
55 |
if /i "%1"=="test" set test=test&goto arg-ok |
56 |
if /i "%1"=="msi" set msi=1&set licensertf=1&goto arg-ok |
57 |
if /i "%1"=="upload" set upload=1&goto arg-ok |
58 |
if /i "%1"=="jslint" set jslint=1&goto arg-ok |
59 |
|
60 |
echo Warning: ignoring invalid command line option `%1`. |
61 |
|
62 |
:arg-ok |
63 |
shift |
64 |
goto next-arg |
65 |
:args-done |
66 |
if defined upload goto upload |
67 |
if defined jslint goto jslint |
68 |
|
69 |
if "%config%"=="Debug" set debug_arg=--debug |
70 |
if "%target_arch%"=="x64" set msiplatform=x64 |
71 |
if defined nosnapshot set nosnapshot_arg=--without-snapshot |
72 |
if defined noetw set noetw_arg=--without-etw& set noetw_msi_arg=/p:NoETW=1 |
73 |
|
74 |
:project-gen |
75 |
@rem Skip project generation if requested. |
76 |
if defined noprojgen goto msbuild |
77 |
|
78 |
@rem Generate the VS project. |
79 |
python configure %debug_arg% %nosnapshot_arg% %noetw_arg% --dest-cpu=%target_arch% |
80 |
if errorlevel 1 goto create-msvs-files-failed |
81 |
if not exist node.sln goto create-msvs-files-failed |
82 |
echo Project files generated. |
83 |
|
84 |
:msbuild |
85 |
@rem Skip project generation if requested. |
86 |
if defined nobuild goto sign |
87 |
|
88 |
@rem Bail out early if not running in VS build env. |
89 |
if defined VCINSTALLDIR goto msbuild-found |
90 |
if not defined VS100COMNTOOLS goto msbuild-not-found |
91 |
if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found |
92 |
call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" |
93 |
if not defined VCINSTALLDIR goto msbuild-not-found |
94 |
goto msbuild-found |
95 |
|
96 |
:msbuild-not-found |
97 |
echo Build skipped. To build, this file needs to run from VS cmd prompt. |
98 |
goto run |
99 |
|
100 |
:msbuild-found |
101 |
@rem Build the sln with msbuild. |
102 |
msbuild node.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo |
103 |
if errorlevel 1 goto exit |
104 |
|
105 |
:sign |
106 |
@rem Skip signing if the `nosign` option was specified. |
107 |
if defined nosign goto licensertf |
108 |
|
109 |
signtool sign /a Release\node.exe |
110 |
|
111 |
:licensertf |
112 |
@rem Skip license.rtf generation if not requested. |
113 |
if not defined licensertf goto msi |
114 |
|
115 |
%config%\node tools\license2rtf.js < LICENSE > %config%\license.rtf |
116 |
if errorlevel 1 echo Failed to generate license.rtf&goto exit |
117 |
|
118 |
:msi |
119 |
@rem Skip msi generation if not requested |
120 |
if not defined msi goto run |
121 |
python "%~dp0tools\getnodeversion.py" > "%temp%\node_version.txt" |
122 |
if not errorlevel 0 echo Cannot determine current version of node.js & goto exit |
123 |
for /F "tokens=*" %%i in (%temp%\node_version.txt) do set NODE_VERSION=%%i |
124 |
msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build /p:Configuration=%config% /p:Platform=%msiplatform% /p:NodeVersion=%NODE_VERSION% %noetw_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo |
125 |
if errorlevel 1 goto exit |
126 |
|
127 |
if defined nosign goto run |
128 |
signtool sign /a Release\node-v%NODE_VERSION%-%msiplatform%.msi |
129 |
|
130 |
:run |
131 |
@rem Run tests if requested. |
132 |
if "%test%"=="" goto exit |
133 |
|
134 |
if "%config%"=="Debug" set test_args=--mode=debug |
135 |
if "%config%"=="Release" set test_args=--mode=release |
136 |
|
137 |
if "%test%"=="test" set test_args=%test_args% simple message |
138 |
if "%test%"=="test-internet" set test_args=%test_args% internet |
139 |
if "%test%"=="test-pummel" set test_args=%test_args% pummel |
140 |
if "%test%"=="test-simple" set test_args=%test_args% simple |
141 |
if "%test%"=="test-message" set test_args=%test_args% message |
142 |
if "%test%"=="test-all" set test_args=%test_args% |
143 |
|
144 |
echo running 'python tools/test.py %test_args%' |
145 |
python tools/test.py %test_args% |
146 |
|
147 |
if "%test%"=="test" goto jslint |
148 |
|
149 |
goto exit |
150 |
|
151 |
:create-msvs-files-failed |
152 |
echo Failed to create vc project files. |
153 |
goto exit |
154 |
|
155 |
:upload |
156 |
echo uploading .exe .msi .pdb to nodejs.org |
157 |
python "%~dp0tools\getnodeversion.py" > "%temp%\node_version.txt" |
158 |
if not errorlevel 0 echo Cannot determine current version of node.js & goto exit |
159 |
for /F "tokens=*" %%i in (%temp%\node_version.txt) do set NODE_VERSION=%%i |
160 |
@echo on |
161 |
ssh node@nodejs.org mkdir -p web/nodejs.org/dist/v%NODE_VERSION% |
162 |
scp Release\node.msi node@nodejs.org:~/web/nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%.msi |
163 |
scp Release\node.exe node@nodejs.org:~/web/nodejs.org/dist/v%NODE_VERSION%/node.exe |
164 |
scp Release\node.pdb node@nodejs.org:~/web/nodejs.org/dist/v%NODE_VERSION%/node.pdb |
165 |
@echo off |
166 |
goto exit |
167 |
|
168 |
:jslint |
169 |
echo running jslint |
170 |
set PYTHONPATH=tools/closure_linter/ |
171 |
python tools/closure_linter/closure_linter/gjslint.py --unix_mode --strict --nojsdoc -r lib/ -r src/ -r test/ --exclude_files lib/punycode.js |
172 |
goto exit |
173 |
|
174 |
:help |
175 |
echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [nobuild] [nosign] [x86/x64] |
176 |
echo Examples: |
177 |
echo vcbuild.bat : builds release build |
178 |
echo vcbuild.bat debug : builds debug build |
179 |
echo vcbuild.bat release msi : builds release build and MSI installer package |
180 |
echo vcbuild.bat test : builds debug build and runs tests |
181 |
goto exit |
182 |
|
183 |
:exit |