docs: add note about default padding in crypto
[platform/upstream/nodejs.git] / vcbuild.bat
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 snapshot_arg=
21 set noprojgen=
22 set nobuild=
23 set nosign=
24 set snapshot=
25 set test=
26 set test_args=
27 set msi=
28 set licensertf=
29 set jslint=
30 set buildnodeweak=
31 set noetw=
32 set noetw_arg=
33 set noetw_msi_arg=
34 set noperfctr=
35 set noperfctr_arg=
36 set noperfctr_msi_arg=
37 set i18n_arg=
38 set download_arg=
39
40 :next-arg
41 if "%1"=="" goto args-done
42 if /i "%1"=="debug"         set config=Debug&goto arg-ok
43 if /i "%1"=="release"       set config=Release&goto arg-ok
44 if /i "%1"=="clean"         set target=Clean&goto arg-ok
45 if /i "%1"=="ia32"          set target_arch=ia32&goto arg-ok
46 if /i "%1"=="x86"           set target_arch=ia32&goto arg-ok
47 if /i "%1"=="x64"           set target_arch=x64&goto arg-ok
48 if /i "%1"=="noprojgen"     set noprojgen=1&goto arg-ok
49 if /i "%1"=="nobuild"       set nobuild=1&goto arg-ok
50 if /i "%1"=="nosign"        set nosign=1&goto arg-ok
51 if /i "%1"=="snapshot"      set snapshot=1&goto arg-ok
52 if /i "%1"=="noetw"         set noetw=1&goto arg-ok
53 if /i "%1"=="noperfctr"     set noperfctr=1&goto arg-ok
54 if /i "%1"=="licensertf"    set licensertf=1&goto arg-ok
55 if /i "%1"=="test-uv"       set test=test-uv&goto arg-ok
56 if /i "%1"=="test-internet" set test=test-internet&goto arg-ok
57 if /i "%1"=="test-pummel"   set test=test-pummel&goto arg-ok
58 if /i "%1"=="test-simple"   set test=test-simple&goto arg-ok
59 if /i "%1"=="test-message"  set test=test-message&goto arg-ok
60 if /i "%1"=="test-gc"       set test=test-gc&set buildnodeweak=1&goto arg-ok
61 if /i "%1"=="test-all"      set test=test-all&set buildnodeweak=1&goto arg-ok
62 if /i "%1"=="test"          set test=test&goto arg-ok
63 if /i "%1"=="msi"           set msi=1&set licensertf=1&goto arg-ok
64 if /i "%1"=="jslint"        set jslint=1&goto arg-ok
65 if /i "%1"=="small-icu"     set i18n_arg=%1&goto arg-ok
66 if /i "%1"=="full-icu"      set i18n_arg=%1&goto arg-ok
67 if /i "%1"=="intl-none"     set i18n_arg=%1&goto arg-ok
68 if /i "%1"=="download-all"  set download_arg="--download=all"&goto arg-ok
69
70 echo Warning: ignoring invalid command line option `%1`.
71
72 :arg-ok
73 :arg-ok
74 shift
75 goto next-arg
76
77 :args-done
78 if defined jslint goto jslint
79
80 if "%config%"=="Debug" set debug_arg=--debug
81 if "%target_arch%"=="x64" set msiplatform=x64
82 if defined snapshot set snapshot_arg=--with-snapshot
83 if defined noetw set noetw_arg=--without-etw& set noetw_msi_arg=/p:NoETW=1
84 if defined noperfctr set noperfctr_arg=--without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1
85
86 if "%i18n_arg%"=="full-icu" set i18n_arg=--with-intl=full-icu
87 if "%i18n_arg%"=="small-icu" set i18n_arg=--with-intl=small-icu
88 if "%i18n_arg%"=="intl-none" set i18n_arg=--with-intl=none
89
90 :project-gen
91 @rem Skip project generation if requested.
92 if defined noprojgen goto msbuild
93
94 if defined NIGHTLY set TAG=nightly-%NIGHTLY%
95
96 @rem Generate the VS project.
97 SETLOCAL
98   if defined VS100COMNTOOLS call "%VS100COMNTOOLS%\VCVarsQueryRegistry.bat"
99   python configure %download_arg% %i18n_arg% %debug_arg% %snapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG%
100   if errorlevel 1 goto create-msvs-files-failed
101   if not exist node.sln goto create-msvs-files-failed
102   echo Project files generated.
103 ENDLOCAL
104
105 :msbuild
106 @rem Skip project generation if requested.
107 if defined nobuild goto sign
108
109 @rem Look for Visual Studio 2013
110 if not defined VS120COMNTOOLS goto msbuild-not-found
111 if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
112 if "%VCVARS_VER%" NEQ "120" (
113   call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat"
114   SET VCVARS_VER=120
115 )
116 if not defined VCINSTALLDIR goto msbuild-not-found
117 set GYP_MSVS_VERSION=2013
118 goto msbuild-found
119
120 :msbuild-not-found
121 echo Build skipped. To build, this file needs to run from VS cmd prompt.
122 goto run
123
124 :msbuild-found
125 @rem Build the sln with msbuild.
126 msbuild node.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
127 if errorlevel 1 goto exit
128
129 :sign
130 @rem Skip signing if the `nosign` option was specified.
131 if defined nosign goto licensertf
132
133 signtool sign /a /d "io.js" /t http://timestamp.globalsign.com/scripts/timestamp.dll Release\iojs.exe
134 if errorlevel 1 echo Failed to sign exe&goto exit
135
136 :licensertf
137 @rem Skip license.rtf generation if not requested.
138 if not defined licensertf goto msi
139
140 %config%\iojs tools\license2rtf.js < LICENSE > %config%\license.rtf
141 if errorlevel 1 echo Failed to generate license.rtf&goto exit
142
143 :msi
144 @rem Skip msi generation if not requested
145 if not defined msi goto run
146 call :getnodeversion
147
148 if not defined NIGHTLY goto msibuild
149 set NODE_VERSION=%NODE_VERSION%.%NIGHTLY%
150
151 :msibuild
152 echo Building iojs-%NODE_VERSION%
153 msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build /p:Configuration=%config% /p:Platform=%msiplatform% /p:NodeVersion=%NODE_VERSION% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
154 if errorlevel 1 goto exit
155
156 if defined nosign goto run
157 signtool sign /a /d "io.js" /t http://timestamp.globalsign.com/scripts/timestamp.dll Release\iojs-v%NODE_VERSION%-%msiplatform%.msi
158 if errorlevel 1 echo Failed to sign msi&goto exit
159
160 :run
161 @rem Run tests if requested.
162 if "%test%"=="" goto exit
163
164 if "%config%"=="Debug" set test_args=--mode=debug
165 if "%config%"=="Release" set test_args=--mode=release
166
167 if "%test%"=="test" set test_args=%test_args% sequential parallel message -J
168 if "%test%"=="test-internet" set test_args=%test_args% internet
169 if "%test%"=="test-pummel" set test_args=%test_args% pummel
170 if "%test%"=="test-simple" set test_args=%test_args% sequential parallel
171 if "%test%"=="test-message" set test_args=%test_args% message
172 if "%test%"=="test-gc" set test_args=%test_args% gc
173 if "%test%"=="test-all" set test_args=%test_args%
174
175 :build-node-weak
176 @rem Build node-weak if required
177 if "%buildnodeweak%"=="" goto run-tests
178 "%config%\node" deps\npm\node_modules\node-gyp\bin\node-gyp rebuild --directory="%~dp0test\gc\node_modules\weak" --nodedir="%~dp0."
179 if errorlevel 1 goto build-node-weak-failed
180 goto run-tests
181
182 :build-node-weak-failed
183 echo Failed to build node-weak.
184 goto exit
185
186 :run-tests
187 echo running 'python tools/test.py %test_args%'
188 python tools/test.py %test_args%
189 if "%test%"=="test" goto jslint
190 goto exit
191
192 :create-msvs-files-failed
193 echo Failed to create vc project files. 
194 goto exit
195
196 :jslint
197 echo running jslint
198 set PYTHONPATH=tools/closure_linter/;tools/gflags/
199 python tools/closure_linter/closure_linter/gjslint.py --unix_mode --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
200 goto exit
201
202 :help
203 echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/intl-none] [nobuild] [nosign] [x86/x64] [download-all]
204 echo Examples:
205 echo   vcbuild.bat                : builds release build
206 echo   vcbuild.bat debug          : builds debug build
207 echo   vcbuild.bat release msi    : builds release build and MSI installer package
208 echo   vcbuild.bat test           : builds debug build and runs tests
209 goto exit
210
211 :exit
212 goto :EOF
213
214 rem ***************
215 rem   Subroutines
216 rem ***************
217
218 :getnodeversion
219 set NODE_VERSION=
220 for /F "usebackq tokens=*" %%i in (`python "%~dp0tools\getnodeversion.py"`) do set NODE_VERSION=%%i
221 if not defined NODE_VERSION echo Cannot determine current version of io.js & exit /b 1
222 goto :EOF