Source code of Windows XP (NT5)
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.

279 lines
10 KiB

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