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.

532 lines
19 KiB

  1. # buildall.pm
  2. #
  3. # created: 8/03/99, a-jbilas
  4. # modified:
  5. #
  6. # TODO: WINCE SUPPORT?
  7. # BETTER FAULT TOLERANCE
  8. # SCRIPT CLEANUP
  9. # ICECAP
  10. if (!$__SPGBUILDPM ) { use spg::build; }
  11. if (!$__SPGBUILDCABSPM ) { use spg::buildcabs; }
  12. if (!$__SPGBUILDMSIPM ) { use spg::buildmsi; }
  13. if (!$__SPGRUNBVTPM ) { use spg::runbvt; }
  14. sub BuildAll
  15. {
  16. #STD overrides
  17. $sBuildName = "Build of SAPI5 All";
  18. $sLogDropDir = "\\\\b11nlbuilds\\sapi5\\Web.Files\\logs\\".$sShortBuildName;
  19. @lAllowedLanguages = ();
  20. @lAllowedBuilds = ("DEBUG", "RELEASE"); #TODO: ICECAP
  21. @lAllowedComponents = ("ALLPROJ", "DATA", "BVTDLLS");
  22. push(@lAllowedModifiers, "ALLCOMP", "SHIP", "NOAH", "BVT", "DELALL", "NOCOPY", "NOCABS", "NOMSI"); #TODO: UPDATE
  23. push(@lDefaultArgs, "ALLPROJ", "BVT", "NOCOPY", "NOCABS", "BVTDLLS");
  24. %hOptionDescription =
  25. (
  26. %hOptionDescription,
  27. # <----------------------------- SCREEN WIDTH -------------------------------------> (accel)
  28. ("NoMsi" => " don't build MSI/MSM files"), #NM
  29. ("NoCAbs" => " don't build CAB files"), #NC
  30. ("DELALL" => " delete all src, resync/rebuild SLM project -be careful with this-"), #DELALL
  31. ("AllProj" => " include `All` SAPI5 project from everything.dsw workspace build"), #AP
  32. ("DATA" => " include SR data file build"), #DATA
  33. ("BvtDlls" => " include BVT dependency DLLs build"), #BD
  34. );
  35. # custom vars
  36. local(@lSampleExeDirs) = ($SAPIROOT."\\test\\audio",
  37. $SAPIROOT."\\test\\dogfood",
  38. $SAPIROOT."\\sdk\\samples\\cpp\\aoesapi",
  39. $SAPIROOT."\\sdk\\samples\\cpp\\basictts",
  40. $SAPIROOT."\\sdk\\samples\\cpp\\dictpad",
  41. $SAPIROOT."\\sdk\\samples\\cpp\\speak",
  42. $SAPIROOT."\\sdk\\samples\\cpp\\ttshello",
  43. $SAPIROOT."\\sdk\\samples\\cpp\\wintts",
  44. $SAPIROOT."\\QA\\SAPI\\Project\\apps\\SpComp\\kato",
  45. $SAPIROOT."\\QA\\SAPI\\Project\\apps\\ttsapp",
  46. # $SAPIROOT."\\QA\\SAPI\\source\\tools\\tux",
  47. $SAPIROOT."\\QA\\SAPI\\Project\\apps\\SpComp");
  48. local(@lBVTCompKills) = ();
  49. local(@lBVTCompBFails) = ();
  50. local($sCABIni) = $SAPIROOT."\\build\\cabs.ini";
  51. local($sCABDir) = $SAPIROOT."\\cabs";
  52. local($bBVTFailed) = 0;
  53. BeginBuild($SAPIROOT, @_);
  54. # UPDATE SECTION
  55. # check whether build needs to be built at all (if UPDATE opt selected)
  56. if ($bOfficialBuild && IsMemberOf("UPDATE", @lArgs) && IsMemberOf("RESYNC"))
  57. {
  58. $fhSyncLog = OpenFile($sSyncLog, "read");
  59. if ($fhSyncLog)
  60. {
  61. my($text);
  62. my($bSomethingHappened) = 0;
  63. for ( ; !$fhSyncLog->eof() ; $text = $fhSyncLog->getline())
  64. {
  65. if ($text =~ /./) #if anything at all happened
  66. {
  67. $bSomethingHappened = 1;
  68. }
  69. }
  70. if (!$bSomethingHappened)
  71. {
  72. PrintL("\nNo changes to SLM tree recorded (build unnecessary) ...\n\n", PL_LARGE | PL_BOLD);
  73. EndBuild();
  74. return(1);
  75. }
  76. }
  77. CloseFile($fhSyncLog);
  78. }
  79. # DELALL SECTION
  80. # delete all files in SAPI5 enlistment and ssync, slmck (if DELALL opt selected)
  81. if (IsMemberOf("DELALL", @lArgs))
  82. {
  83. PrintL("\nPerforming Full SAPI5 SLM Directory Rebuild ...\n\n", PL_LARGE | PL_BOLD);
  84. BEGIN_NON_CRITICAL_SECTION();
  85. BEGIN_DHTML_NODE();
  86. if ($bOfficialBuild)
  87. {
  88. GrabCookie("r");
  89. }
  90. CleanUpSAPI();
  91. PrintToFile($sSyncLog, "\n\n"."*" x (20)." DIRECTORY REBUILD LOG "."*" x (20)."\n\n");
  92. ExecuteAndOutputToFile($cmdSync." -rf", $sSyncLog);
  93. PrintToFile($sSyncLog, "\n\n"."*" x (50)."\n\n");
  94. ExecuteAndOutputToFile($cmdSlmck." -rf", $sSyncLog);
  95. if ($bOfficialBuild)
  96. {
  97. FreeCookie();
  98. }
  99. END_DHTML_NODE();
  100. END_NON_CRITICAL_SECTION();
  101. }
  102. # REBUILD SECTION
  103. # delete all standard build target dirs (if REBUILD opt selected)
  104. if (IsMemberOf("REBUILD", @lArgs))
  105. {
  106. PrintL("\nCleaning up ...\n\n", PL_LARGE | PL_BOLD);
  107. BEGIN_DHTML_NODE();
  108. local(@lTargetDirs) = ();
  109. foreach $build (@lBuilds)
  110. {
  111. push(@lTargetDirs, $build."_".PROC);
  112. push(@lTargetDirs, $build);
  113. }
  114. DelOld(cwd(), *lTargetDirs);
  115. END_DHTML_NODE();
  116. }
  117. # UPDATE VERSION INFO
  118. PrintL("\nUpdating version info ...\n\n", PL_LARGE | PL_BOLD);
  119. PushD("build");
  120. SetReadOnly("sapiver.h", 0);
  121. my($sForkNumber) = "00";
  122. PrintL("\nUpdating version for header to ".$sForkNumber.".".$sBuildNumber."\n", PL_BOLD);
  123. EchoedUnlink("sapiver.h");
  124. my($fhNewVersion) = OpenFile("sapiver.h", "write");
  125. my($fhVersionHead) = OpenFile("verhead.h", "read");
  126. if ($fhNewVersion && $fhVersionHead)
  127. {
  128. while (!$fhVersionHead->eof())
  129. {
  130. $fhNewVersion->print($fhVersionHead->getline());
  131. }
  132. CloseFile($fhVersionHead);
  133. $fhNewVersion->print("#define VERSION \"5.00.".$sForkNumber.".".$sBuildNumber."\"\n");
  134. $fhNewVersion->print("#define VER_FILEVERSION_STR \"5.00.".$sForkNumber.".".$sBuildNumber."\0\"\n");
  135. $fhNewVersion->print("#define VER_FILEVERSION 5,00,".$sForkNumber.",".$sBuildNumber."\n");
  136. $fhNewVersion->print("#define VER_PRODUCTVERSION_STR \"5.00.".$sForkNumber.".".$sBuildNumber."\0\"\n");
  137. $fhNewVersion->print("#define VER_PRODUCTVERSION 5,00,".$sForkNumber.",".$sBuildNumber."\n");
  138. my($fhVersionTail) = OpenFile("vertail.h", "read");
  139. if ($fhVersionTail)
  140. {
  141. while (!$fhVersionTail->eof())
  142. {
  143. $fhNewVersion->print($fhVersionTail->getline());
  144. }
  145. CloseFile($fhVersionTail);
  146. }
  147. CloseFile($fhNewVersion);
  148. SetReadOnly("sapiver.h", 1);
  149. }
  150. else
  151. {
  152. PrintL("Could not update version info\n", PL_BIGERROR);
  153. }
  154. PopD(); #"build"
  155. # BUILD LIST OF ARGS FOR BUILDCOMPONENTVC
  156. local(@lBuildComponentArgs) = ();
  157. if (IsMemberOf("REBUILD", @lArgs))
  158. {
  159. push(@lBuildComponentArgs, "REBUILD");
  160. }
  161. if (IsMemberOf("SHIP", @lArgs))
  162. {
  163. push(@lBuildComponentArgs, "CONFIG=SHIP");
  164. }
  165. @lBuildComponentArgs = Union(*lBuildComponentArgs, *lBuilds);
  166. # push(@lBuildComponentArgs, PROC);
  167. ############################## PRECOPY ################################
  168. if (!$bNoCopy)
  169. {
  170. if ($sDropDir !~ /\d\d\d\d$/) # ensure that we don't accidentally delete/copy to server root
  171. {
  172. PrintL("Fatal: Drop dir '".$sDropDir."' is not formatted correctly, skipping all copy operations\n", PL_BIGERROR);
  173. push(@lArgs, "NOCOPY");
  174. $bNoCopy = 1;
  175. }
  176. else
  177. {
  178. if (IsDirectory($sDropDir))
  179. {
  180. PrintL("\nDeleting old build ".$sBuildNumber." from drop share ...\n\n", PL_SUBHEADER);
  181. BEGIN_DHTML_NODE();
  182. Delnode($sDropDir);
  183. END_DHTML_NODE();
  184. Execute($cmdWebUpdate);
  185. }
  186. PrintL("\nCreating Destination Directories ...\n\n", PL_SUBHEADER);
  187. foreach $buildtype (MatchShipBuilds("DEBUG", "RELEASE"))
  188. {
  189. EchoedMkdir($sDropDir."\\".$buildtype."\\bin\\".PROC);
  190. EchoedMkdir($sDropDir."\\".$buildtype."\\cab\\".PROC);
  191. EchoedMkdir($sDropDir."\\".$buildtype."\\map_sym\\".PROC);
  192. }
  193. EchoedMkdir($sDropDir."\\release\\bvt\\".PROC);
  194. EchoedMkdir($sDropDir."\\src\\tts\\msttsdrv\\voices");
  195. EchoedMkdir($sDropDir."\\src\\sr");
  196. EchoedMkdir($sDropDir."\\src\\include");
  197. EchoedMkdir($sDropDir."\\src\\sapi");
  198. PrintL("\n\n");
  199. }
  200. }
  201. ############################### BUILD SAPI5 ##################################
  202. if (IsMemberOf("ALLPROJ", @lComponents))
  203. {
  204. PrintL("\nBuilding SAPI v".$nMajorVersion.".".$nMinorVersion." ...\n\n", PL_SUBHEADER);
  205. PushD($SAPIROOT."\\Workspaces");
  206. BuildComponentVC("everything.dsw", "build.ini", @lBuildComponentArgs);
  207. PopD(); #$SAPIROOT."\\Workspaces"
  208. PrintL("\nCreating the symbol files ...\n\n", PL_SUBHEADER);
  209. PushD($SAPIROOT."\\src\\tts\\msttsdrv");
  210. foreach $buildtype (MatchShipBuilds("DEBUG", "RELEASE"))
  211. {
  212. PushD($buildtype."_".PROC);
  213. Execute("mapsym spttseng.map");
  214. PopD(); #$buildtype"_".$PROC
  215. }
  216. PopD(); #$SAPIROOT."\\src\\tts\\msttsdrv
  217. PushD($SAPIROOT."\\src\\sapi");
  218. foreach $buildtype (MatchShipBuilds("DEBUG", "RELEASE"))
  219. {
  220. PushD($buildtype."_".PROC);
  221. Execute("mapsym sapi.map");
  222. PopD(); #$buildtype."_".$PROC
  223. }
  224. PopD(); #$SAPIROOT."\\src\\sapi"
  225. }
  226. ########################### BUILD SR DATA FILES ##############################
  227. if (IsMemberOf("DATA", @lComponents))
  228. {
  229. PrintL("\nBuilding SR data files ...\n\n", PL_LARGE | PL_BOLD);
  230. PushD($SAPIROOT."\\src\\sr\\engine\\datafiles");
  231. BuildComponent("BUILDDRV=".$SAPIROOT."\\src\\sr", "SR Engine", "DEBUG");
  232. PopD(); #$SAPIROOT."\\src\\sr\\engine\\datafiles"
  233. }
  234. ########################### BUILD BVT DLLS FILES #############################
  235. # add BVTs here but note the directory that they are being built in
  236. # (if you need another, add it below like srengbvt)
  237. if (IsMemberOf("BVTDLLS", @lComponents))
  238. {
  239. PrintL("\nBuilding BVT DLLs ...\n\n", PL_SUBHEADER);
  240. BEGIN_NON_CRITICAL_SECTION();
  241. PushD($SAPIROOT."\\QA\\SAPI\\Project\\components");
  242. foreach $bvt ("ctestisptokenui", "ttseng", "SRTEngine", "testengineext", "TEngAlt")
  243. {
  244. if (BuildComponentVC($bvt.".dsp", $bvt." - Win32 Debug", @lBuildComponentArgs))
  245. {
  246. if (!$bNoCopy)
  247. {
  248. EchoedCopy($SAPIROOT."\\QA\\SAPI\\Project\\components\\debug\\".$bvt.".dll",
  249. $sDropDir."\\debug\\bin\\".PROC);
  250. }
  251. }
  252. else
  253. {
  254. push(@lBVTCompBFails, $bvt);
  255. ++$bBVTFailed;
  256. }
  257. }
  258. PopD(); #$SAPIROOT."\\QA\\SAPI\\Project\\components"
  259. PushD($SAPIROOT."\\QA\\SAPI\\Project\\BVT");
  260. foreach $bvt ("ttsbvt", "srbvt", "lexbvt", "rmbvt", "gramcompbvt", "cfgengbvt", "ambvt")
  261. {
  262. if (BuildComponentVC($bvt.".dsp", $bvt." - Win32 Debug", @lBuildComponentArgs))
  263. {
  264. if (!$bNoCopy)
  265. {
  266. EchoedCopy($SAPIROOT."\\QA\\SAPI\\Project\\BVT\\debug\\".$bvt.".dll",
  267. $sDropDir."\\debug\\bin\\".PROC);
  268. }
  269. }
  270. else
  271. {
  272. push(@lBVTCompBFails, $bvt);
  273. ++$bBVTFailed;
  274. }
  275. }
  276. PopD(); #$SAPIROOT."\\QA\\SAPI\\Project\\BVT"
  277. if (!$bNoCopy)
  278. {
  279. EchoedCopy($SAPIROOT."\\QA\\SAPI\\data\\sol*.cfg",
  280. $sDropDir."\\debug\\bin\\".PROC);
  281. EchoedCopy($SAPIROOT."\\QA\\SAPI\\data\\thankyou.cfg",
  282. $sDropDir."\\debug\\bin\\".PROC);
  283. }
  284. PushD($SAPIROOT."\\QA\\SR\\SREngBVT");
  285. if (BuildComponentVC("srengbvt.dsp", "srengbvt - Win32 Debug", @lBuildComponentArgs))
  286. {
  287. if (!$bNoCopy)
  288. {
  289. EchoedCopy($SAPIROOT."\\QA\\SR\\SREngBVT\\debug\\srengbvt.dll",
  290. $sDropDir."\\debug\\bin\\".PROC);
  291. }
  292. }
  293. else
  294. {
  295. push(@lBVTCompBFails, "srengbvt");
  296. ++$bBVTFailed;
  297. }
  298. PopD(); #$SAPIROOT."\\QA\\SR\\SREngBVT"
  299. END_NON_CRITICAL_SECTION();
  300. }
  301. ############################## BUILD CABS ################################
  302. if (!IsMemberOf("NOCABS", @lArgs))
  303. {
  304. my($startTime) = time();
  305. if (BuildCABs($sCABIni, $sCABDir))
  306. {
  307. my($stopTime) = time();
  308. PrintLTip("All CABs built successfully\n", "CAB Build Time: ".FmtDeltaTime($stopTime - $startTime),
  309. PL_GREEN | PL_MSG | PL_BOLD);
  310. }
  311. else
  312. {
  313. my($stopTime) = time();
  314. PrintLTip("CABs Build FAILED\n", "CAB Build Time: ".FmtDeltaTime($stopTime - $startTime),
  315. PL_BIGERROR);
  316. # TODO: split MSI/CAB -> $bcStatus |= BC_CABFAILED;
  317. }
  318. }
  319. ############################## BUILD MSI #################################
  320. if (!IsMemberOf("NOMSI", @lArgs))
  321. {
  322. my($startTime) = time();
  323. if (BuildMSI($sMSIDir))
  324. {
  325. my($stopTime) = time();
  326. PrintLTip("MSI Build Successful\n", "MSI Build Time: ".FmtDeltaTime($stopTime - $startTime),
  327. PL_GREEN | PL_MSG | PL_BOLD);
  328. }
  329. else
  330. {
  331. my($stopTime) = time();
  332. PrintLTip("MSI Build FAILED\n", "MSI Build Time: ".FmtDeltaTime($stopTime - $startTime),
  333. PL_BIGERROR);
  334. $bcStatus |= BC_CABFAILED;
  335. }
  336. }
  337. ################################# COPY ###################################
  338. if (!$bNoCopy && IsMemberOf("ALLPROJ", @lComponents))
  339. {
  340. PrintL("\nCopying Non-MSI Files to Server\n\n", PL_SUBHEADER);
  341. BEGIN_DHTML_NODE();
  342. foreach $buildtype ('debug', 'release')
  343. {
  344. # Copy the core dlls
  345. EchoedCopy($SAPIROOT."\\src\\tts\\msttsdrv\\".$buildtype."_".PROC."\\*.dll",
  346. $sDropDir."\\".$buildtype."\\bin\\".PROC);
  347. # Copy pdb files for the core dlls
  348. EchoedCopy($SAPIROOT."\\src\\tts\\msttsdrv\\".$buildtype."_".PROC."\\spttseng.pdb",
  349. $sDropDir."\\".$buildtype."\\bin\\".PROC);
  350. EchoedCopy($SAPIROOT."\\src\\sapi\\".$buildtype."_".PROC."\\sapi.pdb",
  351. $sDropDir."\\".$buildtype."\\bin\\".PROC);
  352. EchoedCopy($SAPIROOT."\\src\\sapi\\".$buildtype."_".PROC."\\*.dll",
  353. $sDropDir."\\".$buildtype."\\bin\\".PROC);
  354. # Copy map and symbol files
  355. foreach $ext ('map', 'sym')
  356. {
  357. EchoedCopy($SAPIROOT."\\src\\tts\\msttsdrv\\".$buildtype."_".PROC."\\*.".$ext,
  358. $sDropDir."\\".$buildtype."\\map_sym\\".PROC);
  359. EchoedCopy($SAPIROOT."\\src\\sapi\\".$buildtype."_".PROC."\\*.".$ext,
  360. $sDropDir."\\".$buildtype."\\map_sym\\".PROC);
  361. }
  362. # Copy the sample programs
  363. foreach $dir (@lSampleExeDirs)
  364. {
  365. if (!IsDirectory($dir))
  366. {
  367. PrintL("Warning : Could not copy files from ".$dir."\n", PL_BIGWARNING);
  368. PrintMsgBlock("directory does not exist, has it moved? (update \@lSampleExeDirs in buildall.pm)\n");
  369. }
  370. elsif (IsDirectory($dir."\\".$buildtype))
  371. {
  372. foreach $ext ('pdb', 'exe', 'dll')
  373. {
  374. EchoedCopy($dir."\\".$buildtype."\\*.".$ext,
  375. $sDropDir."\\".$buildtype."\\bin\\".PROC);
  376. }
  377. }
  378. elsif (IsDirectory($dir."\\".$buildtype."_".PROC))
  379. {
  380. foreach $ext ('pdb', 'exe', 'dll')
  381. {
  382. EchoedCopy($dir."\\".$buildtype."_".PROC."\\*.".$ext,
  383. $sDropDir."\\".$buildtype."\\bin\\".PROC);
  384. }
  385. }
  386. else
  387. {
  388. PrintL("Warning : Could not copy ".$dir."\\".$buildtype."\n", PL_BIGWARNING);
  389. PrintMsgBlock("no builds exist in ".$buildtype." or ".$buildtype."_".PROC." (did it fail to build?)\n");
  390. }
  391. }
  392. }
  393. # Copy the sources (x86 only)
  394. EchoedCopy($SAPIROOT."\\sdk\\include\\*.c", $sDropDir."\\src\\include");
  395. EchoedCopy($SAPIROOT."\\sdk\\include\\*.h*", $sDropDir."\\src\\include");
  396. EchoedCopy($SAPIROOT."\\ddk\\include\\*.c", $sDropDir."\\src\\include");
  397. EchoedCopy($SAPIROOT."\\ddk\\include\\*.h*", $sDropDir."\\src\\include");
  398. EchoedCopy($SAPIROOT."\\sdk\\idl\\*.idl", $sDropDir."\\src\\include");
  399. foreach $fileType ("*.d*", "*.c*", "*.h*", "*.r*", "*.bmp")
  400. {
  401. EchoedCopy($SAPIROOT."\\src\\sapi\\".$fileType, $sDropDir."\\src\\sapi");
  402. }
  403. foreach $fileType ("*.d*", "*.c*", "*.h*", "*.r*", "*.idl")
  404. {
  405. EchoedCopy($SAPIROOT."\\src\\tts\\msttsdrv\\".$fileType, $sDropDir."\\src\\tts\\msttsdrv");
  406. }
  407. # TODO: internal xcopy procedure
  408. Execute("xcopy ".$SAPIROOT."\\src\\sr ".$sDropDir."\\src\\sr \/is \/exclude:".$SAPIROOT."\\build\\srex.txt");
  409. # Copy the voice data
  410. EchoedCopy($SAPIROOT."\\src\\tts\\msttsdrv\\voices\\*.vData", $sDropDir."\\src\\tts\\msttsdrv\\voices");
  411. EchoedCopy($SAPIROOT."\\src\\tts\\msttsdrv\\voices\\*.vDef", $sDropDir."\\src\\tts\\msttsdrv\\voices");
  412. END_DHTML_NODE();
  413. }
  414. PrintL("\n");
  415. if ($bOfficialBuild)
  416. {
  417. # Update web page now in case BVTs hang. Then update Web Page again after BVTs run.
  418. Execute($cmdWebUpdate);
  419. }
  420. ########################################## RUN BVTS ##########################################
  421. $g_nBVTPassedPercent = 0;
  422. if (IsMemberOf("BVT", @lArgs) && !IsMemberOf("NOMSI", @lArgs) && !($bcStatus & BC_CABFAILED))
  423. {
  424. Execute("msiexec /x \"".$sMSIDir."\\release\\SDK\\Output\\DISK_1\\Sp5SDK.msi\" /qn"); # uninstall first
  425. Execute("msiexec /i \"".$sMSIDir."\\release\\SDK\\Output\\DISK_1\\Sp5SDK.msi\" /qn"); # install
  426. my ($startTime) = time();
  427. Delnode($SAPIROOT."\\bvt");
  428. EchoedMkdir($SAPIROOT."\\bvt");
  429. PushD($SAPIROOT."\\bvt");
  430. if (SetLocalGlobalsAndBegin("RunBVT",
  431. "__IGNORE", "ALLCOMP", "LOCAL", "QUIET", $sBuildNumber, (IsMemberOf("MAIL", @lArgs) ? "FAILMAIL" : "")))
  432. {
  433. PrintL("BVTs report success (".$g_nBVTPassedPercent."%)", PL_GREEN | PL_MSG | PL_BOLD);
  434. }
  435. else
  436. {
  437. PrintL("BVTs report failure (".$g_nBVTPassedPercent."%)", PL_BIGERROR);
  438. }
  439. PrintMsgBlock("<a href=\"\\\\b11nlbuilds\\sapi5\\Web.Files\\logs\\runbvt\\runbvt".PROC.$sBuildNumber.".html\">View BVT log<\/a>");
  440. PopD();
  441. }
  442. else
  443. {
  444. $g_nBVTPassedPercent = "SKIPPED"; #NaN, cheap fix
  445. }
  446. CheckTypos();
  447. EndBuild();
  448. return(!($bcStatus & BC_FAILED));
  449. }
  450. $__BUILDALLPM = 1;
  451. 1;