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
14 @rem Process arguments.
37 if "%1"=="" goto args-done
38 if /i "%1"=="debug" set config=Debug&goto arg-ok
39 if /i "%1"=="release" set config=Release&goto arg-ok
40 if /i "%1"=="clean" set target=Clean&goto arg-ok
41 if /i "%1"=="ia32" set target_arch=ia32&goto arg-ok
42 if /i "%1"=="x86" set target_arch=ia32&goto arg-ok
43 if /i "%1"=="x64" set target_arch=x64&goto arg-ok
44 if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok
45 if /i "%1"=="nobuild" set nobuild=1&goto arg-ok
46 if /i "%1"=="nosign" set nosign=1&goto arg-ok
47 if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok
48 if /i "%1"=="noetw" set noetw=1&goto arg-ok
49 if /i "%1"=="licensertf" set licensertf=1&goto arg-ok
50 if /i "%1"=="test-uv" set test=test-uv&goto arg-ok
51 if /i "%1"=="test-internet" set test=test-internet&goto arg-ok
52 if /i "%1"=="test-pummel" set test=test-pummel&goto arg-ok
53 if /i "%1"=="test-simple" set test=test-simple&goto arg-ok
54 if /i "%1"=="test-message" set test=test-message&goto arg-ok
55 if /i "%1"=="test-gc" set test=test-gc&set buildnodeweak=1&goto arg-ok
56 if /i "%1"=="test-all" set test=test-all&set buildnodeweak=1&goto arg-ok
57 if /i "%1"=="test" set test=test&goto arg-ok
58 if /i "%1"=="msi" set msi=1&set licensertf=1&goto arg-ok
59 if /i "%1"=="upload" set upload=1&goto arg-ok
60 if /i "%1"=="jslint" set jslint=1&goto arg-ok
62 echo Warning: ignoring invalid command line option `%1`.
70 if defined upload goto upload
71 if defined jslint goto jslint
73 if "%config%"=="Debug" set debug_arg=--debug
74 if "%target_arch%"=="x64" set msiplatform=x64
75 if defined nosnapshot set nosnapshot_arg=--without-snapshot
76 if defined noetw set noetw_arg=--without-etw& set noetw_msi_arg=/p:NoETW=1
79 @rem Skip project generation if requested.
80 if defined noprojgen goto msbuild
82 @rem Generate the VS project.
83 python configure %debug_arg% %nosnapshot_arg% %noetw_arg% --dest-cpu=%target_arch%
84 if errorlevel 1 goto create-msvs-files-failed
85 if not exist node.sln goto create-msvs-files-failed
86 echo Project files generated.
89 @rem Skip project generation if requested.
90 if defined nobuild goto sign
92 @rem Bail out early if not running in VS build env.
93 if defined VCINSTALLDIR goto msbuild-found
94 if not defined VS100COMNTOOLS goto msbuild-not-found
95 if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
96 call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat"
97 if not defined VCINSTALLDIR goto msbuild-not-found
101 echo Build skipped. To build, this file needs to run from VS cmd prompt.
105 @rem Build the sln with msbuild.
106 msbuild node.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
107 if errorlevel 1 goto exit
110 @rem Skip signing if the `nosign` option was specified.
111 if defined nosign goto licensertf
113 signtool sign /a Release\node.exe
116 @rem Skip license.rtf generation if not requested.
117 if not defined licensertf goto msi
119 %config%\node tools\license2rtf.js < LICENSE > %config%\license.rtf
120 if errorlevel 1 echo Failed to generate license.rtf&goto exit
123 @rem Skip msi generation if not requested
124 if not defined msi goto run
125 python "%~dp0tools\getnodeversion.py" > "%temp%\node_version.txt"
126 if not errorlevel 0 echo Cannot determine current version of node.js & goto exit
127 for /F "tokens=*" %%i in (%temp%\node_version.txt) do set NODE_VERSION=%%i
128 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
129 if errorlevel 1 goto exit
131 if defined nosign goto run
132 signtool sign /a Release\node-v%NODE_VERSION%-%msiplatform%.msi
135 @rem Run tests if requested.
136 if "%test%"=="" goto exit
138 if "%config%"=="Debug" set test_args=--mode=debug
139 if "%config%"=="Release" set test_args=--mode=release
141 if "%test%"=="test" set test_args=%test_args% simple message
142 if "%test%"=="test-internet" set test_args=%test_args% internet
143 if "%test%"=="test-pummel" set test_args=%test_args% pummel
144 if "%test%"=="test-simple" set test_args=%test_args% simple
145 if "%test%"=="test-message" set test_args=%test_args% message
146 if "%test%"=="test-gc" set test_args=%test_args% gc
147 if "%test%"=="test-all" set test_args=%test_args%
150 @rem Build node-weak if required
151 if "%buildnodeweak%"=="" goto run-tests
152 "%config%\node" deps\npm\node_modules\node-gyp\bin\node-gyp rebuild --directory="%~dp0test\gc\node_modules\weak" --nodedir="%~dp0."
153 if errorlevel 1 goto build-node-weak-failed
156 :build-node-weak-failed
157 echo Failed to build node-weak.
161 echo running 'python tools/test.py %test_args%'
162 python tools/test.py %test_args%
163 if "%test%"=="test" goto jslint
166 :create-msvs-files-failed
167 echo Failed to create vc project files.
171 echo uploading .exe .msi .pdb to nodejs.org
172 python "%~dp0tools\getnodeversion.py" > "%temp%\node_version.txt"
173 if not errorlevel 0 echo Cannot determine current version of node.js & goto exit
174 for /F "tokens=*" %%i in (%temp%\node_version.txt) do set NODE_VERSION=%%i
176 ssh node@nodejs.org mkdir -p web/nodejs.org/dist/v%NODE_VERSION%
177 scp Release\node.msi node@nodejs.org:~/web/nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%.msi
178 scp Release\node.exe node@nodejs.org:~/web/nodejs.org/dist/v%NODE_VERSION%/node.exe
179 scp Release\node.pdb node@nodejs.org:~/web/nodejs.org/dist/v%NODE_VERSION%/node.pdb
185 set PYTHONPATH=tools/closure_linter/
186 python tools/closure_linter/closure_linter/gjslint.py --unix_mode --strict --nojsdoc -r lib/ -r src/ -r test/ --exclude_files lib/punycode.js
190 echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [nobuild] [nosign] [x86/x64]
192 echo vcbuild.bat : builds release build
193 echo vcbuild.bat debug : builds debug build
194 echo vcbuild.bat release msi : builds release build and MSI installer package
195 echo vcbuild.bat test : builds debug build and runs tests