Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

284 lines
7.9 KiB

  1. @echo off
  2. ::
  3. :: First we must test the OS.
  4. :: NT provides command line extensions we need
  5. ::
  6. if not "%OS%"=="Windows_NT" goto e_badplt
  7. echo cmdline: %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
  8. echo:
  9. set IC_SENDSTR=Inetcomm propagation batch job started.
  10. net send ATHBUILDER %IC_SENDSTR% > nul
  11. if ERRORLEVEL 1 net send T-ERIKNE2 %IC_SENDSTR% > nul
  12. if ERRORLEVEL 1 net send SBAILEY %IC_SENDSTR% > nul
  13. set IC_ENLIST_ROOT=%_NTDRIVE%\inetcomm
  14. ::
  15. :: Lettuce get a build number
  16. ::
  17. pushd %IC_ENLIST_ROOT%
  18. if defined BLDNUM goto preset
  19. if not exist base goto e_nonum
  20. rem autogenerate it
  21. cat base > __bang$.bat
  22. date /t >> __bang$.bat
  23. call __bang$.bat
  24. del __bang$.bat
  25. rem we have a problem that the month != the build number
  26. rem so we get to munch on digits
  27. set BLDNUM=%BLDNUM:~4,5%
  28. set BLDNUM=%BLDNUM:/=%
  29. set BLDNUM2=%BLDNUM:~0,2%
  30. rem after December 1997, this + 3 should be + 15
  31. set /A BLDNUM2=%BLDNUM2% + 3
  32. if %BLDNUM2% LSS 10 set BLDNUM2=0%BLDNUM2%
  33. set BLDNUM=%BLDNUM2%%BLDNUM:~2,100%
  34. set BLDNUM=%BLDNUM: =%
  35. rem yum. we're done now. bldnum should be somethin' like 0606
  36. set BLDNUM2=
  37. rem if this is a dot release, append that to the number
  38. set IC_DOT=%1
  39. if not "%IC_DOT:~0,1%"=="." goto gotnum
  40. echo [Dot Release]
  41. set BLDNUM=%BLDNUM%%IC_DOT%
  42. shift
  43. goto gotnum
  44. ::
  45. :: Setup
  46. ::
  47. :preset
  48. echo [Using preset bldnum: %BLDNUM%]
  49. set IC_BLDNUM_DIR=%BLDNUM%
  50. goto foo0
  51. :gotnum
  52. set IC_BLDNUM_DIR=bld%BLDNUM%
  53. :foo0
  54. echo Building: %BLDNUM%
  55. echo Propping: %IC_BLDNUM_DIR%
  56. set IC_ROOT=%IC_ENLIST_ROOT%\inetcomm
  57. set IC_DROP=%_NTDRIVE%\drops\inetcomm\%IC_BLDNUM_DIR%
  58. set IC_ALPHA_DROP=%IC_DROP%\alpha
  59. set IC_OLD_SYNCOPT=%_SYNCOPTIONS%
  60. set _SYNCOPTIONS=$fm!
  61. set IC_BUILDSTATE=
  62. set IC_CLEAN_BUILD=-cC
  63. set IC_BUILD_FLAGS=-w
  64. set IC_IMAGENAME=inetcomm
  65. ::
  66. :: Options
  67. ::
  68. :: these options can only be used in position 1
  69. if /I "%1"=="/?" goto usage
  70. if /I "%1"=="-?" goto usage
  71. if /I "%1"=="help" goto usage
  72. shift
  73. :doopt
  74. if /I "%1"=="srconly" goto opt_src
  75. if /I "%1"=="nosync" set IC_NOSYNC=1
  76. if /I "%1"=="rebuild" goto opt_rbld
  77. if "%1"=="" goto postopt
  78. :next
  79. shift
  80. goto doopt
  81. :opt_src
  82. if defined IC_REBUILD goto e_mutex1
  83. set IC_SRCONLY=1
  84. goto next
  85. :opt_rbld
  86. if defined IC_SRCONLY goto e_mutex1
  87. set IC_REBUILD=1
  88. goto next
  89. :postopt
  90. if defined IC_SRCONLY goto dosrc
  91. if not exist %IC_DROP%\nul goto newbuild
  92. if not defined IC_REBUILD goto e_rebld
  93. :: we prompt the user here to make sure
  94. delnode %IC_DROP%
  95. :: if this exists, they bailed
  96. if exist %IC_DROP%\nul goto e_rebld
  97. :newbuild
  98. if defined IC_NOSYNC goto skipsync
  99. :dosync
  100. title Doing ssync...
  101. echo [ IEsync ]
  102. call iesync
  103. cd /d %IC_ENLIST_ROOT%
  104. echo [ %IC_IMAGENAME% ssync ]
  105. ssync -amf!$
  106. goto dobuilds
  107. :skipsync
  108. rem no clean build if there was no ssync
  109. set IC_CLEAN_BUILD=
  110. :dobuilds
  111. ::
  112. :: Builds
  113. ::
  114. set IC_BUILD_FLAGS=%IC_BUILD_FLAGS% %IC_CLEAN_BUILD%
  115. title Doing prebuilds...
  116. set IC_BUILDSTATE=PREBUILD
  117. echo [ building IEDEV ]
  118. cd /d %_NTBINDIR%\private\iedev
  119. call iebuild %IC_BUILD_FLAGS%
  120. if exist buildd.err goto bldbrk
  121. echo [ building WIN ]
  122. cd /d %_NTBINDIR%\private\windows
  123. if defined IC_CLEAN_BUILD goto cleanwin
  124. call iebuild
  125. goto doicbld
  126. :cleanwin
  127. call nmake -fmakefil0 clean1
  128. :doicbld
  129. echo [ building INETCOMM ]
  130. title Building %IC_IMAGENAME% DEBUG...
  131. set IC_BUILDSTATE=DEBUG
  132. cd /d %IC_ENLIST_ROOT%
  133. call iebuild chk nostrip pdb %IC_BUILD_FLAGS%
  134. if exist buildd.err goto bldbrk
  135. title Building %IC_IMAGENAME% RETAIL...
  136. set IC_BUILDSTATE=RETAIL
  137. call iebuild fre nostrip %IC_BUILD_FLAGS%
  138. if exist build.err goto bldbrk
  139. ::
  140. :: Propagations
  141. ::
  142. md %IC_DROP%
  143. if not exist %IC_ALPHA_DROP%\nul md %IC_ALPHA_DROP%
  144. title Propagating %IC_IMAGENAME%...
  145. if not exist %IC_ALPHA_DROP%\debug\nul md %IC_ALPHA_DROP%\debug
  146. copy %_NTBINDIR%\drop\debug\%IC_IMAGENAME%\*.* %IC_ALPHA_DROP%\debug
  147. copy %IC_ROOT%\build\objd\alpha\%IC_IMAGENAME%.lib %IC_ALPHA_DROP%\debug
  148. if not exist %IC_ALPHA_DROP%\retail\nul md %IC_ALPHA_DROP%\retail
  149. copy %IC_ROOT%\build\obj\alpha\%IC_IMAGENAME%.lib %IC_ALPHA_DROP%\retail
  150. binplace -r %IC_ALPHA_DROP%\retail -s . %_NTBINDIR%\drop\retail\%IC_IMAGENAME%\%IC_IMAGENAME%.dll
  151. if not exist %IC_DROP%\inc\nul md %IC_DROP%\inc
  152. copy %_NTBINDIR%\public\sdk\inc\mimeole.h %IC_DROP%\inc
  153. copy %_NTBINDIR%\public\sdk\inc\imnact.h %IC_DROP%\inc
  154. copy %_NTBINDIR%\public\sdk\inc\imnxport.h %IC_DROP%\inc
  155. copy %_NTBINDIR%\private\iedev\inc\mimeole.idl %IC_DROP%\inc
  156. copy %_NTBINDIR%\private\iedev\inc\imnact.idl %IC_DROP%\inc
  157. copy %_NTBINDIR%\private\iedev\inc\imnxport.idl %IC_DROP%\inc
  158. copy %IC_ROOT%\help\inetcomm.hlp %IC_DROP%\inc
  159. ::
  160. :: Do the source copies
  161. :: should always copy this once
  162. ::
  163. if not exist %IC_DROP%\src\nul goto dosrc
  164. if not "%1"=="source" goto exit
  165. :dosrc
  166. echo Copying sources...
  167. xcopy /s /v /i /c /q %IC_ENLIST_ROOT% %IC_DROP%\src
  168. cd /d %IC_DROP%\src
  169. dir /s/b/l obj > turds
  170. dir /s/b/l objd >> turds
  171. REM TODO: need to account for case of the environment variable
  172. call sed "s/%_NTDRIVE%/delnode \/q %_NTDRIVE%/g" <turds >delobj.bat
  173. call delobj.bat
  174. del delobj.bat
  175. del turds
  176. del base
  177. del *.bat
  178. popd
  179. set IC_SENDSTR=%IC_IMAGENAME% build is complete (%BLDNUM%).
  180. net send ATHBUILDER %IC_SENDSTR% > nul
  181. if ERRORLEVEL 1 net send T-ERIKNE2 %IC_SENDSTR% > nul
  182. if ERRORLEVEL 1 net send SBAILEY %IC_SENDSTR% > nul
  183. goto exit
  184. :e_nonum
  185. echo Build number must be set. ex: 0912
  186. echo please run setbldnm.bat
  187. goto exit
  188. :e_rebld
  189. echo This build has already been propagated!
  190. echo Run "prop rebuild" to override, otherwise
  191. echo change the build number with setbldnm.bat
  192. echo:
  193. echo num is %BLDNUM% ~~ dir is %IC_DROP%
  194. goto out
  195. :e_mutex1
  196. echo The options REBUILD and SRCONLY cannot both be specified
  197. goto exit
  198. :bldbrk
  199. title BUILD BREAK!
  200. echo !BUILD IS BROKEN!
  201. set IC_SENDSTR=%IC_IMAGENAME% build is broken in %IC_BUILDSTATE%.
  202. net send ATHBUILDER %IC_SENDSTR% > nul
  203. if ERRORLEVEL 1 net send T-ERIKNE2 %IC_SENDSTR% > nul
  204. if ERRORLEVEL 1 net send SBAILEY %IC_SENDSTR% > nul
  205. goto exit
  206. :e_badplt
  207. echo Windows NT is required for this batch file
  208. goto exit
  209. :usage
  210. echo ************************************************************************
  211. echo * *
  212. echo * Purpose: to automate the *
  213. echo * Usage: prop [dot] [options] -- build a daily build of inetcomm *
  214. echo * *
  215. echo * [dot] is an optional parameter specified to get a "dot" release, *
  216. echo * e.g. 0314.1. ex: prop .2 *
  217. echo * *
  218. echo * [options] *
  219. echo * srconly -- this will skip the build steps and just to a source *
  220. echo * drop. good for builds that you've done by hand. *
  221. echo * nosync -- skip the ssyncs. if the build has failed, use this *
  222. echo * after you've done a selective ssync or a hand fix *
  223. echo * rebuild -- if you run prop twice in a row, the second run will *
  224. echo * fail b/c the directory structure of the release *
  225. echo * point already exists. use this option to override *
  226. echo * and recopy everything. often used with nosync *
  227. echo * /?, -? -- this text *
  228. echo * *
  229. echo * NOTE : must be run on NT *
  230. echo * *
  231. echo ************************************************************************
  232. goto exit
  233. :exit
  234. set _SYNCOPTIONS=%IC_OLD_SYNCOPT%
  235. call proprset.bat
  236. echo Exiting...
  237. echo:
  238. goto out
  239. :out