stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r495309 - in /incubator/stdcxx/trunk/etc/config/windows: build.wsf configure.wsf devenv_consts.js generate.wsf makelog.wsf projectdef.js projects.js run_locale_utils.wsf runall.wsf summary.js utilities.js
Date Thu, 11 Jan 2007 17:53:06 GMT
Author: faridz
Date: Thu Jan 11 09:53:05 2007
New Revision: 495309

URL: http://svn.apache.org/viewvc?view=rev&rev=495309
Log:
2007-01-11 Farid Zaripov <faridz@kyiv.vdiweb.com>

	* build.wsf: New script file to build specified configuration
	* configure.wsf (configure): Check if the environment variable
	exist before removing; use MT DLL runtime instead of ST static
	runtime in ST DLL solution configurations
	* devenv_consts.js: Added new constants
	* generate.wsf: Removed unused BUILDTYPE option from usage text;
	by default don't generate projects for build and test locales;
	generate additional solution files (stdlib + examples;
	stdlib + rwtest + tests; stdlib + utils + locales;
	stdlib + utils + locale tests;
	stdlib + utils + run_examples + run_tests); use new build.wsf
	script in generated build batch file
	* makelog.wsf (makelog): Updated according to new directory structure
	* projectdef.js (InitVSObjects): Added freedte parameter, don't free
	dte object if freedte == false;
	(projectCreateVCProject): Use MT DLL runtime instead of ST static
	runtime in ST DLL solution configurations;
	(projectCreateProjectDefsFromFolder): Add name of subfolder to the
	OutDir only if shiftOutDir is true;
	(projectCreateTestLocalesDef): New function to generate project for
	perform all locale tests in one shot;
	* projects.js (CreateProjectDefs): Added generation of the 3 projects:
	.stdcxx_runexamples; .stdcxx_runtests; .stdcxx_testlocales. Now
	returns array of the sets of projects (configure, stdlib, rwtest,
	utils, examples, run_examples, tests, run_tests, locales,
	locale_tests)
	* run_locale_utils.wsf (Cleanup): New function to remove
	temporary folder
	(Exit): New function to exit from script with cleanup
	(CreateFolder): New function to create directory three
	(dump_charmap): New function to dump the charmap of a locale
	(dump_locale): On error exited script with the same non-zero
	exit status as the locale utility
	(generate_locale): Used Exit function
	(test_locale): Called dump_charmap to produce the charmap source
	from the locale database at each of the three stages. Used this
	charmap source to create a locale in each subsequent stage.
	Placed the files created at each stage in separate directories
	named stage.1 through stage.3.
	(run_locale_utils): Avoided deleting stage directories when
	the -n option is set
	* runall.wsf: Parameter INOUTDIR now is optional; removed unused
	parameter COPYRWTESTDLL;
	(readOutFile): check manual and tutorial subfolders when searching
	example requested output file;
	(runWithChecks, runNoChecks): Removed as unused;
	(runAllExamples): Rewritten to use exec utility in packet mode.
	* summary.js (saveBuildInfoTable): encode symbols in example output
	before saving them to HTML file
	(readBuildLog): Added temporary loop to check the run-time error
	"runall.wsf(59, 6) Microsoft JScript runtime error: Permission denied"
	* utilities.js (decodeHTML): New function to decode escaped symbols
	(stripTags): New function to get text from HTML document

Added:
    incubator/stdcxx/trunk/etc/config/windows/build.wsf   (with props)
Modified:
    incubator/stdcxx/trunk/etc/config/windows/configure.wsf
    incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js
    incubator/stdcxx/trunk/etc/config/windows/generate.wsf
    incubator/stdcxx/trunk/etc/config/windows/makelog.wsf
    incubator/stdcxx/trunk/etc/config/windows/projectdef.js
    incubator/stdcxx/trunk/etc/config/windows/projects.js
    incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf
    incubator/stdcxx/trunk/etc/config/windows/runall.wsf
    incubator/stdcxx/trunk/etc/config/windows/summary.js
    incubator/stdcxx/trunk/etc/config/windows/utilities.js

Added: incubator/stdcxx/trunk/etc/config/windows/build.wsf
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/build.wsf?view=auto&rev=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/build.wsf (added)
+++ incubator/stdcxx/trunk/etc/config/windows/build.wsf Thu Jan 11 09:53:05 2007
@@ -0,0 +1,341 @@
+<?xml version="1.0" ?><!-- -*- SGML -*- -->
+<package>
+    <comment>
+        Licensed to the Apache Software Foundation (ASF) under one
+        or more contributor license agreements.  See the NOTICE file
+        distributed with this work for additional information
+        regarding copyright ownership.  The ASF licenses this file
+        to you under the Apache License, Version 2.0 (the
+        "License"); you may not use this file except in compliance
+        with the License.  You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing,
+        software distributed under the License is distributed on an
+        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+        KIND, either express or implied.  See the License for the
+        specific language governing permissions and limitations
+        under the License.
+    </comment>
+    <job id="build" prompt="no">
+        <?job error="false" debug="false" ?>
+        <runtime>
+            <description>
+Builds specified solution configuration
+            </description>
+            <named helpstring="Name of the compiler configuration"
+                name="CONFIG" required="true" type="string"/>
+            <named helpstring="Output directory for modules" 
+                name="BUILDDIR" required="true" type="string"/>
+            <named helpstring="Name of the solution configuration" 
+                name="BUILDTYPE" required="true" type="string"/>
+            <named helpstring="Build projects only, do not execute tests" 
+                name="BUILDONLY" required="false" type="string"/>
+            <example>cscript build.wsf /CONFIG:msvc-7.1 /BUILDTYPE:11d
+            </example>
+            <usage>
+Usage: cscript build.wsf /CONFIG:@CONFIG /BUILDDIR:@BUILDDIR /BUILDTYPE:@BUILDTYPE [/BUILDONLY:@BUILDONLY]
+where
+@CONFIG is the compiler configuration (msvc-7.1, icc-9.0, etc).
+@BUILDDIR is the root of the build directory.
+@BUILDTYPE is the build type (11d, 11s, etc).
+@BUILDONLY is one of { yes, no } - execute or not the tests.
+            </usage>
+        </runtime>
+        <object id="fso" progid="Scripting.FileSystemObject"/>
+        <object id="WshShell" progid="WScript.Shell"/>
+        <script language="JScript" src="config.js"/>
+        <script language="JScript" src="data.js"/>
+        <script language="JScript" src="utilities.js"/>
+        <script language="JScript" src="devenv_consts.js"/>
+        <script language="JScript" src="filterdef.js"/>
+        <script language="JScript" src="projectdef.js"/>
+        <script language="JScript" src="projects.js"/>
+        <script id="build" language="JScript">
+<![CDATA[
+//
+// Solution generation script for Stdcxx library
+//
+
+// constants
+var currentCfg = "";
+var slnDir = "";
+var buildType = "";
+var longConfName = "";
+var buildOnly = false;
+var outputPane = null;
+
+var description = new build; // run
+
+function event_ProjectBuildStarted(Cfg)
+{
+    // clear output window
+    outputPane.Clear();
+
+    // delete old BuildLog.htm
+    var path = Cfg.Evaluate(Cfg.IntermediateDirectory) + "\\BuildLog.htm";
+    if (fso.FileExists(path))
+        fso.DeleteFile(path);
+}
+
+function event_ProjectBuildFinished(Cfg, Warnings, Errors, Canceled)
+{
+    var log = "";
+
+    try
+    {
+        // try get log from BuildLog.htm file
+        var path = Cfg.Evaluate(Cfg.IntermediateDirectory) + "\\BuildLog.htm";
+        var ForReading = 1;
+        var format = UNICODELOG ? -1 : 0;
+        var logStrm = fso.OpenTextFile(path, ForReading, false, format);
+        log = logStrm.ReadAll();
+        logStrm.Close();
+        log = decodeHTML(stripTags(log));
+        var line = "-------";
+        log = log.replace("Build Log", "").replace("Command Lines", line);
+        log = log.replace("Output Window", line).replace("Results", line);
+    }
+    catch (e)
+    {
+        // try get log from output window
+        var sel = outputPane.TextDocument.Selection;
+        sel.SelectAll();
+        log = sel.Text;
+    }
+
+    WScript.Echo(log);
+}
+
+function BuildProject(solutionBuild, projectName)
+{
+    solutionBuild.BuildProject(longConfName, projectName, true);
+    return solutionBuild.LastBuildInfo;
+}
+
+// the main function of the script
+function build()
+{
+    WScript.Echo("Solution build script");
+    WScript.Echo("Checking arguments...");
+    
+    readAndCheckArguments();
+
+    // get solution object
+    InitVSObjects(currentCfg, false);
+    
+    dte.SuppressUI = true;
+    
+    var solutionName = slnDir + "\\" + currentCfg + "\\" + currentCfg + ".sln";
+
+    WScript.Echo("Loading solution...");
+    var solution = dte.Solution;
+
+    var retCode = 0;
+    var prop = null;
+    var propVal;
+    var oldLogging = null;
+    var projectEngine = null;
+    var events = null;
+
+    do
+    {
+        try
+        {
+            solution.Open(solutionName);
+        }
+        catch (e)
+        {
+            WScript.StdErr.WriteLine("Build: Failed to open solution file: " + solutionName);
+            retCode = 2;
+            break;
+        }
+        
+        var solutionBuild = solution.SolutionBuild;
+        projectEngine = solution.Projects.Item(1).Object.VCProjectEngine;
+        
+        events = projectEngine.Events;
+        try
+        {
+            WScript.ConnectObject(events, "event_");
+        }
+        catch (e)
+        {
+            events = null;
+        }
+        
+        var runTests = false;
+        
+        vsWindowKindOutput = "{34E76E81-EE4A-11D0-AE2E-00A0C90FFFC3}";
+        var outWindow = dte.Windows.Item(vsWindowKindOutput).Object;
+        outputPane = outWindow.OutputWindowPanes.Item("Build");
+
+        // save ConcurrentBuilds property value
+        try
+        {
+            prop = dte.Properties("Environment", "ProjectsAndSolution").Item("ConcurrentBuilds");
+            propVal = prop.Value;
+            prop.Value = 1;
+        }
+        catch (e)
+        {
+            // current version of devenv not support that property
+            prop = null;
+        }
+
+        // save BuildLogging property value
+        oldLogging = projectEngine.BuildLogging;
+
+        WScript.Echo("Performing configure step...\n");
+        var res = BuildProject(solutionBuild, "Projects\\configure.vcproj");
+        if (0 < res)
+        {
+            retCode = 3;
+            break;
+        }   
+
+        WScript.Echo("Compiling stdlib library...\n");
+        res = BuildProject(solutionBuild, "Projects\\stdlib.vcproj");
+        if (0 < res)
+        {
+            retCode = 4;
+            break;
+        }   
+
+        WScript.Echo("Compiling examples...\n");
+        BuildProject(solutionBuild, "Projects\\examples\\stdcxx_examples.vcproj");
+
+        WScript.Echo("Compiling rwtest library...\n");
+        res = BuildProject(solutionBuild, "Projects\\rwtest.vcproj");
+        if (0 == res)
+        {
+            runTests = true;
+            WScript.Echo("Compiling tests...\n");
+            BuildProject(solutionBuild, "Projects\\tests\\stdcxx_tests.vcproj");
+        }
+
+        WScript.Echo("Compiling utils...\n");
+        // compile exec utility
+        var resExec = BuildProject(solutionBuild, "Projects\\util\\util_exec.vcproj");
+        // compile rest utils
+        var resUtils = BuildProject(solutionBuild, "Projects\\util\\stdcxx_utils.vcproj");
+        if (0 < resExec)
+        {
+            retCode = 5;
+            break;
+        }
+
+        if (buildOnly)
+           break;
+
+        WScript.Echo("Running examples...\n");
+        BuildProject(solutionBuild, "Projects\\examples\\stdcxx_runexamples.vcproj");
+
+        if (runTests)
+        {
+            WScript.Echo("Running tests...\n");
+            BuildProject(solutionBuild, "Projects\\tests\\stdcxx_runtests.vcproj");
+        }
+        
+        if (0 < resUtils)
+        {
+            retCode = 6;
+            break;
+        }   
+
+        WScript.Echo("Running locales tests...");
+        BuildProject(solutionBuild, "Projects\\locales\\stdcxx_testlocales.vcproj");
+    }
+    while (false);
+
+    if (null != oldLogging)
+        projectEngine.BuildLogging = oldLogging;
+
+    projectEngine = null;
+
+    if (null != events)
+    {
+        WScript.DisconnectObject(events);
+        events = null;
+    }
+
+    outputPane = null;
+
+    // restore ConcurrentBuilds property value
+    if (null != prop)
+        prop.Value = propVal;
+        
+    solution = null;
+    dte.Quit();
+    dte = null;
+
+    WScript.Quit(retCode);
+}
+
+// performs checking of the script parameters
+function readAndCheckArguments()
+{
+    if (!WScript.Arguments.Named.Exists("CONFIG"))
+    {
+        WScript.StdErr.WriteLine(
+            "Build: Missing required argument.");
+        WScript.Arguments.ShowUsage();
+        WScript.Quit(2);
+    }
+    
+    if (!WScript.Arguments.Named.Exists("BUILDDIR"))
+    {
+        WScript.StdErr.WriteLine(
+            "Build: Missing required argument BUILDDIR.");
+        WScript.Arguments.ShowUsage();
+        WScript.Quit(2);
+    }
+
+    if (!WScript.Arguments.Named.Exists("BUILDTYPE"))
+    {
+        WScript.StdErr.WriteLine(
+            "Build: Missing required argument BUILDTYPE.");
+        WScript.Arguments.ShowUsage();
+        WScript.Quit(2);
+    }
+    
+    currentCfg = WScript.Arguments.Named("CONFIG");
+    
+    slnDir = WScript.Arguments.Named("BUILDDIR");
+    slnDir = fso.GetAbsolutePathName (slnDir);
+
+    buildType = WScript.Arguments.Named("BUILDTYPE");
+    
+    for (var i = 0; i < confNames.length; ++i)
+    {
+        var lcfg = confNames[i];
+        var scfg = configs.get(lcfg).out;
+        if (buildType == scfg)
+        {
+            longConfName = lcfg;
+            break;
+        }
+    }
+    
+    if (0 == longConfName.length)
+    {
+        WScript.StdErr.WriteLine(
+            "Build: Invalid argument BUILDTYPE.");
+        WScript.Arguments.ShowUsage();
+        WScript.Quit(2);
+    }
+    
+    if (WScript.Arguments.Named.Exists("BUILDONLY"))
+    {
+        var copyOption = WScript.Arguments.Named("BUILDONLY");
+        copyOption = copyOption.toLowerCase();
+        
+        if (copyOption == "yes" || copyOption == "y")
+            buildOnly = true;
+    }
+}
+]]>
+        </script>
+    </job>
+</package>

Propchange: incubator/stdcxx/trunk/etc/config/windows/build.wsf
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: incubator/stdcxx/trunk/etc/config/windows/configure.wsf
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/configure.wsf?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/configure.wsf (original)
+++ incubator/stdcxx/trunk/etc/config/windows/configure.wsf Thu Jan 11 09:53:05 2007
@@ -191,10 +191,13 @@
 
     // remove VS_UNICODE_OUTPUT environment variable
     // http://blogs.msdn.com/freik/archive/2006/04/05/569025.aspx
-    try
     {
-        WshShell.Environment("PROCESS").Remove("VS_UNICODE_OUTPUT");
-    } catch (e) {}
+        var env = WshShell.Environment("PROCESS");
+        var name = "VS_UNICODE_OUTPUT";
+        var str = env.Item(name);
+        if ("undefined" != typeof(str) && "" != str)
+            env.Remove(name);
+    }
 
     getCompilerOpts(WScript.Arguments.Named("SolutionName"));
     
@@ -204,10 +207,10 @@
 
     CPPFLAGS += " /M";
 
-    if (!confInfo.mt)
-        CPPFLAGS += NOSTCRT ? "T" : "L";
+    if (confInfo.dll)
+        CPPFLAGS += "D";
     else
-        CPPFLAGS += confInfo.dll ? "D" : "T";
+        CPPFLAGS += (confInfo.mt || NOSTCRT) ? "T" : "L";
 
     if (confInfo.debug)
     {

Modified: incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js Thu Jan 11 09:53:05 2007
@@ -132,3 +132,7 @@
 var runtimeCheckStackFrame = 1;
 var runtimeCheckUninitVariables = 2;
 var runtimeBasicCheckAll = 3;
+
+var vsBuildStateNotStarted = 1;
+var vsBuildStateInProgress = 2;
+var vsBuildStateDone = 3;

Modified: incubator/stdcxx/trunk/etc/config/windows/generate.wsf
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/generate.wsf?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/generate.wsf (original)
+++ incubator/stdcxx/trunk/etc/config/windows/generate.wsf Thu Jan 11 09:53:05 2007
@@ -24,8 +24,8 @@
             <description>
 Generates solution file for a specified environment
             </description>
-            <named helpstring="Name of the solution" name="CONFIG" 
-                required="true" type="string"/>
+            <named helpstring="Name of the compiler configuration"
+                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" 
@@ -41,17 +41,16 @@
             </example>
             <usage>
 Usage: cscript generate.wsf /CONFIG:@CONFIG 
-/BUILDDIR:@BUILDDIR [/TOPDIR:@TOPDIR] 
-[/BUILDTYPE:@BUILDTYPE] [/BUILDONLY:@BUILDONLY] [/COPYDLL:@COPYDLL]
+/BUILDDIR:@BUILDDIR [/TOPDIR:@TOPDIR] [/COPYDLL:@COPYDLL]
 [/LOCALES:@LOCALES] [/LOCALETESTS:@LOCALETESTS]
 where
 @CONFIG is the compiler configuration (msvc-7.1, icc-9.0, etc).
-@TOPDIR is the root of the stdcxx source tree,
-@BUILDDIR is the root of the build directory,
-@COPYDLL is one of { yes, no }; when yes, the stdcxx DLL will be copied
-into each directory containing an executable program built by the solution
-@LOCALES is one of { yes, no } - generate projects for build locales
-@LOCALETESTS is one of { yes, no } - generate projects for test locales
+@TOPDIR is the root of the stdcxx source tree.
+@BUILDDIR is the root of the build directory.
+@COPYDLL is one of { yes, no }; when yes, the stdcxx DLL will be copied.
+into each directory containing an executable program built by the solution.
+@LOCALES is one of { yes, no } - generate projects for build locales.
+@LOCALETESTS is one of { yes, no } - generate projects for test locales.
             </usage>
         </runtime>
         <object id="fso" progid="Scripting.FileSystemObject"/>
@@ -78,8 +77,8 @@
 var logStream = null;
 var currentCfg = "";
 var copyDll = false;
-var buildLocales = true;
-var testLocales = true;
+var buildLocales = false;
+var testLocales = false;
 var winconfigDir = "\\etc\\config\\windows";
 
 var description = new generate; // run
@@ -118,8 +117,6 @@
     PrintVars(logStream);
     PrintVars(WScript.StdOut);
     
-    var solutionName = currentCfg + ".sln";
-
     LogMessage("Creating projects definitions...");
     var projectDefs = CreateProjectsDefs(copyDll, buildLocales, testLocales);
 
@@ -133,7 +130,40 @@
     }
 
     LogMessage("Writing solution on disk...");
-    generateSolution(projectDefs, outDir, solutionName);
+    var solutionName = currentCfg + ".sln";
+    var exsolutionName = currentCfg + "_ex.sln";
+    var tstsolutionName = currentCfg + "_tst.sln";
+    var locsolutionName = currentCfg + "_loc.sln";
+    var tstlocsolutionName = currentCfg + "_tstloc.sln";
+    var runsolutionName = currentCfg + "_run.sln";
+
+    var configureDefs = projectDefs[0];
+    var stdlibDefs = projectDefs[1];
+    var rwtestDefs = projectDefs[2];
+    var utilDefs = projectDefs[3];
+    var exampleDefs = projectDefs[4];
+    var runexamplesDefs = projectDefs[5];
+    var testDefs = projectDefs[6];
+    var runtestsDefs = projectDefs[7];
+    var localeDefs = projectDefs[8];
+    var testlocaleDefs = projectDefs[9];
+
+    var solution = new Array();
+    for (var i = 0; i < projectDefs.length; ++i)
+        solution = solution.concat(projectDefs[i]);
+
+    var exsolution = configureDefs.concat(stdlibDefs).concat(exampleDefs);
+    var tstsolution = configureDefs.concat(stdlibDefs).concat(rwtestDefs).concat(testDefs);
+    var locsolution = configureDefs.concat(stdlibDefs).concat(utilDefs).concat(localeDefs);
+    var tstlocsolution = configureDefs.concat(stdlibDefs).concat(utilDefs).concat(testlocaleDefs);
+    var runsolution = configureDefs.concat(stdlibDefs).concat(utilDefs).concat(runexamplesDefs).concat(runtestsDefs);
+
+    generateSolution(solution, outDir, solutionName);
+    generateSolution(exsolution, outDir, exsolutionName);
+    generateSolution(tstsolution, outDir, tstsolutionName);
+    generateSolution(locsolution, outDir, locsolutionName);
+    generateSolution(tstlocsolution, outDir, tstlocsolutionName);
+    generateSolution(runsolution, outDir, runsolutionName);
 
     projectDefs = null;
     VCProjectEngine = null;
@@ -243,8 +273,8 @@
         var option = WScript.Arguments.Named("LOCALES");
         option = option.toLowerCase();
         
-        if (option == "no" || option == "n")
-            buildLocales = false;
+        if (option != "no" && option != "n")
+            buildLocales = true;
     }
 
     if (WScript.Arguments.Named.Exists("LOCALETESTS"))
@@ -252,8 +282,8 @@
         var option = WScript.Arguments.Named("LOCALETESTS");
         option = option.toLowerCase();
         
-        if (option == "no" || option == "n")
-            testLocales = false;
+        if (option != "no" && option != "n")
+            testLocales = true;
     }
 }
 
@@ -324,9 +354,10 @@
         buildBatchFile.WriteLine("set makelog=makelog.wsf");
         buildBatchFile.WriteLine("set cfg=");
         buildBatchFile.WriteLine("set cfgbrief=");
+        buildBatchFile.WriteLine("set devenv=\"" + DEVENV + "\"");
         buildBatchFile.WriteLine("");
         
-	    buildBatchFile.WriteLine(":cfgloop");
+        buildBatchFile.WriteLine(":cfgloop");
         buildBatchFile.WriteLine("if \"%1\"==\"\" goto continue");
         buildBatchFile.WriteLine("");
         
@@ -349,12 +380,11 @@
         buildBatchFile.WriteLine("goto nextcfg");
         buildBatchFile.WriteLine(")");
         buildBatchFile.WriteLine("");
-        
-        buildBatchFile.WriteLine("\"" + DEVENV + "\" " + DEVENVFLAGS +
-            " \"%builddir%\\" + currentCfg +
-            "\\" + currentCfg + ".sln\" /build \"%cfg%\"");
-            
-        buildBatchFile.WriteLine("");
+
+        buildBatchFile.WriteLine("cscript /nologo "
+            + "\"%topdir%\\%scriptdir%\\build.wsf\""
+            + " /BUILDDIR:\"%builddir%\" /BUILDTYPE:%cfgbrief%"
+            + " /CONFIG:" + currentCfg);
         buildBatchFile.WriteLine("cscript /nologo "
             + "\"%topdir%\\%scriptdir%\\%makelog%\""
             + " /BUILDDIR:\"%builddir%\" /BUILDTYPE:%cfgbrief%"

Modified: incubator/stdcxx/trunk/etc/config/windows/makelog.wsf
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/makelog.wsf?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/makelog.wsf (original)
+++ incubator/stdcxx/trunk/etc/config/windows/makelog.wsf Thu Jan 11 09:53:05 2007
@@ -125,8 +125,12 @@
     saveBuildSummarySingle(fSum, rwtestInfo, hdrTestDriver);
     
     // save build summary for examples and tests
-    saveBuildSummaryMulti(fSum, buildDir + "\\" + buildType + "\\" + examplesBuildDir);
-    saveBuildSummaryMulti(fSum, buildDir + "\\" + buildType + "\\" + testsBuildDir);
+    saveBuildSummariesFromFolder(fSum,
+        buildDir + "\\" + buildType + "\\" + examplesBuildDir,
+        htmFolderName);
+    saveBuildSummariesFromFolder(fSum,
+        buildDir + "\\" + buildType + "\\" + testsBuildDir,
+        htmFolderName);
         
     closeSummaryLog(fSum);
 
@@ -243,9 +247,10 @@
 // tempName - name of the folder with temporary files
 function deleteTempFolders(startDir, tempName)
 {
-    var startFolder = fso.GetFolder(startDir);
-    if (! startFolder)
+    if (!fso.FolderExists(startDir))
         return;
+
+    var startFolder = fso.GetFolder(startDir);
         
     var enumHtmSubFolders = new Enumerator(startFolder.SubFolders);
     for (; !enumHtmSubFolders.atEnd(); enumHtmSubFolders.moveNext())

Modified: incubator/stdcxx/trunk/etc/config/windows/projectdef.js
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/projectdef.js?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/projectdef.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/projectdef.js Thu Jan 11 09:53:05 2007
@@ -30,6 +30,7 @@
 // the timeout for the exec utility
 var execTimeout = 180;
 
+var dte = null;
 var VCProjectEngine = null;
 var ICConvertTool = "ICProjConvert90.exe";
 
@@ -49,12 +50,11 @@
 
 // init VisualStudio objects using specified configuration
 // config - name of configuration (e.g. msvc-7.0)
-function InitVSObjects(config)
+// freedte - if undefined or true then free dte inside function
+function InitVSObjects(config, freedte)
 {
     getCompilerOpts(config);
 
-    var dte = null;
-
     try
     {
         dte = WScript.CreateObject("VisualStudio.DTE." + VERSION);
@@ -110,7 +110,7 @@
         }
     }
 
-    if (null != dte)
+    if (("undefined" == typeof(freedte) || true == freedte) && (null != dte))
     {
         dte.Quit();
         dte = null;
@@ -172,6 +172,7 @@
 ProjectDef.prototype.createProjectDefsFromFolder = projectCreateProjectDefsFromFolder;
 ProjectDef.prototype.createLocaleDefs = projectCreateLocaleDefs;
 ProjectDef.prototype.createTestLocaleDefs = projectCreateTestLocaleDefs;
+ProjectDef.prototype.createTestLocalesDef = projectCreateTestLocalesDef;
 
 // returns copy of ProjectDef object
 function projectCloneDef()
@@ -426,29 +427,26 @@
             
             compiler.ExceptionHandling = cppExceptionHandlingYes;
             compiler.RuntimeTypeInfo = this.RTTI;
-            
-            if (confInfo.mt)
+
+            if (confInfo.dll)
             {
-                if (confInfo.dll)
-                    compiler.RuntimeLibrary = confInfo.debug ?
-                        rtMultiThreadedDebugDLL : rtMultiThreadedDLL;
-                else
-                    compiler.RuntimeLibrary = confInfo.debug ?
-                        rtMultiThreadedDebug : rtMultiThreaded;
+                // the singlethreaded dll runtimes are not present
+                // always use the multithreaded dll runtime
+                compiler.RuntimeLibrary = confInfo.debug ?
+                    rtMultiThreadedDebugDLL : rtMultiThreadedDLL;
             }
             else
             {
-                if (!NOSTCRT)
-                    // use singlethreaded runtimes
+                if (confInfo.mt || NOSTCRT)
+                    // use multithreaded runtimes
                     compiler.RuntimeLibrary = confInfo.debug ?
-                        rtSingleThreadedDebug : rtSingleThreaded;
+                        rtMultiThreadedDebug : rtMultiThreaded;
                 else
-                    // the singlethreaded runtimes are not present
-                    // use the multithreaded instead
+                    // use singlethreaded runtimes
                     compiler.RuntimeLibrary = confInfo.debug ?
-                        rtMultiThreadedDebug : rtMultiThreaded;
+                        rtSingleThreadedDebug : rtSingleThreaded;
             }
-            
+
             compiler.UsePrecompiledHeader = pchNone;
         }
 
@@ -557,7 +555,9 @@
 // inclFiles - regular expression to define include files
 // exclDirs - regular expression to define exclude folder
 // exclFiles - regular expression to define exclude files
-function projectCreateProjectDefsFromFolder(startDir, inclFiles, exclDirs, exclFiles)
+// shiftOutDir - if true then add subfolder name to the OutDir path
+function projectCreateProjectDefsFromFolder(startDir,
+    inclFiles, exclDirs, exclFiles, shiftOutDir)
 {
     var projectDefs = new Array();
     
@@ -573,11 +573,14 @@
             continue;
         }
         
-        var newDefs = this.createProjectDefsFromFolder(
-            subFolder.Path, inclFiles, exclDirs, exclFiles);
+        var newDefs = this.createProjectDefsFromFolder(subFolder.Path,
+            inclFiles, exclDirs, exclFiles, shiftOutDir);
 
-        for (var i = 0; i < newDefs.length; ++i)
-            newDefs[i].OutDir += "\\" + subFolder.Name;
+        if (shiftOutDir)
+        {
+            for (var i = 0; i < newDefs.length; ++i)
+                newDefs[i].OutDir += "\\" + subFolder.Name;
+        }
         
         projectDefs = projectDefs.concat(newDefs);
     }
@@ -822,4 +825,72 @@
     }    
 
     return projectDefs;
+}
+
+// create  ProjectDef object for test all locales
+// nlsDir - folder containing locale source files
+function projectCreateTestLocalesDef(nlsDir)
+{
+    nlsDir = ReplaceMacros(nlsDir, cmnMacros);
+
+    if (typeof(this.arrLocales) == "undefined")
+        ProjectDef.prototype.arrLocales = initLocalesList(nlsDir);
+        
+    var srcdir = "%SRCDIR%\\etc\\config\\windows";
+    var bindir = "$(SolutionDir)%CONFIG%\\bin";
+    var test = "sanity_test";
+
+    // create test_locale_sanity project
+    var projectDef = this.clone();
+    if (null == projectDef.PreBuildCmd)
+        projectDef.PreBuildCmd = "";
+    else
+        projectDef.PreBuildCmd += "\r\n";
+    projectDef.PreBuildCmd +=
+        "echo cscript /nologo \"" + srcdir + "\\run_locale_utils.wsf\"" +
+        " /s /b:\"" + bindir + "\" > \"" + bindir + "\\" + test + ".bat\"";
+    projectDef.CustomBuildCmd = "cd \"" + bindir + "\"\r\n" +
+        "exec.exe -t " + execTimeout + " " + test + ".bat";
+    projectDef.CustomBuildOut = bindir + "\\" + test + ".out";
+        
+    for (var i = 0; i < this.arrLocales.length; ++i)
+    {
+        var locale = this.arrLocales[i];
+        srcFileName = nlsDir + "\\src\\" + locale.srcName;
+        cmFileName = nlsDir + "\\charmaps\\" + locale.cmName;
+
+        var cmFile;
+        var srcFile;
+        
+        try
+        {
+            cmFile = fso.GetFile(cmFileName);
+        }
+        catch (e)
+        {
+            WScript.StdErr.WriteLine("Generate: Fatal error: File " +
+                cmFileName + " not found");
+            WScript.Quit(3);
+        }
+
+        try
+        {
+            srcFile = fso.GetFile(srcFileName);
+        }
+        catch (e)
+        {
+            WScript.StdErr.WriteLine("Generate: Fatal error: File " +
+                srcFileName + " not found");
+            WScript.Quit(3);
+        }
+
+        projectDef.PreBuildCmd += "\r\n" +
+            "echo cscript /nologo \"" + srcdir + "\\run_locale_utils.wsf\"" +
+            " /f /b:\"" + bindir + "\" /i:\"" + nlsDir + "\"" +
+            " /l:" + locale.Name + " > \"" + bindir + "\\" + locale.Name + ".bat\"";
+        projectDef.CustomBuildCmd += " " + locale.Name + ".bat";
+        projectDef.CustomBuildOut += ";" + bindir + "\\" + locale.Name + ".out";
+    }    
+
+    return projectDef;
 }

Modified: incubator/stdcxx/trunk/etc/config/windows/projects.js
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/projects.js?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/projects.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/projects.js Thu Jan 11 09:53:05 2007
@@ -47,7 +47,7 @@
 {
     var projectDefs = new Array();
  
- ///////////////////////////////////////////////////////////////////////////////   
+///////////////////////////////////////////////////////////////////////////////
     var configureDef = new ProjectDef(".configure", typeGeneric);
     configureDef.VCProjDir = ProjectsDir;
     configureDef.FilterDefs.push(
@@ -74,9 +74,9 @@
     configureDef.CustomBuildOut = "$(OutDir)\\config.h";
     configureDef.CustomBuildDeps = "%FILES%";
 
-    projectDefs.push(configureDef);
+    projectDefs.push(new Array(configureDef));
 
-///////////////////////////////////////////////////////////////////////////////   
+///////////////////////////////////////////////////////////////////////////////
     var stdlibDef = new ProjectDef(".stdlib", typeLibrary);
     stdlibDef.VCProjDir = ProjectsDir;
     stdlibDef.FilterDefs.push(
@@ -95,9 +95,9 @@
     stdlibDef.OutFile = "$(OutDir)\\stdlib%CONFIG%%EXT%";
     stdlibDef.PrjDeps.push(configureDef);
 
-    projectDefs.push(stdlibDef);
+    projectDefs.push(new Array(stdlibDef));
 
-///////////////////////////////////////////////////////////////////////////////   
+///////////////////////////////////////////////////////////////////////////////
     var rwtestDef = new ProjectDef(".rwtest", typeLibrary);
     rwtestDef.VCProjDir = ProjectsDir;
     rwtestDef.FilterDefs.push(
@@ -115,9 +115,11 @@
     rwtestDef.Libs = commonLibs;
     rwtestDef.PrjRefs.push(stdlibDef);
 
-    projectDefs.push(rwtestDef);
+    projectDefs.push(new Array(rwtestDef));
+
+///////////////////////////////////////////////////////////////////////////////
+    var utilsArray = new Array();
 
-///////////////////////////////////////////////////////////////////////////////   
     var execDef = new ProjectDef("util_exec", typeApplication);
     execDef.VCProjDir = ProjectsDir + "\\util";
     execDef.FilterDefs.push(
@@ -135,9 +137,9 @@
     execDef.OutFile = "$(OutDir)\\exec.exe";
     execDef.PrjDeps.push(configureDef);
 
-    projectDefs.push(execDef);
+    utilsArray.push(execDef);
 
-///////////////////////////////////////////////////////////////////////////////   
+///////////////////////////////////////////////////////////////////////////////
     var localedefDef = new ProjectDef("util_localedef", typeApplication);
     localedefDef.VCProjDir = ProjectsDir + "\\util";
     localedefDef.FilterDefs.push(
@@ -160,9 +162,9 @@
     localedefDef.OutFile = "$(OutDir)\\localedef.exe";
     localedefDef.PrjRefs.push(stdlibDef);
 
-    projectDefs.push(localedefDef);
+    utilsArray.push(localedefDef);
 
-///////////////////////////////////////////////////////////////////////////////   
+///////////////////////////////////////////////////////////////////////////////
     var localeDef = new ProjectDef("util_locale", typeApplication);
     localeDef.VCProjDir = ProjectsDir + "\\util";
     localeDef.FilterDefs.push(
@@ -185,10 +187,10 @@
     localeDef.OutFile = "$(OutDir)\\locale.exe";
     localeDef.PrjRefs.push(stdlibDef);
 
-    projectDefs.push(localeDef);
+    utilsArray.push(localeDef);
 
-///////////////////////////////////////////////////////////////////////////////   
-    var utilsDef = new ProjectDef(".stdlib_utils", typeGeneric);
+///////////////////////////////////////////////////////////////////////////////
+    var utilsDef = new ProjectDef(".stdcxx_utils", typeGeneric);
     utilsDef.VCProjDir = ProjectsDir + "\\util";
     utilsDef.OutDir = "$(SolutionDir)%CONFIG%\\bin";
     utilsDef.IntDir = utilsDef.OutDir;
@@ -196,9 +198,13 @@
     utilsDef.PrjDeps.push(localedefDef);
     utilsDef.PrjDeps.push(localeDef);
 
-    projectDefs.push(utilsDef);
+    utilsArray.push(utilsDef);
+
+    projectDefs.push(utilsArray);
+
+///////////////////////////////////////////////////////////////////////////////
+    var exampleArray = new Array();
 
-///////////////////////////////////////////////////////////////////////////////   
     var exampleTplDef = new ProjectDef(null, typeApplication);
     exampleTplDef.VCProjDir = ProjectsDir + "\\examples";
     exampleTplDef.Defines = commonDefines;
@@ -211,12 +217,23 @@
         "%SRCDIR%\\examples",
         new RegExp("^.+\\.(?:cpp)$", "i"),
         new RegExp("^(?:\\.svn|Release.*|Debug.*|in|out|CVS)$", "i"),
-        new RegExp("^(?:rwstdmessages.cpp)$", "i"));
+        new RegExp("^(?:rwstdmessages.cpp)$", "i"), false);
 
-    projectDefs = projectDefs.concat(exampleDefs);
+    exampleArray = exampleArray.concat(exampleDefs);
     
-///////////////////////////////////////////////////////////////////////////////   
-    var runexamplesDef = new ProjectDef(".stdlib_examples", typeGeneric);
+///////////////////////////////////////////////////////////////////////////////
+    var allexamplesDef = new ProjectDef(".stdcxx_examples", typeGeneric);
+    allexamplesDef.VCProjDir = ProjectsDir + "\\examples";
+    allexamplesDef.OutDir = "$(SolutionDir)%CONFIG%\\examples";
+    allexamplesDef.IntDir = allexamplesDef.OutDir;
+    allexamplesDef.PrjDeps = exampleDefs;
+
+    exampleArray.push(allexamplesDef);
+
+    projectDefs.push(exampleArray);
+
+///////////////////////////////////////////////////////////////////////////////
+    var runexamplesDef = new ProjectDef(".stdcxx_runexamples", typeGeneric);
     runexamplesDef.VCProjDir = ProjectsDir + "\\examples";
     runexamplesDef.FilterDefs.push(
         new FilterDef("Script Files", null, ".js;.wsf", eFileTypeScript, false).
@@ -239,12 +256,14 @@
         " /LIBDIR:\"$(SolutionDir)lib\"";
     runexamplesDef.CustomBuildOut = "$(OutDir)\\runexamples.log";
     runexamplesDef.CustomBuildDeps = "%FILES%";
-    runexamplesDef.PrjDeps = exampleDefs;
+    //runexamplesDef.PrjDeps.push(allexamplesDef);
     runexamplesDef.PrjDeps.push(execDef);
 
-    projectDefs.push(runexamplesDef);
+    projectDefs.push(new Array(runexamplesDef));
+
+///////////////////////////////////////////////////////////////////////////////
+    var testArray = new Array();
 
-///////////////////////////////////////////////////////////////////////////////   
     var testTplDef = new ProjectDef(null, typeApplication);
     testTplDef.VCProjDir = ProjectsDir + "\\tests";
     testTplDef.Defines = commonDefines;
@@ -258,12 +277,23 @@
         "%SRCDIR%\\tests",
         new RegExp("^.+\\.(?:cpp)$", "i"),
         new RegExp("^(?:\\.svn|Release.*|Debug.*|in|out|CVS|src|include)$","i"),
-        new RegExp("^(?:rwstdmessages.cpp)$","i"));
+        new RegExp("^(?:rwstdmessages.cpp)$","i"), false);
 
-    projectDefs = projectDefs.concat(testDefs);
+    testArray = testArray.concat(testDefs);
     
-///////////////////////////////////////////////////////////////////////////////   
-    var runtestsDef = new ProjectDef(".stdlib_tests", typeGeneric);
+///////////////////////////////////////////////////////////////////////////////
+    var alltestsDef = new ProjectDef(".stdcxx_tests", typeGeneric);
+    alltestsDef.VCProjDir = ProjectsDir + "\\tests";
+    alltestsDef.OutDir = "$(SolutionDir)%CONFIG%\\tests";
+    alltestsDef.IntDir = alltestsDef.OutDir;
+    alltestsDef.PrjDeps = testDefs;
+
+    testArray.push(alltestsDef);
+
+    projectDefs.push(testArray);
+
+///////////////////////////////////////////////////////////////////////////////
+    var runtestsDef = new ProjectDef(".stdcxx_runtests", typeGeneric);
     runtestsDef.VCProjDir = ProjectsDir + "\\tests";
     runtestsDef.FilterDefs.push(
         new FilterDef("Script Files", null, ".js;.wsf", eFileTypeScript, false).
@@ -277,22 +307,22 @@
         "if exist \"$(OutDir)\\runtests.log\" del \"$(OutDir)\\runtests.log\"";
     runtestsDef.CustomBuildFile = "runall.wsf";
     runtestsDef.CustomBuildCmd = "cscript /nologo \"%CUSTOMFILE%\"" +
-        " /INOUTDIR:\"%SRCDIR%\\tests\"" +
         " /EXEDIR:\"$(OutDir)\"" +
         " /BUILDTYPE:\"%CONFIG%\"" +
         " /CONFIG:\"%SOLUTION%\"" +
         " /LOGFILE:\"runtests.log\"" +
         " /COPYDLL:" + (copyDll ? "false" : "true") +
-        " /COPYRWTESTDLL:" + (copyDll ? "false" : "true") +
         " /LIBDIR:\"$(SolutionDir)lib\"";
     runtestsDef.CustomBuildOut = "$(OutDir)\\runtests.log";
     runtestsDef.CustomBuildDeps = "%FILES%";
-    runtestsDef.PrjDeps = testDefs;
+    //runtestsDef.PrjDeps.push(alltestsDef);
     runtestsDef.PrjDeps.push(execDef);
 
-    projectDefs.push(runtestsDef);
+    projectDefs.push(new Array(runtestsDef));
+
+///////////////////////////////////////////////////////////////////////////////
+    var localeArray = new Array();
 
-///////////////////////////////////////////////////////////////////////////////   
     if (buildLocales)
     {
         var localeTplDef = new ProjectDef(null, typeGeneric);
@@ -320,61 +350,62 @@
         }
     
         var localeDefs = localeTplDef.createLocaleDefs("%SRCDIR%\\etc\\nls");
+
+        localeArray = localeArray.concat(localeDefs);
     
-        projectDefs = projectDefs.concat(localeDefs);
-        
-        var localesDef = new ProjectDef(".stdlib_locales", typeGeneric);
+        var localesDef = new ProjectDef(".stdcxx_locales", typeGeneric);
         localesDef.VCProjDir = ProjectsDir + "\\locales";
         localesDef.OutDir = "$(SolutionDir)nls";
         localesDef.IntDir = localesDef.OutDir;
         localesDef.PrjDeps = localeDefs;
-    
-        projectDefs.push(localesDef);
+
+        localeArray.push(localesDef);
     }
 
+    projectDefs.push(localeArray);
+
 ///////////////////////////////////////////////////////////////////////////////
+    var testlocaleArray = new Array();
+
+    var testlocaleTplDef = new ProjectDef(".stdcxx_testlocales", typeGeneric);
+    testlocaleTplDef.VCProjDir = ProjectsDir + "\\locales";
+    testlocaleTplDef.FilterDefs.push(
+        new FilterDef("Script Files", null, "js;wsf", eFileTypeScript, false).
+            addFiles("%SRCDIR%\\etc\\config\\windows",
+                     new Array("run_locale_utils.wsf")));
+    testlocaleTplDef.OutDir = "$(SolutionDir)%CONFIG%\\bin";
+    testlocaleTplDef.IntDir = testlocaleTplDef.OutDir;
+    testlocaleTplDef.CustomBuildFile = "run_locale_utils.wsf";
+    testlocaleTplDef.CustomBuildDeps = "%FILES%";
+    testlocaleTplDef.PrjDeps.push(execDef);
+    testlocaleTplDef.PrjDeps.push(localeDef);
+    testlocaleTplDef.PrjDeps.push(localedefDef);
+    if (!copyDll)
+    {
+        // copy stdlibxxx.dll to the bin directory
+        // before executing run_locale_utils.wsf script
+        // and finally delete the copied file
+        var libname = "stdlib%CONFIG%.dll";
+        var src = "\"$(SolutionDir)lib\\" + libname + "\"";
+        var dst = "\"$(SolutionDir)%CONFIG%\\bin\\" + libname + "\"";
+        testlocaleTplDef.PreBuildCmd = "if exist " + src + " if not exist " + dst +
+                                     " copy /Y " + src + " " + dst;
+        testlocaleTplDef.PostBuildCmd = "if exist " + dst + " del " + dst;
+    }
+
     if (testLocales)
     {
-        var testlocaleTplDef = new ProjectDef(null, typeGeneric);
-        testlocaleTplDef.VCProjDir = ProjectsDir + "\\locales";
-        testlocaleTplDef.FilterDefs.push(
-            new FilterDef("Script Files", null, "js;wsf", eFileTypeScript, false).
-                addFiles("%SRCDIR%\\etc\\config\\windows",
-                         new Array("run_locale_utils.wsf")));
-        testlocaleTplDef.OutDir = "$(SolutionDir)%CONFIG%\\bin";
-        testlocaleTplDef.IntDir = testlocaleTplDef.OutDir + "\\$(ProjectName)";
-        testlocaleTplDef.CustomBuildFile = "run_locale_utils.wsf";
-        testlocaleTplDef.CustomBuildDeps = "%FILES%";
-        testlocaleTplDef.PrjDeps.push(execDef);
-        testlocaleTplDef.PrjDeps.push(localeDef);
-        testlocaleTplDef.PrjDeps.push(localedefDef);
-        if (!copyDll)
-        {
-            // copy stdlibxxx.dll to the bin directory
-            // before executing run_locale_utils.wsf script
-            // and finally delete the copied file
-            var libname = "stdlib%CONFIG%.dll";
-            var src = "\"$(SolutionDir)lib\\" + libname + "\"";
-            var dst = "\"$(SolutionDir)%CONFIG%\\bin\\" + libname + "\"";
-            testlocaleTplDef.PreBuildCmd = "if exist " + src + " if not exist " + dst +
-                                           " copy /Y " + src + " " + dst;
-            testlocaleTplDef.PostBuildCmd = "if exist " + dst + " del " + dst;
-        }
-        
         var testlocaleDefs = testlocaleTplDef.createTestLocaleDefs("%SRCDIR%\\etc\\nls");
     
-        projectDefs = projectDefs.concat(testlocaleDefs);
-        
-        var testlocalesDef = new ProjectDef(".stdlib_testlocales", typeGeneric);
-        testlocalesDef.VCProjDir = ProjectsDir + "\\locales";
-        testlocalesDef.OutDir = "$(SolutionDir)bin";
-        testlocalesDef.IntDir = testlocalesDef.OutDir;
-        testlocalesDef.PrjDeps = testlocaleDefs;
-    
-        projectDefs.push(testlocalesDef);
+        testlocaleArray = testlocaleArray.concat(testlocaleDefs);
     }
     
-///////////////////////////////////////////////////////////////////////////////   
+    var testlocalesDef = testlocaleTplDef.createTestLocalesDef("%SRCDIR%\\etc\\nls");
+    testlocaleArray.push(testlocalesDef);
+
+    projectDefs.push(testlocaleArray);
+
+///////////////////////////////////////////////////////////////////////////////
     if (copyDll)
     {
         // if project type is application and
@@ -384,48 +415,53 @@
         //     copy rwtest.dll to project output directory
         for (var i = 0; i < projectDefs.length; ++i)
         {
-            var projectDef = projectDefs[i];
-
-            if (projectDef.Type != typeApplication)
-                continue;
+            var projectArray = projectDefs[i];
 
-            var arrDeps = projectDef.PrjRefs.concat(projectDef.PrjDeps);
-            var command = "";
-
-            if (0 <= arrayIndexOf(arrDeps, stdlibDef))
+            for (var j = 0; j < projectArray.length; ++j)
             {
-                var libname = "stdlib%CONFIG%.dll";
-                var src = "\"$(SolutionDir)lib\\" + libname + "\"";
-                var dst = "\"$(OutDir)\\" + libname + "\"";
-                var cmd = "if exist " + src + " (\r\n" +
-                          "del " + dst + "\r\n" +
-                          "copy /Y " + src + " " + dst + "\r\n" +
-                          ")";
-                if (0 == command.length)
-                    command = cmd;
-                else
-                    command += "\r\n" + cmd;
-            }
+                var projectDef = projectArray[j];
 
-            if (0 <= arrayIndexOf(arrDeps, rwtestDef))
-            {
-                var libname = "rwtest.dll";
-                var src = "\"$(SolutionDir)%CONFIG%\\tests\\" + libname + "\"";
-                var dst = "\"$(OutDir)\\" + libname + "\"";
-                var cmd = "if exist " + src + " (\r\n" +
-                          "del " + dst + "\r\n" +
-                          "copy /Y " + src + " " + dst + "\r\n" +
-                          ")";
-                if (0 == command.length)
-                    command = cmd;
+                if (projectDef.Type != typeApplication)
+                    continue;
+    
+                var arrDeps = projectDef.PrjRefs.concat(projectDef.PrjDeps);
+                var command = "";
+    
+                if (0 <= arrayIndexOf(arrDeps, stdlibDef))
+                {
+                    var libname = "stdlib%CONFIG%.dll";
+                    var src = "\"$(SolutionDir)lib\\" + libname + "\"";
+                    var dst = "\"$(OutDir)\\" + libname + "\"";
+                    var cmd = "if exist " + src + " (\r\n" +
+                              "del " + dst + "\r\n" +
+                              "copy /Y " + src + " " + dst + "\r\n" +
+                              ")";
+                    if (0 == command.length)
+                        command = cmd;
+                    else
+                        command += "\r\n" + cmd;
+                }
+    
+                if (0 <= arrayIndexOf(arrDeps, rwtestDef))
+                {
+                    var libname = "rwtest.dll";
+                    var src = "\"$(SolutionDir)%CONFIG%\\tests\\" + libname + "\"";
+                    var dst = "\"$(OutDir)\\" + libname + "\"";
+                    var cmd = "if exist " + src + " (\r\n" +
+                              "del " + dst + "\r\n" +
+                              "copy /Y " + src + " " + dst + "\r\n" +
+                              ")";
+                    if (0 == command.length)
+                        command = cmd;
+                    else
+                        command += "\r\n" + cmd;
+                }
+    
+                if (null == projectDef.PostBuildCmd || "" == projectDef.PostBuildCmd)
+                    projectDef.PostBuildCmd = command;
                 else
-                    command += "\r\n" + cmd;
+                    projectDef.PostBuildCmd = command + "\r\n" + projectDef.PostBuildCmd;
             }
-
-            if (null == projectDef.PostBuildCmd || "" == projectDef.PostBuildCmd)
-                projectDef.PostBuildCmd = command;
-            else
-                projectDef.PostBuildCmd = command + "\r\n" + projectDef.PostBuildCmd;
         }
     }
 
@@ -439,13 +475,18 @@
 {
     for (var i = 0; i < projectDefs.length; ++i)
     {
-        var projectDef = projectDefs[i];
+        var projectArray = projectDefs[i];
 
-        // turn on RTTI support if project in RTTIProjects array
-        if (0 <= arrayIndexOf(RTTIProjects, projectDef.Name))
-            projectDef.RTTI = true;
-
-        projectDef.createVCProject(VCProjectEngine, report);
+        for (var j = 0; j < projectArray.length; ++j)
+        {
+            var projectDef = projectArray[j];
+    
+            // turn on RTTI support if project in RTTIProjects array
+            if (0 <= arrayIndexOf(RTTIProjects, projectDef.Name))
+                projectDef.RTTI = true;
+    
+            projectDef.createVCProject(VCProjectEngine, report);
+        }
     }
 }
 
@@ -456,39 +497,45 @@
 {
     for (var i = 0; i < projectDefs.length; ++i)
     {
-        var projectDef = projectDefs[i];
-        var VCProject = projectDef.VSProject;
+        var projectArray = projectDefs[i];
 
-        var prjrefs = projectDef.PrjRefs;
-        if (0 == prjrefs.length)
-            continue;
-
-        var file = fso.OpenTextFile(VCProject.ProjectFile, 1, false);
-        var text = file.ReadAll();
-        file.Close();
-        var refs = "";
-        for (var j = 0; j < prjrefs.length; ++j)
-        {
-            refs += "\t\t<ProjectReference\n";
-            refs += "\t\t\tReferencedProjectIdentifier=\"" +
-                    prjrefs[j].VSProject.ProjectGUID + "\"\n";
-            refs += "\t\t/>\n";
-        }
-        var pos = text.indexOf("\t</References>");
-        if (0 > pos)
+        for (var j = 0; j < projectArray.length; ++j)
         {
-            var str = "\t</Configurations>";
-            pos = text.indexOf(str);
-            if (0 <= pos)
+            var projectDef = projectArray[j];
+
+            var VCProject = projectDef.VSProject;
+    
+            var prjrefs = projectDef.PrjRefs;
+            if (0 == prjrefs.length)
+                continue;
+    
+            var file = fso.OpenTextFile(VCProject.ProjectFile, 1, false);
+            var text = file.ReadAll();
+            file.Close();
+            var refs = "";
+            for (var k = 0; k < prjrefs.length; ++k)
+            {
+                refs += "\t\t<ProjectReference\n";
+                refs += "\t\t\tReferencedProjectIdentifier=\"" +
+                        prjrefs[k].VSProject.ProjectGUID + "\"\n";
+                refs += "\t\t/>\n";
+            }
+            var pos = text.indexOf("\t</References>");
+            if (0 > pos)
             {
-                refs = "\n\t<References>\n" + refs + "\t</References>";
-                pos += str.length;
+                var str = "\t</Configurations>";
+                pos = text.indexOf(str);
+                if (0 <= pos)
+                {
+                    refs = "\n\t<References>\n" + refs + "\t</References>";
+                    pos += str.length;
+                }
             }
+            text = text.substr(0, pos) + refs + text.substr(pos);
+            text.replace("\t</References>", refs);
+            file = fso.CreateTextFile(VCProject.ProjectFile, true, false);
+            file.Write(text);
+            file.Close();
         }
-        text = text.substr(0, pos) + refs + text.substr(pos);
-        text.replace("\t</References>", refs);
-        file = fso.CreateTextFile(VCProject.ProjectFile, true, false);
-        file.Write(text);
-        file.Close();
     }
 }

Modified: incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf (original)
+++ incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf Thu Jan 11 09:53:05 2007
@@ -37,9 +37,10 @@
             <example>cscript run_locale_utils.wsf /s /b:..\..\..\bin\11s"
             </example>
             <usage>
-Usage: cscript run_locale_utils.wsf [/d] [/s] [/f [/i:@NlsDir /l:@LocaleName]] [/b:@BinDir] [/O:@Out],
+Usage: cscript run_locale_utils.wsf [/d] [/n] [/s] [/f [/i:@NlsDir /l:@LocaleName]] [/b:@BinDir] [/O:@Out],
 where
 - "/d" debug;
+- "/n" no cleanup;
 - "/s" tests location, output;
 - "/f" tests functionality; is followed by:
     - "/i:@NlsDir>"
@@ -63,10 +64,14 @@
 var locale_db  = "";
 var bindir     = "";
 var outstrm    = WScript.StdOut;
+var no_clean   = false;
 
 var locale     = "locale.exe";
 var localedef  = "localedef.exe";
 
+var TemporaryFolder = 2;
+var tmpdir = fso.GetSpecialFolder(TemporaryFolder) + "\\" + fso.GetTempName();
+
 // assertions
 var assertions       = 0;
 var failedassertions = 0;
@@ -109,6 +114,18 @@
     return exec;
 }
 
+function Cleanup()
+{
+    if (!no_clean && fso.FolderExists(tmpdir))
+        fso.DeleteFolder(tmpdir, true);
+}
+
+function Exit(code)
+{
+    Cleanup();
+    WScript.Quit(code);
+}
+
 // convert number num to string with specified width
 function FormatNumber(num, width)
 {
@@ -119,6 +136,33 @@
     return s;
 }
 
+// create folder with intermediate folders, if needed
+function CreateFolder(path)
+{
+    var res = true;
+
+    if (!fso.FolderExists(path))
+    {
+        var parent = fso.GetParentFolderName(path);
+        if (0 == parent.length)
+            return false;
+        res = CreateFolder(parent);
+        if (res)
+        {
+            try
+            {
+                fso.CreateFolder(path);
+            }
+            catch (e)
+            {
+                res = false;
+            }
+        }
+    }
+
+    return res;
+}
+
 var description = new run_locale_utils; // run
 
 //////////////////////////////////////////////////////////////////////////////
@@ -303,19 +347,19 @@
     if (charmap == "")
     {
         outstrm.WriteLine(err + "character maps file not specified.");
-        WScript.Quit(1);
+        Exit(1);
     }
 
     if (src == "")
     {
         outstrm.WriteLine(err  + "source input file not specified.");
-        WScript.Quit(1);
+        Exit(1);
     }
 
     if (locname == "")
     {
         outstrm.WriteLine(err + "output locale name not specified.");
-        WScript.Quit(1);
+        Exit(1);
     }
 
     ++assertions;
@@ -325,37 +369,86 @@
             + " -i " + src + " " + locname;
     DebugOutLine(cmd);
 
-    var retcode = Run(cmd).ExitCode;
+    var exec = Run(cmd);
+    DebugOut(run_stdout);
+
+    var retcode = exec.ExitCode;
     if (retcode)
     {
-        outstrm.WriteLine("Error - localedef returned code: " + retcode);
-        ++failedassertions;
+        // exit with the same status as the tool
+        Exit(retcode);
+    }
+}
+
+//
+//
+//
+function dump_charmap(locname, outfile)
+{
+    err="Cannot create characater set description file - "
+
+    // locname: LC_ALL value
+    // outfile: output file name
+
+    if (outfile == "")
+    {
+        outstrm.WriteLine(err + " - no output file specified.");
+        Exit(1);
+    }
+
+    ++assertions;
+
+    // dumping charmap
+    var cmd = locale + " --charmap -l";
+    DebugOutLine("LC_ALL=" + locname + " " + cmd + " > " + outfile);
+
+    WEnv("LC_ALL") = locname;
+    var exec = Run(cmd);
+
+    DebugOut(run_stderr);
+
+    var dmpfile = fso.CreateTextFile(outfile, true);
+    if (dmpfile)
+    {
+        dmpfile.Write(run_stdout);
+        dmpfile.Close();
+    }
+
+    var retcode = exec.ExitCode;
+    if (retcode)
+    {
+        // exit with the same status as the tool
+        Exit(retcode);
     }
 }
 
 //
 // Dumps one locale database
 //
-function dump_locale(dumpfile)
+function dump_locale(locname, dumpfile)
 {
     var err = "Cannot dump locale database - ";
 
-    // dumpfile - current locale dump file
+    // locname:  LC_ALL value
+    // dumpfile: current locale dump file
 
     if (dumpfile == "")
     {
         outstrm.WriteLine(err + " - no output file specified.");
-        WScript.Quit(1);
+        Exit(1);
     }
 
     ++assertions;
 
     // Dumping locale database
-    var cmd = locale + " -ck -h LC_ALL > " + dumpfile;
-    DebugOutLine(cmd);
+    var cmd = locale + " -ck -h -l LC_ALL";
+    DebugOutLine("LC_ALL=" + locname + " " + cmd + " > " + dumpfile);
 
+    WEnv("LC_ALL") = locname;
     var exec = Run(cmd);
 
+    DebugOut(run_stderr);
+
     var dmpfile = fso.CreateTextFile(dumpfile, true);
     if (dmpfile)
     {
@@ -366,127 +459,179 @@
     var retcode = exec.ExitCode;
     if (retcode)
     {
-        outstrm.WriteLine("Error - locale returned code: " + retcode);
-        ++failedassertions;
+        // exit with the same status as the tool
+        Exit(retcode);
     }
 }
 
 //
 // Test one locale
 //
-function test_locale(nlsdir, testdir, locname)
+function test_locale(nlsdir, tmpdir, fname)
 {
     var err = "Cannot test locale - ";
 
-    // nlsdir  - nlsdir
-    // testdir - test directory
+    // nlsdir  - nls subdirectory of the source directory tree
+    // tmpdir  - the test (sandbox) directory
     // locname - name of the locale database
     
     if (nlsdir == "")
     {
         outstrm.WriteLine(err+ " - nls directory not specified.");
-        WScript.Quit(1);
+        Exit(1);
     }
 
-    if (testdir == "")
+    if (tmpdir == "")
     {
-        outstrm.WriteLine(err + " - test directory not specified.");
-        WScript.Quit(1);
+        outstrm.WriteLine(err + " - temporary directory not specified.");
+        Exit(1);
     }
 
-    if (locname == "")
+    if (fname == "")
     {
         outstrm.WriteLine(err+ " - locale database name not specified.");
-        WScript.Quit(1);
+        Exit(1);
     }
 
     // get locale's name and encoding
-    var locale_src = locname.replace(
-            new RegExp("\([^.]*\)\.\([^>@]*\)\(.*\)"), "$1$3")
-        .replace("@", ".");
-
-    var locale_encoding = locname.replace(
-            new RegExp("\([^.]*\)\.\([^>@]*\)\(.*\)"), "$2")
-        .replace("@", ".");
-
-    DebugOutLine("locale_src = " + locale_src);
-    DebugOutLine("locale_encoding = " + locale_encoding);
-
-    var charmap = nlsdir + "\\charmaps\\" + locale_encoding;
-    var src = nlsdir + "\\src\\" + locale_src;
-    var locdir = testdir + "\\" + locname;
+    var rx = new RegExp("\([^.]*\)\.\([^@]*\)\(.*\)");
+    var source = fname.replace(rx, "$1$3").replace("@", ".");
+    var charmap = fname.replace(rx, "$2");
+
+    var src_path = nlsdir + "\\src\\" + source;
+    var cm_path = nlsdir + "\\charmaps\\" + charmap;
+
+    var stage_1 = tmpdir + "\\stage.1";
+    var stage_2 = tmpdir + "\\stage.2";
+    var stage_3 = tmpdir + "\\stage.3";
+
+    source += ".src";
+
+    // point locale at the original source directory
+    DebugOutLine("RWSTD_SRC_ROOT=" + nlsdir);
+    WEnv("RWSTD_SRC_ROOT") = nlsdir;
+
+    // create a directory for stage 1 charmap source files
+    var cm_dir1 = stage_1 + "\\charmaps";
+    DebugOutLine("mkdir " + cm_dir1);
+    CreateFolder(cm_dir1);
 
-    // generate the first locale database
-    generate_locale(charmap, src, locdir);
+    ++assertions;
 
-    // set necessary environment variables
-    DebugOutLine("LC_ALL=" + locname);
-    WEnv("LC_ALL") = locname;
-    DebugOutLine("LANG=" + locname);
-    WEnv("LANG") = locname;
+    var locname1 = stage_1 + "\\" + fname;
+    var cm_path1 = cm_dir1 + "\\" + charmap;
+    var src_path1 = stage_1 + "\\" + source;
 
-    // adjust the locale root
-    DebugOutLine("RWSTD_LOCALE_ROOT=" + testdir);
-    WEnv("RWSTD_LOCALE_ROOT") = testdir;
-
-    var test1 = testdir + "\\out.1";
-
-    // dump the locale database content to temporary location
-    dump_locale(test1);
-    DebugOutLine("");
-
-    // remove stage one database
-    if (fso.FolderExists(locdir))
-        fso.DeleteFolder(locdir, true);
-    
-    // generate stage two database
-    generate_locale(charmap, test1, locdir);
+    // generate stage 1 locale database from the orignal sources
+    generate_locale(cm_path, src_path, locname1);
 
-    var test2 = testdir + "\\out.2";
+    ++assertions;
 
-    // dump stage two database to file
-    dump_locale(test2);
+    // dump the charmap and the locale data from the database
+    // to a pair of charmap and locale source files
+    dump_charmap(locname1, cm_path1);
+    dump_locale(locname1, src_path1);
+
+    // create a directory for stage 2 charmap source files
+    var cm_dir2 = stage_2 + "\\charmaps";
+    DebugOutLine("mkdir " + cm_dir2);
+    CreateFolder(cm_dir2);
 
-    // remove stage two database
-    if (fso.FolderExists(locdir))
-        fso.DeleteFolder(locdir, true);
+    ++assertions;
 
-    // generate stage three database
-    generate_locale(charmap, test2, locdir);
+    var locname2 = stage_2 + "\\" + fname;
+    var cm_path2 = cm_dir2 + "\\" + charmap;
+    var src_path2 = stage_2 + "\\" + source;
+
+    // generate stage 2 locale database from the charmap and locale
+    // source files produced by locale from the stage 1 database
+    generate_locale(cm_path1, src_path1, locname2);
+
+    // point locale at the stage 1 directory
+    DebugOutLine("RWSTD_SRC_ROOT=" + stage_1);
+    WEnv("RWSTD_SRC_ROOT") = stage_1;
 
-    var test3 = testdir + "\\out.3";
+    ++assertions;
 
-    // and finally dump it to file
-    dump_locale(test3);
+    // dump the charmap and the locale data from the database
+    //to a pair of charmap and locale source files
+    dump_charmap(locname2, cm_path2);
+    dump_locale(locname2, src_path2);
 
     ++assertions;
 
-    // compare
+    // create a directory for stage 2 charmap source files
+    var cm_dir3 = stage_3 + "\\charmaps";
+    DebugOutLine("mkdir " + cm_dir3);
+    CreateFolder(cm_dir3);
+
+    ++assertions;
 
-    var params = test2 +" " + test3;
-    var cmd = "fc.exe " + params;
+    var locname3 = stage_3 + "\\" + fname;
+    var cm_path3 = cm_dir3 + "\\" + charmap;
+    var src_path3 = stage_3 + "\\" + source;
+
+    // generate stage 3 locale database from the charmap and locale
+    // source files produced by locale from the stage 2 database
+    generate_locale(cm_path2, src_path2, locname3);
+
+    // point locale at the stage 2 directory
+    DebugOutLine("RWSTD_SRC_ROOT=" + stage_2);
+    WEnv("RWSTD_SRC_ROOT") = stage_2;
+
+    ++assertions;
+
+    // dump the charmap and the locale data from the database
+    // to a pair of charmap and locale source files
+    dump_charmap(locname3, cm_path3);
+    dump_locale(locname3, src_path3);
+
+    ++assertions;
+
+    // verify that stage 1 and stage 2 charmaps are the same
+    var cmd = "fc " + cm_path1 + " " + cm_path2;
+    DebugOutLine(cmd);
+    var retcode = Run(cmd).ExitCode;
+    if (retcode)
+    {
+        DebugOutLine("## AssertionFailed: " + cm_path1 +
+                     " and " + cm_path2 + " differ.");
+        ++failedassertions;
+    }
+
+    // verify that stage 2 and stage 3 charmaps are the same
+    var cmd = "fc " + cm_path2 + " " + cm_path3;
+    DebugOutLine(cmd);
+    var retcode = Run(cmd).ExitCode;
+    if (retcode)
+    {
+        DebugOutLine("## AssertionFailed: " + cm_path2 +
+                     " and " + cm_path3 + " differ.");
+        ++failedassertions;
+    }
+
+    // verify that stage 2 and stage 3 locale sources are the same
+    var cmd = "fc " + src_path2 + " " + src_path3;
+    DebugOutLine(cmd);
     var retcode = Run(cmd).ExitCode;
     if (retcode)
     {
-        DebugOutLine("ERROR: " + params +" differ.");
+        DebugOutLine("## AssertionFailed: " + src_path2 +
+                     " and " + src_path3 + " differ.");
         ++failedassertions;
     }
 
-    // and remove database
-    if (fso.FolderExists(locdir))
-        fso.DeleteFolder(locdir);
-
-    // remove dump files
-    if (fso.FileExists(test1))
-        fso.DeleteFile(test1);
-    if (fso.FileExists(test2))
-        fso.DeleteFile(test2);
-    if (fso.FileExists(test3))
-        fso.DeleteFile(test3);
-
-    // and finally remove the tmp directory
-    if (fso.FolderExists(testdir))
-        fso.DeleteFolder(testdir);
+    if (!no_clean)
+    {
+        // clean up
+        DebugOutLine("rm -rf " + stage_1 + " " + stage_2 + " " + stage_3);
+        if (fso.FolderExists(stage_1))
+            fso.DeleteFolder(stage_1, true);
+        if (fso.FolderExists(stage_2))
+            fso.DeleteFolder(stage_2, true);
+        if (fso.FolderExists(stage_3))
+            fso.DeleteFolder(stage_3, true);
+    }
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -510,6 +655,9 @@
     if (WScript.Arguments.Named.Exists("l"))
         locale_db = WScript.Arguments.Named("l");
 
+    if (WScript.Arguments.Named.Exists("n"))
+        no_clean = true;
+
     if (WScript.Arguments.Named.Exists("b"))
     {
         bindir = WScript.Arguments.Named("b");
@@ -540,29 +688,17 @@
     }
     else if (chk_func)
     {
-        // set the temp dir
-        var TemporaryFolder = 2;
-        var tmpdir = fso.GetSpecialFolder(TemporaryFolder)
-                     + "\\" + fso.GetTempName();
-
-        if (!fso.CreateFolder(tmpdir))
+        // create the temp dir
+        if (!CreateFolder(tmpdir))
         {
-            WScript.StdErr.WriteLine("Unable to create " + tmpdir
-                                     + ", aborting");
+            WScript.StdErr.WriteLine("Unable to create " + tmpdir + ", aborting");
             WScript.Quit(1);
         }
     
-        // checking locale functionality
-        DebugOutLine("RWSTD_SRC_ROOT=" + nlsdir);
-        WEnv("RWSTD_SRC_ROOT") = nlsdir;
-        DebugOutLine("RWSTD_LOCALE_ROOT=" + tmpdir);
-        WEnv("RWSTD_LOCALE_ROOT") = tmpdir;
-        
         // test only one locale
         test_locale(nlsdir, tmpdir, locale_db);
 
-        if (fso.FolderExists(tmpdir))
-            fso.DeleteFolder(tmpdir, true);
+        Cleanup();
     }
     else
     {
@@ -586,8 +722,6 @@
     outstrm.WriteLine("## Assertions = " + assertions);
     outstrm.WriteLine("## FailedAssertions = " + failedassertions);
     outstrm.WriteLine();
-
-    WScript.Quit(failedassertions);
 }
 
 ]]>

Modified: incubator/stdcxx/trunk/etc/config/windows/runall.wsf
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/runall.wsf?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/runall.wsf (original)
+++ incubator/stdcxx/trunk/etc/config/windows/runall.wsf Thu Jan 11 09:53:05 2007
@@ -27,16 +27,14 @@
             <named helpstring="The root directory with executables" 
                 name="EXEDIR" required="true" type="string"/>
             <named helpstring="The root directory with .in and .out files" 
-                name="INOUTDIR" required="true" type="string"/>
+                name="INOUTDIR" required="false" type="string"/>
             <named helpstring="The build type" name="BUILDTYPE" 
                 required="true" type="string"/>
             <named helpstring="The configuration" name="CONFIG" 
                 required="true" type="string"/>
             <named helpstring="The log file" name="LOGFILE" 
                 required="false" type="string"/>
-            <named helpstring="The copy lib dll to exe option" name="COPYDLL" 
-                required="false" type="string"/>
-            <named helpstring="The copy lib dll to exe option" name="COPYRWTESTDLL" 
+            <named helpstring="The copy stdlibxx.dll to exe option" name="COPYDLL" 
                 required="false" type="string"/>
             <named helpstring="The lib dll folder" name="LIBDIR" 
                 required="false" type="string"/>
@@ -45,10 +43,9 @@
             /INOUTDIR:"C:\stdcxx\build" /BUILDTYPE:11d /CONFIG:msvc-7.1
             </example>
             <usage>
-Usage: cscript runexamples.wsf /EXEDIR:@EXEDIR /INOUTDIR:@INOUTDIR 
+Usage: cscript runexamples.wsf /EXEDIR:@EXEDIR [/INOUTDIR:@INOUTDIR] 
 /BUILDTYPE:@BUILDTYPE /CONFIG:@CONFIG
 [/LOGFILE:@LOGFILE] [/COPYDLL:@COPYDLL] [/LIBDIR:@LIBDIR]
-[/COPYRWTESTDLL:@COPYRWTESTDLL]
 where
 @EXEDIR is the root directory with executables ro be run and checked,
 @TOPDIR is the root directory with .in and .out files 
@@ -56,9 +53,8 @@
 @BUILDTYPE is the build type (11d, 11s, etc).
 @CONFIG is the compiler configuration (msvc-7.1, icc-9.0, etc).
 @LOGFILE is the log file name.
-@COPYDLL is the option for copy dll to executables
+@COPYDLL is the option for copy stdlibxx.dll to executables
 @LIBDIR is the library dll folder (specify when COPYDLL is true)
-@COPYRWTESTDLL is the option for copy rwtest.dll to executables
             </usage>
         </runtime>
         <object id="fso" progid="Scripting.FileSystemObject"/>
@@ -66,7 +62,7 @@
         <script language="JScript" src="config.js"/>
         <script language="JScript" src="utilities.js"/>
         <script language="JScript" src="summary.js"/>
-        <script id="exrunner" language="JScript">
+        <script id="runexamples" language="JScript">
 <![CDATA[
 //
 // Examples running script for stdcxx library
@@ -80,10 +76,8 @@
 var logFileName = ""; // the log file name
 var logFileDefault = "runexamples.log"; // the default log file name
 var copyDll = false;
-var copyRwtestDll = false;
 var libdllFolder = "";
 
-var varIn = "in";
 var varOut = "out";
 
 var exRun = 0;
@@ -151,14 +145,6 @@
         WScript.Quit(2);
     }
     
-    if (!WScript.Arguments.Named.Exists("INOUTDIR"))
-    {
-        WScript.StdErr.WriteLine(
-            "Generate: Missing required argument INOUTDIR.");
-        WScript.Arguments.ShowUsage();
-        WScript.Quit(2);
-    }
-    
     if (!WScript.Arguments.Named.Exists("BUILDTYPE"))
     {
         WScript.StdErr.WriteLine(
@@ -168,9 +154,11 @@
     }
     
     examplesDir =  WScript.Arguments.Named("EXEDIR");
-    inoutDir =  WScript.Arguments.Named("INOUTDIR");
     buildType = WScript.Arguments.Named("BUILDTYPE");
 
+    if (WScript.Arguments.Named.Exists("INOUTDIR"))
+        inoutDir =  WScript.Arguments.Named("INOUTDIR");
+
     utlExec = examplesDir + "\\..\\bin\\" + utlExec;
     
     if (WScript.Arguments.Named.Exists("CONFIG"))
@@ -188,13 +176,6 @@
             copyDll = true;
     }
     
-    if (WScript.Arguments.Named.Exists("COPYRWTESTDLL"))
-    {
-        var copyOption = WScript.Arguments.Named("COPYRWTESTDLL");
-        if ("true" == copyOption)
-            copyRwtestDll = true;
-    }
-    
     if (WScript.Arguments.Named.Exists("LIBDIR"))
         libdllFolder = WScript.Arguments.Named("LIBDIR");
     
@@ -206,7 +187,7 @@
         WScript.Quit(3);
     }
     
-    if (! fso.FolderExists(inoutDir))
+    if (0 < inoutDir.length && !fso.FolderExists(inoutDir))
     {
         WScript.StdErr.WriteLine(
             "Generate: Could not find directory " + inoutDir);
@@ -225,20 +206,14 @@
     var exeFolder = fso.GetFolder(exeDir);
     if (! exeFolder)
         return;
-        
-    var enumExeSubFolders = new Enumerator(exeFolder.SubFolders);
-    for (; !enumExeSubFolders.atEnd(); enumExeSubFolders.moveNext())
-    {
-        var exeFolderName = enumExeSubFolders.item().Name;
-        
-        var newSrc = srcDir + "\\" + exeFolderName;
-            
-        runAllExamples(exeDir + "\\" + exeFolderName, 
-            newSrc, fileLog, fileSummary);
-    }
     
-    var dllCopied = false;
-    var rwtdllCopied = false;
+    var htmDir = exeDir + "\\" + htmFolderName;
+    if (! fso.FolderExists(htmDir))
+        fso.CreateFolder(htmDir);
+
+    var exeFiles = new Array();
+    var arrInfo = new Array();
+    
     var rx = new RegExp("^.+\\.(?:exe)$", "i");
     var enumExeFiles = new Enumerator(exeFolder.Files);
     for (; !enumExeFiles.atEnd(); enumExeFiles.moveNext())
@@ -247,146 +222,121 @@
         if (! rx.test(exeFileName))
             continue;
             
-        // temporary copy the dll to the executable
-        if (copyDll && !dllCopied)
-        {
-            var dllName = libFileName + buildType + ".dll";
-            var copyDllCmd = "cmd /c \"copy /Y " + libdllFolder + "\\" + dllName +
-                             " " + exeDir + "\\" + dllName + "\"";
-                             
-            WshShell.Run(copyDllCmd, 7, true);
-            dllCopied = true;
-        }
-         
-        // temporary copy the rwtest.dll to the executable
-        if (copyRwtestDll && !rwtdllCopied)
-        {
-            var rwtdllName = "rwtest.dll";
-            var copyDllCmd = "cmd /c \"copy /Y " + examplesDir + "\\" + rwtdllName +
-                             " " + exeDir + "\\" + rwtdllName + "\"";
-                             
-            WshShell.Run(copyDllCmd, 7, true);
-            rwtdllCopied = true;
-        }
-         
-        var htmDir = exeDir + "\\" + htmFolderName;
-        if (! fso.FolderExists(htmDir))
-            fso.CreateFolder(htmDir);
-            
         var itemInfo = 
             new ItemBuildInfo(getPureFileName(exeFileName, "exe"));
-            
-        var inData = readInFile(srcDir, exeFileName);
-                
-        var outData = readOutFile(srcDir, exeFileName);
-            
-        // run example
-        var runCmd = exeDir + "\\" + exeFileName;
-        WScript.Echo("running " + exeFileName);
-        fileLog.WriteLine("running " + exeFileName);
+        readBuildLog(exeDir, itemInfo, unicodeLog);
 
-        exRun++;
+        itemInfo.runReqOutput = readOutFile(srcDir, exeFileName);
+
+        exeFiles.push(exeFileName);
+        arrInfo.push(itemInfo);
         
-        if (inData != "" || outData != "")
-            runWithChecks(runCmd, exeFileName, itemInfo, outData, fileLog);
-        else
-            runNoChecks(runCmd, exeFileName, itemInfo, fileLog); 
-            
-        readBuildLog(exeDir, itemInfo, unicodeLog);
-        saveBuildInfo(itemInfo, htmDir, "htm"); 
-        saveBuildSummary(itemInfo, fileSummary);
+        ++exRun;
+    }
+    
+    // temporary copy the dll to the executable
+    if (copyDll)
+    {
+        var dllName = libFileName + buildType + ".dll";
+        var copyDllCmd = "cmd /c \"copy /Y " + libdllFolder + "\\" + dllName +
+                         " " + exeDir + "\\" + dllName + "\"";
+                            
+        WshShell.Run(copyDllCmd, 7, true);
+    }
+
+    var runCmd = "\"" + utlExec + "\" -t " + runTimeout;
+    
+    if (0 < srcDir.length)
+        runCmd += " -d \"" + srcDir + "\"";
+        
+    runCmd += " " + exeFiles.join(" ");
+    
+    var prevDir = WshShell.CurrentDirectory;
+    WshShell.CurrentDirectory = exeDir;
+    var oExec = WshShell.Exec(runCmd);
+    WshShell.CurrentDirectory = prevDir;
+    
+    if (!oExec)
+    {
+        // WScript.Echo(itemInfo.name + " failed to run");
+        return;
+    }
+
+    var execOut = "";
+    while (oExec.Status == 0)
+    {
+        execOut += oExec.StdOut.ReadAll();
+        WScript.Sleep(500);
     }
     
+    WScript.Echo(execOut);
+    
     // delete the dll if it was copied
-    if (copyDll && dllCopied)
+    if (copyDll)
     {
         try
         {
             fso.DeleteFile(exeFolder.Path + "\\" + dllName);
         }
-        catch(e)  // do nothing
+        catch(e)
         {
             fileLog.WriteLine("error: could not delete temporary file" + 
                 exeFolder.Path + "\\" + dllName);
         }
     }
 
-    // delete the rwtest.dll if it was copied
-    if (copyRwtestDll && rwtdllCopied)
+    for (var i = 0; i < arrInfo.length; ++i)
     {
+        var itemInfo = arrInfo[i];
+        
+        var outFileName = exeDir + "\\" + itemInfo.name + ".out";
+
         try
-        {
-            fso.DeleteFile(exeFolder.Path + "\\" + rwtdllName);
+        {   
+            var outFile = fso.OpenTextFile(outFileName, 1);
+            if (!outFile.AtEndOfStream)
+                itemInfo.runOutput = outFile.ReadAll();
+                
+            outFile.Close();
+            fso.DeleteFile(outFileName);
         }
-        catch(e)  // do nothing
+        catch(e)
         {
-            fileLog.WriteLine("error: could not delete temporary file" + 
-                exeFolder.Path + "\\" + rwtdllName);
+            WScript.Echo("Could not delete temporary file " + outFileName);
         }
-    }
-}
-
-// run command without comparing the command output with expected output
-// cmd - full path to the running executable
-// exeFileName - filename of the running executable
-// itemInfo - ItemBuildInfo object to hold the information
-// fileLog - log filename
-function runNoChecks(cmd, exeFileName, itemInfo, fileLog)
-{
-    var runCmd = utlExec + " -t " + runTimeout + " \"" + cmd + " < NUL:\"";
-    
-    var oExec = WshShell.Exec(runCmd);
-    if (!oExec)
-    {
-        WScript.Echo(itemInfo.name + " failed to run");
-        return;
-    }
-
-    while (oExec.Status == 0)
-        WScript.Sleep(500);
-
-    itemInfo.exitCode = oExec.ExitCode;
         
-    itemInfo.runDiff = "";
-    itemInfo.runOutput = "";
-    
-    var outFileName = cmd.replace(".exe", ".out");
+        itemInfo.exitCode = parseStatus(itemInfo.name + ".exe", execOut);
+        switch (itemInfo.exitCode)
+        {
+        case 0:  // OK
+            ++exRunSucceeded;
+            fileLog.WriteLine(itemInfo.name + " completed successfully, exit code " +
+                itemInfo.exitCode);
+            break;
+        case -1: // KILLED
+            ++exRunTimedOut;
+            fileLog.WriteLine(itemInfo.name + " timed out");
+            break;
+        case -2: // DIFF
+            fileLog.WriteLine(itemInfo.name + " completed successfully, " +
+                "but output differs from the expected");
+            getDifferencesInfo(itemInfo);
+            ++exRunFailed;
+            break;
+        case -3: // SEGV
+        case -4: // other
+            ++exRunFailed;
+            fileLog.WriteLine(itemInfo.name + " failed");
+            break;
+        default:
+            ++exBadCode;
+            fileLog.WriteLine(itemInfo.name + " completed successfully, exit code " +
+                itemInfo.exitCode);
+        }
 
-    try
-    {   
-        var outFile = fso.OpenTextFile(outFileName, 1);
-        
-        var exeOutput = "";
-        if (!outFile.AtEndOfStream)
-          exeOutput = outFile.ReadAll();
-            
-        itemInfo.runOutput = exeOutput;
-        
-        outFile.Close();
-        fso.DeleteFile(outFileName);
-    }
-    catch(e)
-    {
-        WScript.Echo("Could not delete temporary file " + outFileName);
+        saveBuildInfo(itemInfo, htmDir, "htm"); 
+        saveBuildSummary(itemInfo, fileSummary);
     }
-
-    var Status = oExec.StdOut.ReadAll();
-    WScript.Echo(Status);
-
-    if (itemInfo.exitCode == 0)
-        itemInfo.exitCode = parseStatus(exeFileName, Status);
-
-    if (itemInfo.exitCode != 0)
-        exBadCode++;
-  
-    exRunSucceeded++;
-  
-    WScript.Echo("example succeeded! Exit code " + itemInfo.exitCode);
-    fileLog.WriteLine(itemInfo.name + " completed successfully, exit code "
-        + itemInfo.exitCode);
-   
-    WScript.Echo("   ");
-    fileLog.WriteLine(" ");
 }
 
 // parse the exec utility output to get status of the running executable 
@@ -399,103 +349,31 @@
     var pos = execOut.indexOf(exeName);
     if (0 <= pos)
     {
-        var status = execOut.substr(pos + 26, 6);
+        pos += 26;
+        var status = execOut.substring(pos, execOut.indexOf(" ", pos + 6));
         res = parseInt(status);
         if (isNaN(res))
         {
             switch (status)
             {
             case "KILLED":
-                ++exRunTimedOut;
+                res = -1;
+                break;
+            case "  DIFF":
+                res = -2;
                 break;
+            case "  SEGV":
+                res = -3;
+                break;
+            default:
+                res = -4;
             }
-            res = 0;
         }
     }
 
     return res;
 }
 
-// run command and compare the command output with expected output
-// cmd - full path to the running executable
-// exeFileName - filename of the running executable
-// itemInfo - ItemBuildInfo object to hold the information
-// outData - the expected output of the command
-// fileLog - log filename
-function runWithChecks(cmd, exeFileName, itemInfo, outData, fileLog)
-{
-    var runCmd = utlExec + " -t " + runTimeout + " -d " + inoutDir +
-                 " \"" + cmd + "\"";
-
-    var oExec = WshShell.Exec(runCmd);
-    if (!oExec)
-    {
-        WScript.Echo(itemInfo.name + " failed to run");
-        return;
-    }
-            
-    while (oExec.Status == 0)
-        WScript.Sleep(500);
-
-    var outFileName = cmd.replace(".exe", ".out");
-
-    try
-    {   
-        var outFile = fso.OpenTextFile(outFileName, 1);
-        
-        var exeOutput = "";
-        if (!outFile.AtEndOfStream)
-          exeOutput = outFile.ReadAll();
-            
-        itemInfo.runOutput = exeOutput;
-        
-        outFile.Close();
-        fso.DeleteFile(outFileName);
-    }
-    catch(e)
-    {
-        WScript.Echo("Could not delete temporary file " + outFileName);
-    }
-
-    var Status = oExec.StdOut.ReadAll();
-    WScript.Echo(Status);
-
-    itemInfo.runOutput = exeOutput;
-    itemInfo.exitCode = oExec.ExitCode;
-    itemInfo.runReqOutput = outData;
-  
-    if (itemInfo.exitCode == 0)
-        itemInfo.exitCode = parseStatus(exeFileName, Status);
-
-    if (itemInfo.exitCode != 0)
-        exBadCode++;
-
-    if (exeOutput == outData)
-    {
-        itemInfo.runDiff = "";
-    
-        exRunSucceeded++;
-        WScript.Echo("example succeeded! Exit code " + oExec.ExitCode);
-        fileLog.WriteLine(itemInfo.name + 
-            " completed successfully, exit code " +
-            itemInfo.exitCode);
-    }
-    else
-    {
-        WScript.Echo("example output differs from the expected");
-        getDifferencesInfo(itemInfo);
-    
-        exRunFailed++;
-        WScript.Echo("example failed! Exit code " + oExec.ExitCode);
-        fileLog.WriteLine(itemInfo.name + 
-            " completed with errors, exit code " +
-            itemInfo.exitCode);
-    }
-    
-    WScript.Echo("   ");
-    fileLog.WriteLine(" ");
-}
-
 // returns the content of the .in or .out file for the specified executable
 // srcDir - folder containing subfolders with .in and .out files
 // exeFileName - filename of the executable
@@ -522,20 +400,25 @@
     return (someFile.ReadAll());
 }
 
-// returns the content of the .in file for the specified executable
-// srcDir - folder containing .in files
-// exeFileName - filename of the executable
-function readInFile(srcDir, exeFileName)
-{
-    return readAllFromFile(srcDir, exeFileName, varIn);
-}
-
 // returns the content of the .out file for the specified executable
 // srcDir - folder containing .out files
 // exeFileName - filename of the executable
 function readOutFile(srcDir, exeFileName)
 {
     var outData = readAllFromFile(srcDir, exeFileName, varOut);
+    
+    if (0 == outData.length)
+    {
+        outData = readAllFromFile(srcDir + "\\manual", exeFileName, varOut);
+        if (0 < outData.length)
+            srcDir += "\\manual";
+        else
+        {
+            outData = readAllFromFile(srcDir + "\\tutorial", exeFileName, varOut);
+            if (0 < outData.length)
+                srcDir += "\\tutorial";
+        }
+    }
     
     var eolStr = String.fromCharCode(13) + String.fromCharCode(10);
     var idxEOL = outData.indexOf(eolStr);

Modified: incubator/stdcxx/trunk/etc/config/windows/summary.js
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/summary.js?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/summary.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/summary.js Thu Jan 11 09:53:05 2007
@@ -54,9 +54,32 @@
     var blogFilePath = blogDir + "\\" + buildlogFile;
     if (! fso.FileExists(blogFilePath))
         return;
-        
+
     var uniMode = (true == useUnicode) ? -1 : 0;
-    var blogFile = fso.OpenTextFile(blogFilePath, 1, false, uniMode);
+    var blogFile;
+
+    // temporary loop for detect place of the problem:
+    // runall.wsf(59, 6) Microsoft JScript runtime error: Permission denied
+    for (var i = 0; i < 5 && "undefined" == typeof(blogFile); ++i)
+    {
+        try
+        {
+            blogFile = fso.OpenTextFile(blogFilePath, 1, false, uniMode);
+        }
+        catch (e)
+        {
+            // file may be locked, waiting
+            WScript.Echo("File " + blogFilePath + " is locked, waiting for a 1 second");
+            WScript.Sleep(1000);
+        }
+    }
+
+    if ("undefined" == typeof(blogFile))
+    {
+        WScript.Echo("Cannot open file: " + blogFilePath);
+        return;
+    }
+
     var blogData = blogFile.ReadAll();
     
     var posTmp = getCommandLinesInfo(itemInfo, blogData, 0);
@@ -314,8 +337,8 @@
         if (itemInfo.runOutput == "" && itemInfo.exitCode != 0)
             itemInfo.runOutput = "Exited with code " + itemInfo.exitCode;
             
-        saveBuildInfoBlock(outFile, 
-            "Executable Output", itemInfo.runOutput, true);
+        saveBuildInfoBlock(outFile, "Executable Output",
+            encodeHTML(itemInfo.runOutput), true);
     }
     
     if (itemInfo.runDiff != "")

Modified: incubator/stdcxx/trunk/etc/config/windows/utilities.js
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/utilities.js?view=diff&rev=495309&r1=495308&r2=495309
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/utilities.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/utilities.js Thu Jan 11 09:53:05 2007
@@ -284,11 +284,34 @@
     var destS = new Array ( "&amp;", "&lt;", "&gt;", "&quot;" );
     for (var t = 0; t < srcS.length; t++)
     {
-        var reRep = new RegExp(srcS[t], "mg");
+        var reRep = new RegExp(srcS[t], "g");
         res = res.replace(reRep, destS[t]);
     }
     
     return res;
+}
+
+// decode escaped symbols within string with analog
+// srcString - source string
+function decodeHTML(srcString)
+{
+    var res = srcString;
+    var srcS = new Array ( "&amp;", "&lt;", "&gt;", "&quot;", "&nbsp;" );
+    var destS = new Array ( "&", "<", ">", "\"", " " );
+    for (var t = 0; t < srcS.length; t++)
+    {
+        var reRep = new RegExp(srcS[t], "g");
+        res = res.replace(reRep, destS[t]);
+    }
+    
+    return res;
+}
+
+// remove all tags within string
+// srcString - source string
+function stripTags(srcString)
+{
+    return srcString.replace(new RegExp("(<[\\s\\S]+?>)", "g"), "");
 }
 
 // returns source string without first character if it equal to symbol



Mime
View raw message