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.

288 lines
11 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM sfcgen.cmd - VijeshS
  4. @REM Builds sfcfiles.dll for each sku using the current infs
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @if NOT defined HOST_PROCESSOR_ARCHITECTURE set HOST_PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITECTURE%
  10. @if defined _CPCMAGIC goto CPCBegin
  11. @perl -x "%~f0" %*
  12. @goto :EOF
  13. #!perl
  14. use strict;
  15. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  16. use lib $ENV{RAZZLETOOLPATH};
  17. use PbuildEnv;
  18. use ParseArgs;
  19. sub Usage { print<<USAGE; exit(1) }
  20. sfcgen [-l <language>]
  21. Builds sfcfiles.dll for each sku using the current infs
  22. USAGE
  23. parseargs('?' => \&Usage);
  24. # *** TEMPLATE CODE ***
  25. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  26. __END__
  27. @:CPCBegin
  28. @set _CPCMAGIC=
  29. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  30. @if not defined DEBUG echo off
  31. @REM *** CMD SCRIPT BELOW ***
  32. REM 1. go into sm\sfc\files\%lang% directory
  33. REM 2. run 4 copies of filegen based on architecture
  34. REM 3. when these finish, force a rebuild of sfcfiles.dll in this directory
  35. REM 4. if we're on the US free build machines, checkin the proper header changes
  36. REM preconditions
  37. REM 1. sfcgen.inf is present in the dump directory
  38. REM 2. infs have been generated in all binaries directories (srvinf, etc.)
  39. REM Define "myarchitecture" as the architecture that we're processing.
  40. REM
  41. REM we use the %_BuildArch% variable if it's set, otherwise we fall back on
  42. REM %HOST_PROCESSOR_ARCHITECTURE%
  43. REM
  44. if not defined myarchitecture (
  45. if defined _BuildArch (
  46. set myarchitecture=%_BuildArch%
  47. ) else (
  48. set myarchitecture=%HOST_PROCESSOR_ARCHITECTURE%
  49. )
  50. )
  51. if not defined myarchitecture (
  52. call errmsg.cmd "variable myarchitecture not defined."
  53. goto end
  54. )
  55. REM Verify existence of input inf
  56. set inputinf=%_NTPostBld%\congeal_scripts\sfcgen.inf
  57. if not exist %inputinf% (
  58. call errmsg.cmd "Input inf %inputinf% not found."
  59. goto end
  60. )
  61. echo binaries = %_NTPostBld%
  62. echo inputinf = %inputinf%
  63. REM Verify existence of build directory
  64. pushd .
  65. call ExecuteCmd.cmd "if not exist %_NTPostBld%\congeal_scripts\autogen md %_NTPostBld%\congeal_scripts\autogen"
  66. REM call ExecuteCmd.cmd "cd /d %_NTPostBld%\congeal_scripts\autogen"
  67. REM if errorlevel 1 popd& goto end
  68. cd /d %_NTPostBld%\congeal_scripts\autogen
  69. cd
  70. if errorlevel 1 popd& goto end
  71. REM Cleanup infs in proper temp subdirectory
  72. REM Get the product flavors (wks, per, bla, sbs, srv, ent, dtc) for the given language.
  73. REM wks is applicable to all languages.
  74. set prods=wks
  75. perl %RazzleToolPath%\cksku.pm -t:pro -l:%lang%
  76. if %errorlevel% EQU 0 (set prods=%prods% wks& set _WKS=1)
  77. perl %RazzleToolPath%\cksku.pm -t:per -l:%lang%
  78. if %errorlevel% EQU 0 (set prods=%prods% per& set _PER=1)
  79. perl %RazzleToolPath%\cksku.pm -t:bla -l:%lang%
  80. if %errorlevel% EQU 0 (set prods=%prods% bla& set _BLA=1)
  81. perl %RazzleToolPath%\cksku.pm -t:sbs -l:%lang%
  82. if %errorlevel% EQU 0 (set prods=%prods% sbs& set _SBS=1)
  83. perl %RazzleToolPath%\cksku.pm -t:srv -l:%lang%
  84. if %errorlevel% EQU 0 (set prods=%prods% srv& set _SRV=1)
  85. perl %RazzleToolPath%\cksku.pm -t:ads -l:%lang%
  86. if %errorlevel% EQU 0 (set prods=%prods% ent& set _ENT=1)
  87. perl %RazzleToolPath%\cksku.pm -t:dtc -l:%lang%
  88. if %errorlevel% EQU 0 (set prods=%prods% dtc& set _DTC=1)
  89. for %%i in (%prods%) do (
  90. call ExecuteCmd.cmd "if not exist %_NTPostBld%\build_logs\%myarchitecture%%%i md %_NTPostBld%\build_logs\%myarchitecture%%%i"
  91. if errorlevel 1 popd& goto end
  92. call ExecuteCmd.cmd "if exist %_NTPostBld%\build_logs\%myarchitecture%%%i\*.inf del /q /f %_NTPostBld%\build_logs\%myarchitecture%%%i\*.inf 2>nul"
  93. )
  94. cd
  95. REM kickoff filegen
  96. call logmsg.cmd /t "Running copies of filegen."
  97. REM BUGBUG need to redirect output from filegen.exe to per product logfile
  98. REM WKS
  99. REM the funny for loop is so we can easily associate the product one-letter
  100. REM descriptor to the three letter descriptor
  101. set EventList=
  102. for %%a in (Wks.w Per.p Bla.b Sbs.l Srv.s Ent.a Dtc.d) do (
  103. echo Inside for loop says '%%a'
  104. for /f "tokens=1,2 delims=." %%b in ('echo %%a') do (
  105. set ProductType=%%b
  106. set ProductLetter=%%c
  107. echo ProductType is '!ProductType!'
  108. echo ProductLetter is '!ProductLetter!'
  109. REM kick off filegen wrapper if this product is defined
  110. if defined _!ProductType! (
  111. set EventList=!EventList! sfcgen.!ProductType!
  112. start /min cmd /c %RazzleToolPath%\PostBuildScripts\sfcwrap.cmd !ProductType! !ProductLetter!
  113. )
  114. )
  115. )
  116. REM now wait on all events we started
  117. if defined EventList perl %RazzleToolPath%\PostBuildScripts\cmdevt.pl -iwv !EventList!
  118. :AllDone
  119. call logmsg.cmd /t "filegen is complete."
  120. REM Now that the headers are build, compare them against the checked in
  121. REM (and binplaced) headers.
  122. goto jump_for_now
  123. REM WKS
  124. fc /l /c %_NTPostBld%\congeal_scripts\%myarchitecture%_wks.h %_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_wks.h
  125. if errorlevel 1 (
  126. call logmsg.cmd "Warning : Checked in header (admin\published\sfclist\%myarchitecture%_wks.h) did not match autogenerated version (%_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_wks.h)."
  127. call logmsg.cmd "Warning : If you added/removed files from the product, you must also update the headers under admin\published\sfclist"
  128. call logmsg.cmd "Warning : Do this by verifying the autogenerated header and checking it in. Avoid hand-editing the headers."
  129. set %errorlevel%=0
  130. )
  131. REM PER
  132. if defined _PER (
  133. fc /l /c %_NTPostBld%\congeal_scripts\%myarchitecture%_per.h %_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_per.h
  134. if errorlevel 1 (
  135. call logmsg.cmd "Warning : Checked in header (admin\published\sfclist\%myarchitecture%_per.h) did not match autogenerated version (%_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_per.h)."
  136. call logmsg.cmd "Warning : If you added/removed files from the product, you must also update the headers under admin\published\sfclist"
  137. call logmsg.cmd "Warning : Do this by verifying the autogenerated header and checking it in. Avoid hand-editing the headers."
  138. set %errorlevel%=0
  139. )
  140. )
  141. REM BLA
  142. if defined _BLA (
  143. fc /l /c %_NTPostBld%\congeal_scripts\%myarchitecture%_bla.h %_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_bla.h
  144. if errorlevel 1 (
  145. call logmsg.cmd "Warning : Checked in header (admin\published\sfclist\%myarchitecture%_bla.h) did not match autogenerated version (%_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_bla.h)."
  146. call logmsg.cmd "Warning : If you added/removed files from the product, you must also update the headers under admin\published\sfclist"
  147. call logmsg.cmd "Warning : Do this by verifying the autogenerated header and checking it in. Avoid hand-editing the headers."
  148. set %errorlevel%=0
  149. )
  150. )
  151. REM SBS
  152. if defined _SBS (
  153. fc /l /c %_NTPostBld%\congeal_scripts\%myarchitecture%_sbs.h %_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_sbs.h
  154. if errorlevel 1 (
  155. call logmsg.cmd "Warning : Checked in header (admin\published\sfclist\%myarchitecture%_sbs.h) did not match autogenerated version (%_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_sbs.h)."
  156. call logmsg.cmd "Warning : If you added/removed files from the product, you must also update the headers under admin\published\sfclist"
  157. call logmsg.cmd "Warning : Do this by verifying the autogenerated header and checking it in. Avoid hand-editing the headers."
  158. set %errorlevel%=0
  159. )
  160. )
  161. REM SRV
  162. if defined _SRV (
  163. fc /l /c %_NTPostBld%\congeal_scripts\%myarchitecture%_srv.h %_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_srv.h
  164. if errorlevel 1 (
  165. call logmsg.cmd "Warning : Checked in header (admin\published\sfclist\%myarchitecture%_srv.h) did not match autogenerated version (%_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_srv.h)."
  166. call logmsg.cmd "Warning : If you added/removed files from the product, you must also update the headers under admin\published\sfclist"
  167. call logmsg.cmd "Warning : Do this by verifying the autogenerated header and checking it in. Avoid hand-editing the headers."
  168. set %errorlevel%=0
  169. )
  170. )
  171. REM ENT
  172. if defined _ENT (
  173. fc /l /c %_NTPostBld%\congeal_scripts\%myarchitecture%_ent.h %_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_ent.h
  174. if errorlevel 1 (
  175. call logmsg.cmd "Warning : Checked in header (admin\published\sfclist\%myarchitecture%_ent.h) did not match autogenerated version (%_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_ent.h)."
  176. call logmsg.cmd "Warning : If you added/removed files from the product, you must also update the headers under admin\published\sfclist"
  177. call logmsg.cmd "Warning : Do this by verifying the autogenerated header and checking it in. Avoid hand-editing the headers."
  178. set %errorlevel%=0
  179. )
  180. )
  181. REM DTC
  182. if defined _DTC (
  183. fc /l /c %_NTPostBld%\congeal_scripts\%myarchitecture%_dtc.h %_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_dtc.h
  184. if errorlevel 1 (
  185. call logmsg.cmd "Warning : Checked in header (admin\published\sfclist\%myarchitecture%_dtc.h) did not match autogenerated version (%_NTPostBld%\congeal_scripts\autogen\%myarchitecture%_dtc.h)."
  186. call logmsg.cmd "Warning : If you added/removed files from the product, you must also update the headers under admin\published\sfclist"
  187. call logmsg.cmd "Warning : Do this by verifying the autogenerated header and checking it in. Avoid hand-editing the headers."
  188. set %errorlevel%=0
  189. )
  190. )
  191. call logmsg.cmd /t "comparison is complete."
  192. :jump_for_now
  193. REM if _BuildSku is set, use old headers for skus you are not building.
  194. if defined _BuildSku (
  195. for %%a in (per wks srv ent sbs bla dtc) do (
  196. if not exist %_BuildArch%_%%a.h copy %RazzleToolPath%\postbuildscripts\sfp\%_BuildArch%_%%a.h
  197. )
  198. )
  199. cd
  200. REM the next line is necessary if the build is being run in a distributed fashion
  201. set __MTSCRIPT_ENV_ID=
  202. build.exe -cZ
  203. if errorlevel 1 (
  204. call errmsg.cmd "Error : Building of autogenerated WFP sfcfiles.dll failed. Please investigate %_NTPostBld%\congeal_scripts\autogen\build.err."
  205. popd
  206. goto end
  207. ) else (
  208. call logmsg.cmd /t "WFP Dll sfcfiles.dll was built successfully"
  209. )
  210. REM Instrument sfcfiles.dll for coverage
  211. if NOT defined _COVERAGE_BUILD (
  212. call logmsg.cmd "Not coverage postbuild: not instrumenting sfcfiles.dll"
  213. goto SkipInstrSfc
  214. )
  215. REM Only run on x86fre build machines
  216. if NOT "%_BuildArch%%_BuildType%" == "x86fre" (
  217. call logmsg.cmd "Architecture and build type is not x86fre... not instrumenting sfcfiles.dll"
  218. goto SkipInstrSfc
  219. )
  220. call logmsg.cmd "Instrumenting sfcfiles.dll for code coverage"
  221. call %COVERAGE_SCRIPTS%\CovInstrSfcFiles.cmd
  222. :SkipInstrSfc
  223. call logmsg.cmd /t "sfcgen.cmd Finished."
  224. popd
  225. :end
  226. seterror.exe "%errors%"& goto :EOF