stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r349027 [4/4] - in /incubator/stdcxx/trunk: ./ etc/config/windows/
Date Fri, 25 Nov 2005 22:16:48 GMT
Added: incubator/stdcxx/trunk/etc/config/windows/summary.js
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/windows/summary.js?rev=349027&view=auto
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/summary.js (added)
+++ incubator/stdcxx/trunk/etc/config/windows/summary.js Fri Nov 25 14:16:34 2005
@@ -0,0 +1,638 @@
+//
+// $Id$
+//
+// BuildLog.htm file constants
+
+var cmdLineTag = "Command Lines";
+var outputTag = "Output Window";
+var summaryTag = "Results";
+
+var errorsTag = "error(s)";
+var warningsTag = "warning(s)";
+
+var compilingTag = "Compiling...";
+var linkingTag = "Linking...";
+
+var hdrLibrary = "Library Summary";
+var hdrTestDriver = "Test Driver Summary";
+var hdrExamples = "Example Summary";
+var hdrTests = "Test Summary";
+
+////////////////////////////////////////////////////////////////////
+// read BuildLog.htm  
+
+function readBuildLog(exeDir, itemInfo)
+{
+    if (! fso.FolderExists(exeDir))
+        return;
+        
+    var blogDir = exeDir + "\\" + itemInfo.name;
+    
+    if (! fso.FolderExists(blogDir))
+        return;
+        
+    var blogFilePath = blogDir + "\\" + buildlogFile;
+    if (! fso.FileExists(blogFilePath))
+        return;
+        
+    var blogFile = fso.OpenTextFile(blogFilePath);
+    var blogData = blogFile.ReadAll();
+    
+    var posTmp = getCommandLinesInfo(itemInfo, blogData, 0);
+    posTmp = getCompilationInfo(itemInfo, blogData, posTmp);
+    posTmp = getBuildSummaryInfo(itemInfo, blogData, posTmp);
+}
+
+////////////////////////////////////////////////////////////////////
+// BuildLog.htm parsing methods 
+
+function getCommandLinesInfo(itemInfo, blogData, posStart)
+{
+    //lookup for the command lines block
+    var posCmdLines = blogData.indexOf(cmdLineTag, posStart);
+    if (-1 == posCmdLines)
+        return posStart;
+        
+    // extract table in the command lines block 
+    itemInfo.buildCmdLog = extractTableData(blogData, posCmdLines);
+    return posStart + itemInfo.buildCmdLog.length;
+}
+
+
+function getCompilationInfo(itemInfo, blogData, posStart)
+{
+    //lookup for the output block
+    var posCmplInfo = blogData.indexOf(outputTag, posStart);
+    if (-1 == posCmplInfo)
+        return posStart;
+        
+    // extract table in the output block    
+    itemInfo.buildOutLog = extractTableData(blogData, posCmplInfo);
+    return posStart + itemInfo.buildOutLog.length;
+}
+
+
+function getBuildSummaryInfo(itemInfo, blogData, posStart)
+{
+    //lookup for the results block
+    var posResInfo = blogData.indexOf(summaryTag, posStart);
+    if (-1 == posResInfo)
+        return posStart;
+        
+    // extract table in the results block   
+    var summaryData = extractTableData(blogData, posResInfo);
+    
+    // skip first line in the summary as not needed at all
+    var posPrjName = summaryData.indexOf(buildlogFile);
+    posPrjName = summaryData.indexOf("\r\n", posPrjName);
+    if (-1 == posPrjName)
+        return posStart + summaryData.length;
+        
+    var prjSummary = summaryData.substr(posPrjName);
+    
+    // we not needed in tags, so remove them
+    var tagIdx = prjSummary.indexOf("<");
+    itemInfo.buildOutLog += "\r\n" + prjSummary.substr(0, tagIdx);
+        
+    // parse project summary and get number of errors and warnings
+    var rgSum = prjSummary.split(" ");
+    
+    itemInfo.errorsCnt = rgSum[2];
+    itemInfo.warningsCnt = rgSum[4];
+    
+    // check what kind of errors we have
+    if (itemInfo.errorsCnt != "0")
+    {
+        var posLinking = itemInfo.buildOutLog.indexOf(linkingTag);
+        if (posLinking != -1)
+            itemInfo.linkerErrors = true;
+    }
+    
+    return posStart + summaryData.length;
+}
+
+
+function extractTableData(blogData, posStart)
+{
+    var posMainTable = blogData.indexOf("<table", posStart);
+    if (-1 == posMainTable)
+        return "";
+        
+    // lookup for the main table close tag 
+    var posCloseTag = posMainTable;
+    var posOpenTag = posMainTable;
+    while (true)
+    {
+        posCloseTag = blogData.indexOf("</table>", posCloseTag + 5);
+        if (-1 == posCloseTag) // no close tag?
+            break;
+            
+        posOpenTag = blogData.indexOf("<table", posOpenTag + 5);
+        if (-1 == posOpenTag)
+            break;
+        
+        if (posCloseTag < posOpenTag)
+            break;
+    }
+    
+    var tableData = "";
+    var tableDataLen = posCloseTag + 8 - posMainTable;
+    if (tableDataLen > 0)
+        tableData = blogData.substr(posMainTable, tableDataLen);
+    else
+        tableData = blogData.substr(posMainTable);
+        
+    // visual studio doesn't provide last table row close tags
+    // add them here
+    var indexClose = tableData.lastIndexOf("</table>");
+    tableData = tableData.substr(0, indexClose) + "</td></tr></table>";
+        
+    return tableData;
+}
+
+////////////////////////////////////////////////////////////////////
+// get differences method
+
+function getDifferencesInfo(itemInfo)
+{
+    var diffs = getWinDiffDifferences(itemInfo.runOutput, 
+        itemInfo.runReqOutput, "ILFRGX");
+        
+    // replace first line
+    var endLine = String.fromCharCode(13) + String.fromCharCode(10);
+    var pos = diffs.indexOf(endLine);
+    if (-1 == pos)
+    {
+        itemInfo.runDiff = diffs;
+        return;
+    }
+    
+    itemInfo.runDiff = "Differences between real output and required: ";
+    itemInfo.runDiff += diffs.substr(pos);
+    
+    //WScript.Echo(itemInfo.runDiff);
+}
+
+///////////////////////////////////////////////////////////////////////
+// save methods
+
+function saveBuildSummary(itemInfo, fileSummary)
+{
+    var failed = (itemInfo.exitCode != 0 || itemInfo.errorsCnt != "0") 
+        ? true : false;
+    
+    if (failed == true)
+        fileSummary.WriteLine("<tr bgcolor=\"#FF9999\">");
+    else
+        fileSummary.WriteLine("<tr bgcolor=\"#FFFF99\">");
+    
+    var someCol = "<td style=\"padding:2px;border-right:#000000 solid 1px;\
+        border-bottom:#000000 solid 1px;\" align=\"left\">";
+    var lastCol = 
+        "<td style=\"padding:2px;border-bottom:#000000 solid 1px;\" \
+        align=\"right\">";
+        
+    fileSummary.Write(someCol);
+    fileSummary.Write("<a href=\"#" + itemInfo.name + "\">");
+    fileSummary.WriteLine(itemInfo.name + "</a></td>");
+    
+    if (itemInfo.errorsCnt != "0")
+    {
+        fileSummary.WriteLine(someCol + "Build Failed" + "</td>");
+    }
+    else
+    {
+        if (failed == true)
+        {
+            fileSummary.WriteLine(someCol + "Exited with code " + 
+                itemInfo.exitCode + "</td>");
+        }
+        else
+        {
+            fileSummary.WriteLine(someCol + "Succeeded" + "</td>");
+        }   
+    }
+    
+    if (failed == false)
+    {
+        if (itemInfo.runDiff != "")
+            fileSummary.WriteLine(someCol + "Difference" + "</td>");
+        else 
+            fileSummary.WriteLine(someCol + "Equal" + "</td>");
+    }
+    else
+    {
+        fileSummary.WriteLine(someCol + "&nbsp;" + "</td>");
+    }
+
+    fileSummary.WriteLine(lastCol + itemInfo.warningsCnt + "</td>");
+        
+    fileSummary.WriteLine("</tr>");
+}
+
+function saveBuildInfo(itemInfo, infoDir, infoExt)
+{
+    var outfileName = infoDir + "\\" + itemInfo.name + "." + infoExt;
+    var outFile = fso.CreateTextFile(outfileName);
+    
+    saveBuildInfoTable(outFile, itemInfo, hdrExamples, false);
+
+    outFile.Close();
+}
+
+function saveBuildInfoTable(outFile, itemInfo, linkSummary, bLib)
+{
+    outFile.WriteLine("<table border=\"0\" width=\"100%\" \
+        style=\"border:#000000 solid 1px;\"  cellspacing=\"0\">");
+        
+    outFile.Write("<tr><td bgcolor=\"#CCCCCC\" \
+        style=\"border-bottom:#000000 solid 1px;\"><strong>");
+    outFile.Write("<a name=\"" + itemInfo.name + "\">" + 
+        itemInfo.name + "</a>");
+    outFile.WriteLine("</strong>&nbsp;<a href=\"#" + 
+        makeLinkFromString(linkSummary) + "\"><i>(" + 
+        linkSummary.toLowerCase() + 
+        ")</i></a>&nbsp;<a href=\"#top\"><i>(top)</i></a></td></tr>");
+
+    saveBuildInfoBlock(outFile, "Build Command Lines", 
+        itemInfo.buildCmdLog, false);
+    saveBuildInfoBlock(outFile, "Build Output", 
+        itemInfo.buildOutLog, false);
+    
+    if (false == bLib)
+    {
+        if (itemInfo.runOutput == "" && itemInfo.exitCode != 0)
+            itemInfo.runOutput = "Exited with code " + itemInfo.exitCode;
+            
+        saveBuildInfoBlock(outFile, 
+            "Executable Output", itemInfo.runOutput, true);
+    }
+    
+    if (itemInfo.runDiff != "")
+    {
+        saveBuildInfoBlock(outFile, "Differences", 
+            encodeHTML(itemInfo.runDiff), true);
+    }
+            
+    outFile.WriteLine("</table>");
+}
+
+
+function saveBuildInfoBlock(outFile, blockName, blockData, needPre)
+{
+    // header
+    outFile.Write("<tr><td style=\"padding:4px;\"><strong>");
+    outFile.Write(blockName);
+    outFile.WriteLine("</strong></td></tr>");
+
+    // data
+    outFile.WriteLine("<tr><td widht=\"100%\" \
+        style=\"padding-left:4px;padding-right:4px;padding-bottom:4px;\">");
+        
+    outFile.WriteLine("<table  width=\"100%\" border=\"0\" \
+        bgcolor=\"#EEEEEE\" \
+        style=\"left-margin:5px;right-margin:\
+        5px;border:#000000 solid 1px;\"> ");
+        
+    outFile.WriteLine("<tr> <td>");
+    
+    if (needPre == true)
+        outFile.WriteLine("<pre>");
+        
+    outFile.WriteLine(blockData);
+    
+    if (needPre == true)
+        outFile.WriteLine("</pre>");
+
+    outFile.WriteLine("</td></tr>");
+    outFile.WriteLine("</table>");
+    outFile.WriteLine("</td></tr>");
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+/////////////////////////////////////////////////////////////////////////
+
+function makeLinkFromString(linkString)
+{
+    var srcS = " ";
+    var destS = "-";
+    var reRep = new RegExp(srcS, "mg");
+    var res = linkString.replace(reRep, destS);
+    res = res.toLowerCase();
+    return res;
+}
+
+function getSummaryLogPath(buildDir, buildSummaryPrefix, buildType)
+{
+    var outDir = buildDir + "\\" + buildType;
+    return outDir + "\\" + buildSummaryPrefix + buildType + ".htm";
+}
+
+function makeSummaryLog(buildDir, buildSummaryPrefix, buildType)
+{
+    var outDir = buildDir + "\\" + buildType;
+    if (! fso.FolderExists(outDir))
+        fso.CreateFolder(outDir);
+        
+    var oFolder = fso.GetFolder(outDir);
+    var sumFileName = buildSummaryPrefix + buildType + ".htm";
+    var fSum = oFolder.CreateTextFile(sumFileName);
+    
+    fSum.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+    fSum.WriteLine("<body bgcolor=\"#FFFFFF\"> \
+        <font face=\"arial\" color=\"#000000\">");
+        
+    fSum.WriteLine("<center><H2>" + buildType + "</H2></center>");
+    
+    fSum.WriteLine("<table border=\"0\" width=\"100%\">");
+    
+    fSum.WriteLine("<tr><td style=\"padding-top:5px;padding-bottom:5px; \
+        border-top:#000000 solid 1px;border-bottom:#000000 solid 1px;\" \
+        align=\"center\">");
+        
+    fSum.WriteLine("<a href=\"#" + makeLinkFromString(hdrLibrary) + 
+        "\">" + hdrLibrary + "</a>&nbsp;:&nbsp;");
+    fSum.WriteLine("<a href=\"#" + makeLinkFromString(hdrTestDriver) + 
+        "\">" + hdrTestDriver + "</a>&nbsp;:&nbsp;");
+    fSum.WriteLine("<a href=\"#" + makeLinkFromString(hdrExamples) + 
+        "\">" + hdrExamples + "</a>&nbsp;:&nbsp;");
+    fSum.WriteLine("<a href=\"#" + makeLinkFromString(hdrTests) + 
+        "\">" + hdrTests + "</a>");
+        
+    fSum.WriteLine("</td></tr>");
+    
+    fSum.WriteLine("</table>");
+    fSum.WriteLine("<br/>");
+    
+    return fSum;
+}
+
+
+function saveSummaryHeaderLib(fSum, libInfo, hdrLibrary)
+{
+    fSum.WriteLine("<strong><a name=\"" + makeLinkFromString(hdrLibrary) + 
+        "\">" + hdrLibrary + "</a></strong>");
+        
+    fSum.WriteLine("<table border=\"0\" width=\"100%\" \
+        style=\"border:#000000 solid 1px;\"  cellspacing=\"0\">");
+        
+    // save header row
+    fSum.WriteLine("<tr bgcolor=\"#CCCCCC\">");
+    fSum.WriteLine(
+        "<td style=\"padding:2px;border-right:#000000 solid 1px;\
+        border-bottom:#000000 solid 1px;\"><strong>Library</strong></td>");
+    fSum.WriteLine(
+        "<td style=\"padding:2px;border-right:#000000 solid 1px;\
+        border-bottom:#000000 solid 1px;\"><strong>State</strong></td>");
+    fSum.WriteLine(
+        "<td style=\"padding:2px;border-bottom:#000000 solid 1px;\">\
+        <strong>Warnings</strong></td>");
+    fSum.WriteLine("</tr>");
+    
+    // save library header
+    if (libInfo.errorsCnt == "0")
+        fSum.WriteLine("<tr bgcolor=\"#FFFFFF\" \
+            style=\"border-bottom:#000000 solid 1px;\">");
+    else
+        fSum.WriteLine("<tr bgcolor=\"#FF9999\" \
+            style=\"border-bottom:#000000 solid 1px;\">");
+        
+    fSum.WriteLine(
+        "<td style=\"padding:2px;border-right:#000000 solid 1px;\">"
+        + "<a href=\"#" + libInfo.name + "\">" + libInfo.name + "</a></td>");
+        
+    fSum.Write("<td style=\"padding:2px;border-right:#000000 solid 1px;\">");
+    if (libInfo.errorsCnt == "0")
+        fSum.Write("OK");
+    else
+        fSum.Write("Failed");
+    fSum.WriteLine("</td>");
+    
+    fSum.WriteLine("<td style=\"padding:2px;\">" + 
+        libInfo.warningsCnt + "</td>");
+    
+    fSum.WriteLine("</tr>");
+    
+    fSum.WriteLine("</table>");
+    fSum.WriteLine("<br/>");
+}
+
+function saveSummaryHeaderTestDriver(fSum, rwtestInfo, hdrDriver)
+{
+    fSum.WriteLine("<strong><a name=\"" + makeLinkFromString(hdrDriver) + 
+        "\">" + hdrDriver + "</a></strong>");
+        
+    fSum.WriteLine("<table border=\"0\" width=\"100%\" \
+        style=\"border:#000000 solid 1px;\"  cellspacing=\"0\">");
+        
+    // save header row
+    fSum.WriteLine("<tr bgcolor=\"#CCCCCC\">");
+    fSum.WriteLine("<td style=\"padding:2px;border-right:#000000 solid 1px;\
+        border-bottom:#000000 solid 1px;\">\
+        <strong>Test Driver</strong></td>");
+    fSum.WriteLine(
+        "<td style=\"padding:2px;border-right:#000000 solid 1px;\
+        border-bottom:#000000 solid 1px;\"><strong>State</strong></td>");
+    fSum.WriteLine(
+        "<td style=\"padding:2px;border-bottom:#000000 solid 1px;\">\
+        <strong>Warnings</strong></td>");
+    fSum.WriteLine("</tr>");
+    
+    // save test driver header
+    if (rwtestInfo.errorsCnt == "0")
+        fSum.WriteLine("<tr bgcolor=\"#FFFFFF\" \
+            style=\"border-bottom:#000000 solid 1px;\">");
+    else
+        fSum.WriteLine("<tr bgcolor=\"#FF9999\" \
+            style=\"border-bottom:#000000 solid 1px;\">");
+        
+    fSum.WriteLine(
+        "<td style=\"padding:2px;border-right:#000000 solid 1px;\">" + 
+        "<a href=\"#" + rwtestInfo.name + "\">" + 
+        rwtestInfo.name + "</a></td>");
+        
+    fSum.Write(
+        "<td style=\"padding:2px;border-right:#000000 solid 1px;\">");
+    if (rwtestInfo.errorsCnt == "0")
+        fSum.Write("OK");
+    else
+        fSum.Write("Failed");
+    fSum.WriteLine("</td>");
+    
+    fSum.WriteLine("<td style=\"padding:2px;\">" + 
+        rwtestInfo.warningsCnt + "</td>");
+    
+    fSum.WriteLine("</tr>");
+    
+    fSum.WriteLine("</table>");
+    fSum.WriteLine("<br/>");
+}
+
+
+function saveSummaryHeaderMulti(fSum, exsDir, buildType, hdrExamples)
+{
+    fSum.WriteLine("<strong><a name=\"" + makeLinkFromString(hdrExamples) + 
+        "\">" + hdrExamples + "</a></strong>");
+        
+    fSum.WriteLine("<table border=\"0\" width=\"100%\" \
+        style=\"border:#000000 solid 1px;\"  cellspacing=\"0\">");
+        
+    // save header row
+    fSum.WriteLine("<tr bgcolor=\"#CCCCCC\">");
+    fSum.WriteLine("<td style=\"padding:2px;border-right:#000000 solid 1px;\
+        border-bottom:#000000 solid 1px;\"><strong>Example</strong></td>");
+    fSum.WriteLine("<td style=\"padding:2px;border-right:#000000 solid 1px;\
+        border-bottom:#000000 solid 1px;\"><strong>State</strong></td>");
+    fSum.WriteLine("<td style=\"padding:2px;border-right:#000000 solid 1px;\
+        border-bottom:#000000 solid 1px;\">\
+        <strong>Comparision</strong></td>");
+    fSum.WriteLine("<td style=\"padding:2px;\
+        border-bottom:#000000 solid 1px;\"><strong>Warnings</strong></td>");
+    fSum.WriteLine("</tr>");
+    
+    // load information from local summary file 
+    // and save it to general summary
+    var lsumFileName = exsDir + "\\" + buildType + "\\" + summaryFileName;
+    if (fso.FileExists(lsumFileName))
+    {
+        var fileLSum = fso.OpenTextFile(lsumFileName);
+        var lsumData = fileLSum.ReadAll();
+        fSum.Write(lsumData);
+    }
+    
+    fSum.WriteLine("</table>");
+    fSum.WriteLine("<br/>");
+}
+
+function saveBuildSummarySingle(fSum, libInfo, hdrLibrary)
+{
+    saveBuildInfoTable(fSum, libInfo, hdrLibrary, true);
+    fSum.WriteLine("<br/>");
+}
+
+
+function saveBuildSummaryMulti(fSum, htmDir, buildType)
+{
+    var htmFolder = fso.GetFolder(htmDir);
+    if (! htmDir)
+        return;
+        
+    var enumHtmSubFolders = new Enumerator(htmFolder.SubFolders);
+    for (; !enumHtmSubFolders.atEnd(); enumHtmSubFolders.moveNext())
+    {
+        var htmFName = enumHtmSubFolders.item().Name;
+        if (buildType == htmFName)
+        {
+            saveBuildSummariesFromFolder(fSum,
+                enumHtmSubFolders.item().Path, htmFolderName);
+        }
+        else
+        {
+            saveBuildSummaryMulti(fSum, htmDir + "\\" + htmFName, buildType);
+        }
+    }
+}
+
+function saveBuildSummariesFromFolder(fSum, testFolder, htmFName)
+{
+    var htmFldName = testFolder + "\\" + htmFName;
+    if (! fso.FolderExists(htmFldName))
+        return;
+        
+    var htmFld = fso.GetFolder(htmFldName);
+        
+    var rx = new RegExp("^.+\\.(?:htm)$", "i");
+    var enumHtmFiles = new Enumerator(htmFld.Files);
+    for (; !enumHtmFiles.atEnd(); enumHtmFiles.moveNext())
+    {
+        var htmFileName = enumHtmFiles.item().Name;
+        if (! rx.test(htmFileName))
+            continue;
+            
+        var htmFile = fso.OpenTextFile(htmFldName + "\\" + htmFileName);
+        var htmData = htmFile.ReadAll();
+            
+        fSum.Write(htmData);
+
+        fSum.WriteLine("<br/>");
+    }
+}
+        
+        
+function closeSummaryLog(fSum)
+{
+    fSum.WriteLine("</body>");
+    fSum.Close();
+}
+
+////////////////////////////////////////////////////////////////////////////
+function checkForFailures(testDir, bType, logHtm, sumHtm, htmTempDir, seeHtm)
+{
+    var testFolder = fso.GetFolder(testDir);
+    if (! testFolder)
+        return;
+        
+    var seeHtmHere = seeHtm;
+    if (false == seeHtmHere && testFolder.Name == bType)
+        seeHtmHere = true;
+        
+    var enumHtmSubFolders = new Enumerator(testFolder.SubFolders);
+    for (; !enumHtmSubFolders.atEnd(); enumHtmSubFolders.moveNext())
+    {
+        var htmFName = enumHtmSubFolders.item().Name;
+        checkForFailures(testDir + "\\" + htmFName, bType,
+            logHtm, sumHtm, htmTempDir, seeHtmHere);
+    }
+ 
+    if (false == seeHtmHere)
+        return;
+         
+    var rx = new RegExp("^.+\\.(?:htm)$", "i");
+    var enumHtmFiles = new Enumerator(testFolder.Files);
+    for (; !enumHtmFiles.atEnd(); enumHtmFiles.moveNext())
+    {
+        var htmFileName = enumHtmFiles.item().Name;
+        if (! rx.test(htmFileName))
+            continue;
+            
+        if (htmFileName != logHtm)
+            continue;
+            
+        var testInfo = new ItemBuildInfo(testFolder.Name);
+        
+        var blogFile = 
+            fso.OpenTextFile(testFolder.Path + "\\" + htmFileName);
+        var blogData = blogFile.ReadAll();
+    
+        var posTmp = getCommandLinesInfo(testInfo, blogData, 0);
+        posTmp = getCompilationInfo(testInfo, blogData, posTmp);
+        posTmp = getBuildSummaryInfo(testInfo, blogData, posTmp);
+        
+        if (testInfo.errorsCnt != "0")
+            saveBuildFailure(testFolder.Path, testInfo, sumHtm, htmTempDir);
+    }
+}
+
+function saveBuildFailure(testDir, testInfo, sumHtm, htmTempDir)
+{
+    var htmTempPath = getParentFolder(testDir) + "\\" + htmTempDir;
+    if (! fso.FolderExists(htmTempPath))
+        fso.CreateFolder(htmTempPath);
+    
+    saveBuildInfo(testInfo, htmTempPath, "htm");
+    
+    var sumTempFile;
+    if (fso.FileExists(sumHtm))
+    {
+        sumTempFile = fso.OpenTextFile(sumHtm, 8);
+    }
+    else
+    {
+        WScript.Echo("Path " + sumHtm + " not found");
+        return;
+    }
+        
+    saveBuildSummary(testInfo, sumTempFile);
+    sumTempFile.Close();
+}

Propchange: incubator/stdcxx/trunk/etc/config/windows/summary.js
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/stdcxx/trunk/etc/config/windows/update.wsf
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/windows/update.wsf?rev=349027&view=auto
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/update.wsf (added)
+++ incubator/stdcxx/trunk/etc/config/windows/update.wsf Fri Nov 25 14:16:34 2005
@@ -0,0 +1,261 @@
+<?xml version="1.0" ?>
+<package>
+    <comment>
+    PrimalCode wizard generated file.
+    </comment>
+    <job id="doexe" prompt="no">
+        <?job error="false" debug="false" ?>
+        <runtime>
+            <description>
+Solution update script.
+            </description>
+            <named helpstring="Name of the solution" name="CONFIG" 
+                required="true" type="string"/>
+            <named helpstring="Top directory of stdlib sources tree" 
+                name="TOPDIR" required="false" type="string"/>
+            <named helpstring="Output directory for modules" 
+                name="BUILDDIR" required="true" type="string"/>
+            <example>cscript update.wsf /TOPDIR:"C:\stdcxx" 
+                /BUILDDIR:"C:\stdcxx\build" /CONFIG:VC71
+            </example>
+            <usage>
+Usage: cscript update.wsf /CONFIG:@CONFIG 
+/BUILDDIR:@BUILDDIR [/TOPDIR:@TOPDIR] [BUILDTYPE:@BUILDTYPE]
+where
+@CONFIG is VC71,
+@TOPDIR - stdcxx main directory,
+@BUILDDIR - output directory for a build.
+            </usage>
+        </runtime>
+        <object id="fso" progid="Scripting.FileSystemObject"/>
+        <object id="WshShell" progid="WScript.Shell"/>
+        <script language="JScript" src="config.js"/>
+        <script language="JScript" src="msvc-config_classes.js"/>
+        <script language="JScript" src="data.js"/>
+        <script language="JScript" src="msvc-config.js"/>
+        <script language="JScript" src="utilities.js"/>
+        <script language="JScript" src="generate.js"/>
+        <script id="update" language="JScript">
+<![CDATA[
+//
+// Solution update script.
+//
+
+// constants
+var scriptDir = getParentFolder(WScript.ScriptFullName);
+var srcDir = getParentFolder(getParentFolder(getParentFolder(scriptDir)));
+var outDir = srcDir;
+var logFile = "slnupd.log";
+var logStream = null;
+var currentCfg = "";
+
+var winconfigDir = "\\etc\\config\\windows";
+
+var buildType = "";
+var tempBuildBatchName = "buildsol.bat";
+
+var description = new update; // run
+
+function update()
+{
+    WScript.Echo("Solution update script");
+    WScript.Echo("Checking arguments...");
+    
+    readAndCheckArguments();
+    
+    if (srcDir[srcDir.length - 1] != "\\")
+        srcDir += "\\";
+            
+    if (outDir[outDir.length - 1] != "\\")
+        outDir += "\\";
+        
+    WScript.Echo("Checking consistence...");
+    var logStream;
+    if (fso.FileExists(outDir + currentCfg + logFile))
+    {
+        logStream = fso.OpenTextFile(outDir + currentCfg + logFile, 8);
+    }
+    else
+    {
+        logStream = fso.CreateTextFile(outDir + currentCfg + logFile, 
+            true, false);
+    }
+
+    // get solution template
+    var solution = getSolution(currentCfg);
+    if (!solution)
+    {
+            WScript.StdErr.WriteLine(
+                "Generate: Solution with the name "
+                + currentCfg + " not found");
+            
+            logStream.WriteLine("Solution with the name "
+                + currentCfg + " not found");
+        
+            logStream.Close();
+            WScript.Quit(2);
+    }
+    
+    //ensure that it supports generation
+    if (!solution.generateSolution)
+    {
+            WScript.StdErr.WriteLine(
+                "Generate: Solution with the name "
+                + solution + " does not support IDE project generation");
+                
+            logStream.WriteLine("Solution with the name "
+                + solution + " does not support IDE project generation");
+                
+            logStream.Close();
+            WScript.Quit(2);        
+    }
+    
+    //read existing solution file
+    WScript.Echo("Reading solution...");
+    var slnFileName = outDir + "\\" + currentCfg + ".sln";
+    var prjInfo = readSolutionGUIDs(slnFileName);
+    
+    WScript.Echo("Checking projects...");
+    //make solution structure
+    var fullSolution = fillSolutionTemplateLight(solution, prjInfo, 
+            srcDir, outDir, logStream);
+    
+    WScript.Echo("Updating solution...");
+    var modProjects = updateSolution(fullSolution, prjInfo, 
+        srcDir, outDir, logStream);
+        
+    //save solution
+    WScript.Echo("Writing modified projects on disk...");
+    saveModifiedProjects(modProjects, srcDir, outDir, logStream);
+    
+    logStream.WriteLine("Solution updated");
+    logStream.Close();
+    
+    WScript.Echo("Solution was updated successfully. See " 
+                + outDir + currentCfg + "slnupd.log" + " for details.");
+    WScript.Quit(0);
+}
+
+
+function readAndCheckArguments()
+{
+    if (!WScript.Arguments.Named.Exists("CONFIG"))
+    {
+        WScript.StdErr.WriteLine(
+            "Generate: Missing required argument.");
+        WScript.Arguments.ShowUsage();
+        WScript.Quit(2);
+    }
+    
+    if (!WScript.Arguments.Named.Exists("BUILDDIR"))
+    {
+        WScript.StdErr.WriteLine(
+            "Generate: Missing required argument BUILDDIR.");
+        WScript.Arguments.ShowUsage();
+        WScript.Quit(2);
+    }
+    
+    currentCfg = WScript.Arguments.Named("CONFIG");
+    
+    if (WScript.Arguments.Named.Exists("TOPDIR"))
+    {
+        srcDir = WScript.Arguments.Named("TOPDIR");
+    }
+    else
+    {
+        // try to deduce it
+        var myDir = WScript.ScriptFullName;
+        var dirIndex = myDir.indexOf(winconfigDir);
+        if (-1 == dirIndex)
+        {
+            WScript.StdErr.WriteLine(
+                "Generate: Missing required argument TOPDIR.");
+            WScript.Arguments.ShowUsage();
+            WScript.Quit(2);
+        }
+        
+        srcDir = myDir.substr(0, dirIndex);
+    }
+    
+    if (srcDir != "")
+    {
+        if (!fso.FolderExists(srcDir))
+        {
+            WScript.StdErr.WriteLine(
+                "Update: Unable to read sources folder "
+                + srcDir);
+            WScript.Quit(2);
+        }
+        
+        outDir = srcDir;
+    }
+    
+    if (WScript.Arguments.Named.Exists("BUILDDIR"))
+    {
+        outDir = WScript.Arguments.Named("BUILDDIR");
+    }
+    
+    if (outDir != "")
+    {
+        if (!fso.FolderExists(outDir))
+        {
+            WScript.StdErr.WriteLine(
+                "Update: Unable to read destination folder "
+                + srcDir);
+            WScript.Quit(2);
+        }
+    }
+    
+    var slnFileName = outDir + "\\" + currentCfg + ".sln";
+    if (! fso.FileExists(slnFileName))
+    {
+        WScript.StdErr.WriteLine(
+            "Update: Unable to read the solution "
+                + slnFileName);
+        WScript.Quit(2);
+    }
+}
+
+function updateSolution(fullSolution, prjInfo, srcDir, outDir, logStream)
+{
+    // set right guids and collect new projects
+    var rgModProjects = new Array();
+    for (var i in fullSolution.projects)
+    {
+        var solPrj = fullSolution.projects[i];
+        if (! solPrj || ! solPrj.name)
+            continue;
+            
+        var oldProject = prjInfo[solPrj.name];
+        if (! oldProject) // new one
+        {
+            rgModProjects.push(solPrj);
+            continue;
+        }
+        
+        solPrj.id = oldProject.id;
+    }
+    
+    // save solution without saving projects
+    fullSolution.generateSolution(srcDir, outDir, logStream, false);
+    
+    return rgModProjects;
+}
+
+function saveModifiedProjects(modProjects, srcDir, outDir, logStream)
+{
+    for(var i = 0; i < modProjects.length; i++)
+    {
+        WScript.Echo("saving " + modProjects[i].name + "...");
+        logStream.WriteLine("saving " + modProjects[i].name);
+        
+        generateVCPROJ(modProjects[i], srcDir, outDir);
+        
+        logStream.WriteLine(modProjects[i].name + " saved");
+    }
+}
+
+]]>
+        </script>
+    </job>
+</package>

Propchange: incubator/stdcxx/trunk/etc/config/windows/update.wsf
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/stdcxx/trunk/etc/config/windows/utilities.js
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/windows/utilities.js?rev=349027&view=auto
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/utilities.js (added)
+++ incubator/stdcxx/trunk/etc/config/windows/utilities.js Fri Nov 25 14:16:34 2005
@@ -0,0 +1,290 @@
+//
+// $Id$
+//
+// defines different utility functions
+
+// returns parent folder for a path
+function getParentFolder(path)
+{
+    var idx = path.lastIndexOf('\\');
+    return path.substr(0, idx);
+}
+
+var rxUUID = /[a-f0-9\-]+/i;
+// generates new UUID. uuidgen shall be runnable via PATH
+function createUUID()
+{
+    var exec = WshShell.Exec("uuidgen");
+    var time = 0;
+    while (exec.Status == 0)
+    {
+        WScript.Sleep(100); // wait for completion
+        time += 100;
+        if (time > 5000)
+        {
+            WScript.StdErr.WriteLine(
+                "createUUID: Fatal error: uuidgen" + 
+                " failed to complete in 5" + 
+                " seconds");
+            WScript.Quit(3);
+        }
+    }
+    var result = exec.ExitCode;
+    if (result != 0)
+    {
+        WScript.StdErr.WriteLine(
+            "createUUID: Fatal error: uuidgen"
+                + " failed");				
+        WScript.Quit(3);
+    }
+    var id = exec.StdOut.ReadAll();
+    return "{" + rxUUID.exec(id)[0].toUpperCase() +"}";
+}
+
+
+/////////////////////////////////////////////////////////////////////////
+// get differences using WinDiff utility
+
+function getWinDiffDifferences(src1, src2, flags)
+{   
+    try
+    {
+        // first create two temporary files 
+        var tfolder, TemporaryFolder = 2;
+        tfolder = fso.GetSpecialFolder(TemporaryFolder);
+        if (! tfolder)
+            return "unknown";
+    
+        var tname1 = fso.GetTempName();
+        var tfile1 = tfolder.CreateTextFile(tname1);
+        var tpath1 = tfolder.Path + "\\" + tname1;
+        tfile1.Write(src1);
+        tfile1.Close();
+  
+        var tname2 = fso.GetTempName();
+        var tfile2 = tfolder.CreateTextFile(tname2);
+        var tpath2 = tfolder.Path + "\\" + tname2;
+        tfile2.Write(src2);
+        tfile2.Close();
+  
+        var tResName = fso.GetTempName();
+        var tResPath = tfolder.Path + "\\" + tResName;
+  
+        // second run windiff
+        var cmd = "windiff -F" + flags + " " + tResPath;
+        cmd += " " + tpath1;
+        cmd += " " + tpath2;
+
+        var result = WshShell.Run(cmd, 7, true);
+        if (result != 0)
+        {
+            WScript.StdErr.WriteLine(
+                "getWinDiffDifferences: Fatal error: windiff"
+                    + " failed");				
+            return "unknown";
+        }
+    
+        // third read the results
+        var tResFile = fso.OpenTextFile(tfolder.Path + "\\" + tResName);
+        var res = tResFile.ReadAll();
+        tResFile.Close();
+	
+        fso.DeleteFile(tpath1);
+        fso.DeleteFile(tpath2);
+        fso.DeleteFile(tResPath);
+    
+        return res;
+    }
+    catch(e)
+    {
+        return "Information about differences is not available";
+    }
+}
+
+function makeTempFile()
+{
+    var tfolder, TemporaryFolder = 2;
+    tfolder = fso.GetSpecialFolder(TemporaryFolder);
+    
+    var tname = fso.GetTempName();
+    var tfile = tfolder.CreateTextFile(tname);
+    tfile.Close();
+    
+    return tfolder.Path + "\\" + tname;
+}
+
+function encodeHTML(srcString)
+{
+    var res = srcString;
+    var srcS = new Array ( "&", "<", ">", "\"" );
+    var destS = new Array ( "&amp;", "&lt;", "&gt;", "&quot;" );
+    for (var t = 0; t < srcS.length; t++)
+    {
+        var reRep = new RegExp(srcS[t], "mg");
+        res = res.replace(reRep, destS[t]);
+    }
+    
+    return res;
+}
+
+function removeLeadingDot(dotName)
+{
+    var index = dotName.indexOf(".");
+    if (0 != index)
+        return dotName;
+        
+    var resName = dotName.substr(1);
+    return resName;
+}
+
+//////////////////////////////////////////////////////////////////////
+// compile environment
+var activeCompiler = null;
+var activeLinker = null;
+var activeLibrarian = null;
+
+var logFileName = "config.log";
+
+// Setup compiler and linker names and options
+function setCompileEnvironment(solutionName, configurationName
+                                , projectName, logFile)
+{
+    var solution = configurations.get(solutionName);
+    var solutionconfig = solution.configurations.get(configurationName);
+    var projectConfig = 
+        solutionconfig.projectConfigurations.get(projectName);
+    var project = solution.projects.get(projectConfig.projectName);
+    var platform = project.platforms.get(projectConfig.platform);
+    var configuration = 
+        platform.configurations.get(projectConfig.configuration);
+
+    activeCompiler = configuration.tools.get(compilerToolName);
+    activeLinker = configuration.tools.get(linkerToolName);
+    activeLibrarian = configuration.tools.get(librarianToolName);
+
+    logFileName = logFile;
+}
+
+// performs compilation using provided compiler
+function compile(compiler)
+{
+    var command = compiler.getCommandLine();
+    var message = "Compiling with command \"" + command + "\"";
+    logLine(message);
+    return WshShell.Run("cmd /c \"" + command +"\" >> " + 
+        logFileName + " 2>&1", runWindowMode, true);
+}
+
+// performs compilation using active compiler
+function compileFiles(srcs, defines)
+{
+    var compiler = activeCompiler.clone();
+    var srcsArr = srcs.split(" ");
+    for (i in srcsArr)
+    {
+        compiler.inputFiles.add(srcsArr[i]);
+    }
+    if (typeof(defines) == "string")
+    {
+        defines = Array(defines);
+    }
+    if (defines instanceof Array)
+    {
+        for (i in defines)
+        {
+            compiler.defines.add(defines[i]);
+        }
+    }
+    return compile(compiler);
+}
+
+// links using provided linker
+function link(linker)
+{
+     var command = linker.getCommandLine();
+     var message = "Linking with command \"" + command + "\"";
+     logLine(message);
+     return WshShell.Run("cmd /c \"" + command +"\" >> " 
+        + logFileName + " 2>&1", runWindowMode, true);
+}
+
+// links using active linker
+function linkFiles(srcs, outName, linker)
+{
+     if (!linker)
+     {
+        linker = activeLinker.clone();
+     }
+     linker.outputFile = outName;
+     var srcsArr = srcs.split(" ");
+     for (i in srcsArr)
+     {
+        linker.inputFiles.add(srcsArr[i]);
+     }
+     return link(linker);
+}
+
+// preprocesses using provided compiler
+function preprocess(compiler, preprocFile)
+{
+     var command = compiler.getPreprocessCommandLine();
+     var message = "Preprocessing with command \"" + command + "\"";
+     logLine(message);
+     return WshShell.Run("cmd /c \"" + command +"\" > " 
+        + preprocFile + " 2>> " + logFileName, runWindowMode, true);
+}
+
+// preprocesses using active compiler
+function preprocessFile(src, preprocFile)
+{
+     var compiler = activeCompiler.clone();
+     compiler.inputFiles.add(src);
+     return preprocess(compiler, preprocFile);
+}
+
+// links a library using provided librarian
+function buildLibrary(librarian)
+{
+     var command = librarian.getCommandLine();
+     var message = "Making library with command \"" + command + "\"";
+     logLine(message);
+     return WshShell.Run("cmd /c \"" + command +"\" >> " 
+        + logFileName + " 2>&1", runWindowMode, true);
+}
+
+// links a library using active librarian
+function makeLibrary(srcFiles, outDir, outFile, isShared)
+{
+    var ret = compileFiles(srcFiles);
+    if (ret != 0)
+    {
+        return ret;
+    }
+    var objNames = srcFiles.replace(/(?:[\S]+[/\\\\])?([^/\\\\]+\.)cpp/gi, 
+        outDir + "/$1obj");
+        
+    if (isShared)
+    {
+        // call linker to build a dll
+        var linker = activeLinker.clone();
+        linker.isDLL = true;
+        return linkFiles(objNames, outFile, linker);
+    }
+    // call librarian to build lib
+    var librarian = activeLibrarian.clone();
+    librarian.outputFile = outFile;
+    var objsArray = objNames.split(" ");
+    for (i in objsArray)
+    {
+        librarian.inputFiles.add(objsArray);
+    }
+    return buildLibrary(librarian);
+}
+
+// logs text line into a log file
+function logLine(line)
+{
+    var stream = fso.OpenTextFile(logFileName, 8, true, 0);
+    stream.WriteLine(line);
+    stream.Close();
+}

Propchange: incubator/stdcxx/trunk/etc/config/windows/utilities.js
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/stdcxx/trunk/generate.bat
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/generate.bat?rev=349027&view=auto
==============================================================================
--- incubator/stdcxx/trunk/generate.bat (added)
+++ incubator/stdcxx/trunk/generate.bat Fri Nov 25 14:16:34 2005
@@ -0,0 +1,20 @@
+@echo off
+set ERRORLEVEL=0
+cscript /? > nul
+if %errorlevel% neq 0 (
+echo "Windows scripting host is not installed. Please install it."
+set ERRORLEVEL=1
+goto :EOF
+)
+
+set scriptdir=etc\config\windows
+set rungen=generate.wsf
+
+set runfile=%~dp0\%scriptdir%\%rungen%
+
+cscript /nologo %runfile% %*
+if %errorlevel% neq 0 (
+echo "Solution generation script failed."
+set ERRORLEVEL=1
+goto :EOF
+)

Propchange: incubator/stdcxx/trunk/generate.bat
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message