first commit

This commit is contained in:
Jose Caban
2025-06-07 11:34:38 -04:00
commit 0eb2d7c07d
4708 changed files with 1500614 additions and 0 deletions

View File

@@ -0,0 +1,602 @@
<?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="Top directory of stdcxx sources tree"
name="TOPDIR" required="false" 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
/TOPDIR:@TOPDIR /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.
@TOPDIR is the root of the stdcxx source tree.
@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 srcDir = "";
var buildType = "";
var longConfName = "";
var buildOnly = false;
var outputPane = null;
var winconfigDir = "\\etc\\config\\windows";
var postBuildInvoked;
var rxBuildDir = null;
var rxTopDir = null;
var description = new build; // run
function event_ProjectBuildStarted(Cfg)
{
// clear output window
outputPane.Clear();
if (null != Cfg)
{
// delete old BuildLog.htm
var path = Cfg.Evaluate(Cfg.IntermediateDirectory) + "\\BuildLog.htm";
if (fso.FileExists(path))
fso.DeleteFile(path);
}
}
function getBuildLog(path)
{
var log = "";
try
{
var ForReading = 1;
var format = UNICODELOG ? -1 : 0;
var logStrm = fso.OpenTextFile(path, ForReading, false, format);
log = logStrm.ReadAll();
logStrm.Close();
log = stripTags(log);
var line = "-------";
log = log.replace("Build Log", "").replace("Command Lines", line);
log = log.replace("Output Window", line).replace("Results", line);
}
catch (e)
{
log = "";
}
return log;
}
function removeLogClutter(log)
{
if ("" != slnDir)
{
if (null == rxBuildDir)
{
var buildDir = slnDir.replace(/\\/g, "\\\\");
rxBuildDir = new RegExp("(" + buildDir + ")", "ig");
}
log = log.replace(rxBuildDir, "$(BUILDDIR)");
}
if ("" != srcDir)
{
if (null == rxTopDir)
{
var topDir = srcDir.replace(/\\/g, "\\\\");
rxTopDir = new RegExp("(" + topDir + ")", "ig");
}
log = log.replace(rxTopDir, "$(TOPDIR)");
}
log = log.replace(/^Build log was saved at.*$/gm, "");
return log;
}
function event_ProjectBuildFinished(Cfg, Warnings, Errors, Canceled)
{
postBuildInvoked = true;
var log = "";
var htm = "BuildLog.htm";
if (null != Cfg)
{
try
{
// try get log from BuildLog.htm file
var path = Cfg.Evaluate(Cfg.IntermediateDirectory) + "\\" + htm;
log = getBuildLog(path);
}
catch (e)
{
log = "";
}
}
if (0 == log.length)
{
// try get log from output window
var sel = outputPane.TextDocument.Selection;
sel.SelectAll();
log = sel.Text;
var log2 = "";
var begin = 0;
while (true)
{
// find BuildLog.htm path
var proto = "file://";
begin = log.indexOf(proto, begin);
if (0 > begin)
break;
begin += proto.length;
var end = log.indexOf(htm, begin);
if (0 > end)
break;
var path = log.substring(begin, end + htm.length);
log2 += getBuildLog(path);
}
if (0 < log2.length)
log = log2;
}
WScript.Echo(removeLogClutter(log));
}
function BuildProject(solutionBuild, projectName)
{
var projectFile = "";
var projects = dte.Solution.Projects;
for (var i = 1; i <= projects.Count && 0 == projectFile.length; ++i)
{
var project = projects.Item(i);
if (project.Name == projectName)
projectFile = project.UniqueName;
}
if (0 < projectFile.length)
{
event_ProjectBuildStarted(null);
postBuildInvoked = false;
solutionBuild.BuildProject(longConfName, projectFile, true);
if (!postBuildInvoked)
event_ProjectBuildFinished(null, 0, 0, 0);
return solutionBuild.LastBuildInfo;
}
WScript.Echo("Error: project " + projectName + " not found\n");
return 1;
}
function DiffTime(start, end)
{
var msec = end - start;
var min = Math.floor(msec / 60000);
var sec = Math.floor(msec % 60000 / 1000);
msec %= 1000;
return min + "m" + sec + "." + msec + "s";
}
function TimeEcho(msg, time)
{
WScript.Echo("### real time (" + msg + "):");
WScript.Echo(DiffTime(time, new Date()) + "\n");
}
// 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 + ".sln";
WScript.Echo("Loading solution...");
var solution = dte.Solution;
var retCode = 0;
var prop = null;
var propVal;
var oldLogging = null;
var iSettings = null;
var oldIccIdx = null;
var oldPlatIdx = 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;
// fix 'Call was Rejected By Callee' error
// http://msdn2.microsoft.com/en-us/library/ms228772(vs.80).aspx
var ntimes = 60;
for (var i = 0; i < ntimes; ++i)
{
try
{
projectEngine = solution.Projects.Item(1).Object.VCProjectEngine;
break;
}
catch (e)
{
if (0 > e.description.indexOf("Call was rejected by callee")
|| i == ntimes - 1)
{
WScript.StdErr.WriteLine("Build: " + e.description);
retCode = 7;
break;
}
else
WScript.Sleep(1000);
}
}
if (retCode)
break;
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;
}
if ("" != ICCVER)
{
// select proper Intel C++ compiler
try
{
iSettings = dte.GetObject("IntelOptions");
}
catch (e)
{
WScript.StdErr.WriteLine(
"Build: Intel C++ not installed or installed incorrectly.");
retCode = 1;
break;
}
oldIccIdx = iSettings.CurrentCompilerIndex;
oldPlatIdx = iSettings.CurrentPlatformIndex;
WScript.Echo("Current compiler: " +
iSettings.Compiler(oldIccIdx).Name);
var ICPlatform = "IA32";
if ("x64" == PLATFORM)
ICPlatform = "EM64T";
for (var i = 0; i < iSettings.PlatformsCount; ++i)
{
iSettings.CurrentPlatformIndex = i;
if (ICPlatform == iSettings.CurrentPlatformName)
break;
}
if (i >= iSettings.PlatformsCount)
{
WScript.StdErr.WriteLine(
"Build: Installed ICC does not support " + PLATFORM + " platform.");
retCode = 1;
break;
}
var rx = new RegExp("(^.*C\\+\\+ " + ICCVER + ".*)");
for (var i = 1; i <= iSettings.CompilersCount; ++i)
{
var compname = iSettings.Compiler(i).Name;
if (null != rx.exec(compname))
break;
}
if (i <= iSettings.CompilersCount)
{
iSettings.CurrentCompilerIndex = i;
WScript.Echo("Selected compiler: " +
iSettings.Compiler(i).Name);
}
else
{
WScript.StdErr.WriteLine(
"Build: ICC " + ICCVER + " not found.");
retCode = 1;
break;
}
}
// save BuildLogging property value
oldLogging = projectEngine.BuildLogging;
projectEngine.BuildLogging = true;
WScript.Echo("Performing configure step...\n");
var start = new Date();
var res = BuildProject(solutionBuild, ".configure");
TimeEcho ("config", start);
if (0 < res)
{
retCode = 3;
break;
}
WScript.Echo("Compiling stdcxx library...\n");
start = new Date();
res = BuildProject(solutionBuild, ".stdcxx");
TimeEcho ("lib", start);
if (0 < res)
{
retCode = 4;
break;
}
WScript.Echo("Compiling examples...\n");
start = new Date();
BuildProject(solutionBuild, ".stdcxx_examples");
TimeEcho ("examples", start);
WScript.Echo("Compiling rwtest library...\n");
start = new Date();
res = BuildProject(solutionBuild, ".rwtest");
TimeEcho ("rwtest", start);
if (0 == res)
{
runTests = true;
WScript.Echo("Compiling tests...\n");
start = new Date();
BuildProject(solutionBuild, ".stdcxx_tests");
TimeEcho ("tests", start);
}
WScript.Echo("Compiling utils...\n");
// compile exec utility
start = new Date();
var resExec = BuildProject(solutionBuild, "util_exec");
// compile rest utils
start = new Date();
var resUtils = BuildProject(solutionBuild, ".stdcxx_utils");
TimeEcho ("bin", start);
if (0 < resExec)
{
retCode = 5;
break;
}
if (buildOnly)
break;
start = new Date();
if (0 >= resUtils)
{
WScript.Echo("Running locales tests...");
BuildProject(solutionBuild, ".stdcxx_testlocales");
}
if (runTests)
{
WScript.Echo("Running tests...\n");
start = new Date();
BuildProject(solutionBuild, ".stdcxx_runtests");
}
WScript.Echo("Running examples...\n");
start = new Date();
BuildProject(solutionBuild, ".stdcxx_runexamples");
TimeEcho ("runall", start);
}
while (false);
if (null != iSettings)
{
if (null != oldIccIdx)
iSettings.CurrentCompilerIndex = oldIccIdx;
if (null != oldPlatIdx)
iSettings.CurrentPlatformIndex = oldPlatIdx;
iSettings = null;
}
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;
WScript.Echo("Closing the VisualStudio...");
solution = null;
dte.Quit();
dte = null;
WScript.Echo("Exiting...");
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) + "\\" + currentCfg;
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 (0 <= dirIndex)
srcDir = myDir.substr(0, dirIndex);
else
srcDir = "";
}
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>

View File

@@ -0,0 +1,127 @@
//
// $Id: config.js 453570 2006-10-06 12:16:32Z faridz $
//
// config.js - base classes for configurations support
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
//------------------------------------------------
//
// Common functions
//
//------------------------------------------------
// creates a copy of an object
function genericClone()
{
return this.cloneTo(new Object(), true);
}
// copy all properties and optionally methods to a target object
function genericCloneTo(target, cloneMethods)
{
//WScript.Echo(this);
for (i in this)
{
var type = typeof(this[i]);
//WScript.Echo(i + " " + type);
switch (type)
{
case "object":
target[i] = this[i].clone();
break;
case "number":
case "boolean":
case "undefined":
target[i] = this[i];
break;
case "function":
if (cloneMethods)
{
target[i] = this[i];
}
break;
case "string":
target[i] = String(this[i]);
break;
default:
throw "Unknown property type.";
}
}
return target;
}
//------------------------------------------------
// Associative Collection class
//------------------------------------------------
// Collection class .ctor
function Collection() {}
// Adds specified element to a collection of solutions
function addElement(name, element)
{
this[name] = element;
}
// Removes specified element from a collection of solutions
function removeElement(name)
{
delete this[name];
}
// Gets specified element from a collection of solutions
function getElement(name)
{
return this[name];
}
// Collection class methods
Collection.prototype.cloneTo = genericCloneTo;
Collection.prototype.clone = genericClone;
Collection.prototype.add = addElement;
Collection.prototype.func_remove = removeElement;
Collection.prototype.get = getElement;
//------------------------------------------------
// ItemBuildInfo class
//------------------------------------------------
// ItemBuildInfo .ctor
function ItemBuildInfo(name)
{
this.name = String(name);
this.buildCmdLog = "";
this.buildOutLog = "";
this.errorsCnt = "0";
this.warningsCnt = "0";
this.linkerErrors = false;
this.runOutput = "";
this.runReqOutput = "";
this.runDiff = "";
this.exitCode = 0;
}
// ItemBuildInfo class methods
ItemBuildInfo.prototype.cloneTo = genericCloneTo;
ItemBuildInfo.prototype.clone = genericClone;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
//
// $Id: data.js 466960 2006-10-23 09:20:40Z faridz $
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
// base configuration settings
//------------------------------------------------
// object storing info about configuration
//------------------------------------------------
function ConfigInfo(debug, mt, dll, out)
{
this.debug = debug;
this.mt = mt;
this.dll = dll;
this.out = out;
}
// configuration names
var confDebugStaticName = "11s Debug Static";
var confReleaseStaticName = "8s Optimized Static";
var confMTDebugStaticName = "15s Debug Thread-safe Static";
var confMTReleaseStaticName = "12s Optimized Thread-safe Static";
var confDebugDllName = "11d Debug Dll";
var confReleaseDllName = "8d Optimized Dll";
var confMTDebugDllName = "15d Debug Thread-safe Dll";
var confMTReleaseDllName = "12d Optimized Thread-safe Dll";
// configuration output directories
var confDebugStaticOut = "11s";
var confReleaseStaticOut = "8s";
var confMTDebugStaticOut = "15s";
var confMTReleaseStaticOut = "12s";
var confDebugDllOut = "11d";
var confReleaseDllOut = "8d";
var confMTDebugDllOut = "15d";
var confMTReleaseDllOut = "12d";
var configs = new Collection();
configs.add(confDebugStaticName, new ConfigInfo(true, false, false, confDebugStaticOut));
configs.add(confReleaseStaticName, new ConfigInfo(false, false, false, confReleaseStaticOut));
configs.add(confMTDebugStaticName, new ConfigInfo(true, true, false, confMTDebugStaticOut));
configs.add(confMTReleaseStaticName, new ConfigInfo(false, true, false, confMTReleaseStaticOut));
configs.add(confDebugDllName, new ConfigInfo(true, false, true, confDebugDllOut));
configs.add(confReleaseDllName, new ConfigInfo(false, false, true, confReleaseDllOut));
configs.add(confMTDebugDllName, new ConfigInfo(true, true, true, confMTDebugDllOut));
configs.add(confMTReleaseDllName, new ConfigInfo(false, true, true, confMTReleaseDllOut));
var confStaticNames = new Array(
confDebugStaticName, confReleaseStaticName,
confMTDebugStaticName, confMTReleaseStaticName);
var confDllNames = new Array(
confDebugDllName, confReleaseDllName,
confMTDebugDllName, confMTReleaseDllName);
var confDebugNames = new Array(
confDebugStaticName, confMTDebugStaticName,
confDebugDllName, confMTDebugDllName);
var confReleaseNames = new Array(
confReleaseStaticName, confMTReleaseStaticName,
confReleaseDllName, confMTReleaseDllName);
var confNames = confStaticNames.concat(confDllNames);

View File

@@ -0,0 +1,138 @@
//
// $Id: devenv_consts.js 495309 2007-01-11 17:53:05Z faridz $
//
// devenv_consts.js - constants for VisualStudio Automation objects
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
var typeUnknown = 0;
var typeApplication = 1;
var typeDynamicLibrary = 2;
var typeStaticLibrary = 4;
var typeGeneric = 10;
var typeLibrary = -1;
var charSetNotSet = 0;
var charSetUnicode = 1;
var charSetMBCS = 2;
var eFileTypeDefault = -1;
var eFileTypeCppCode = 0;
var eFileTypeCppClass = 1;
var eFileTypeCppHeader = 2;
var eFileTypeCppForm = 3;
var eFileTypeCppControl = 4;
var eFileTypeText = 5;
var eFileTypeDEF = 6;
var eFileTypeIDL = 7;
var eFileTypeMakefile = 8;
var eFileTypeRGS = 9;
var eFileTypeRC = 10;
var eFileTypeRES = 11;
var eFileTypeXSD = 12;
var eFileTypeXML = 13;
var eFileTypeHTML = 14;
var eFileTypeCSS = 15;
var eFileTypeBMP = 16;
var eFileTypeICO = 17;
var eFileTypeResx = 18;
var eFileTypeScript = 19;
var eFileTypeBSC = 20;
var eFileTypeXSX = 21;
var eFileTypeCppWebService = 22;
var eFileTypeAsax = 23;
var eFileTypeAspPage = 24;
var eFileTypeDocument = 25;
var eFileTypeDiscomap = 26;
var debugDisabled = 0;
var debugOldStyleInfo = 1;
var debugLineInfoOnly = 2;
var debugEnabled = 3;
var debugEditAndContinue = 4;
var warningLevel_0 = 0;
var warningLevel_1 = 1;
var warningLevel_2 = 2;
var warningLevel_3 = 3;
var warningLevel_4 = 4;
var optimizeDisabled = 0;
var optimizeMinSpace = 1;
var optimizeMaxSpeed = 2;
var optimizeFull = 3;
var optimizeCustom = 4;
var rtMultiThreaded = 0;
var rtMultiThreadedDebug = 1;
var rtMultiThreadedDLL = 2;
var rtMultiThreadedDebugDLL = 3;
var rtSingleThreaded = 4;
var rtSingleThreadedDebug = 5;
var pchNone = 0;
var pchCreateUsingSpecific = 1;
var pchGenerateAuto = 2;
var pchUseUsingSpecific = 3;
var linkIncrementalDefault = 0;
var linkIncrementalNo = 1;
var linkIncrementalYes = 2;
var optReferencesDefault = 0;
var optNoReferences = 1;
var optReferences = 2;
var optFoldingDefault = 0;
var optNoFolding = 1;
var optFolding = 2;
var machineNotSet = 0;
var machineX86 = 1;
var subSystemNotSet = 0;
var subSystemConsole = 1;
var subSystemWindows = 2;
var cppExceptionHandlingNo = 0;
var cppExceptionHandlingYes = 1;
var cppExceptionHandlingYesWithSEH = 2;
var preprocessNo = 0;
var preprocessYes = 1;
var preprocessNoLineNumbers = 2;
var vsWindowStateNormal = 0;
var vsWindowStateMinimize = 1;
var vsWindowStateMaximize = 2;
var vsSaveChangesYes = 1;
var vsSaveChangesNo = 2;
var vsSaveChangesPrompt = 3;
var runtimeBasicCheckNone = 0;
var runtimeCheckStackFrame = 1;
var runtimeCheckUninitVariables = 2;
var runtimeBasicCheckAll = 3;
var vsBuildStateNotStarted = 1;
var vsBuildStateInProgress = 2;
var vsBuildStateDone = 3;

View File

@@ -0,0 +1,282 @@
//
// $Id: filterdef.js 580483 2007-09-28 20:55:52Z sebor $
//
// filterdef.js - FilterDef class definition
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
var sourceFilterName = "Source Files";
var sourceFilterUuid = "{4FC737F1-C7A5-4376-A066-2A32D752A2FF}";
var sourceFilterExts = ".cpp;.cxx;.s;.asm";
var headerFilterName = "Header Files";
var headerFilterUuid = "{93995380-89BD-4b04-88EB-625FBE52EBFB}";
var headerFilterExts = ".h;.hpp;.hxx;.c;.cc";
//------------------------------------------------
// Macro class
//------------------------------------------------
// Macro .ctor
function Macro(name, value)
{
this.name = name;
this.value = value;
}
// Replace all macros in str
// str - string to modify
// arrMacro - array of Macro objects
function ReplaceMacros(str, arrMacro)
{
for (var i = 0; i < arrMacro.length; ++i)
{
var macro = arrMacro[i];
str = str.replace(new RegExp("(" + macro.name + ")", "g"), macro.value)
}
return str;
}
// common macros
var cmnMacros = new Array();
// init custom build rule for .asm files
function InitAsmTool(VCFile)
{
var cfgs = VCFile.FileConfigurations;
for (var i = 1; i <= cfgs.Count; ++i)
{
var cfg = cfgs.Item(i);
if ((typeof(cfg.Tool.ToolKind) != "undefined" &&
cfg.Tool.ToolKind != "VCCustomBuildTool") ||
cfg.Tool.ToolName != "Custom Build Tool")
{
cfg.Tool = cfg.ProjectConfiguration.FileTools.Item("VCCustomBuildTool");
}
var tool = cfg.Tool;
tool.Description = "Compiling .asm file...";
tool.Outputs = "$(IntDir)\\$(InputName).obj";
tool.CommandLine = AS + " /c /nologo /D" + PLATFORM + " /Fo" + tool.Outputs +
" /W3 /Zi /Ta" + VCFile.RelativePath;
}
}
//------------------------------------------------
// FilterDef class
//------------------------------------------------
// FilterDef .ctor
function FilterDef(name, id, filter, type, exclude)
{
this.Name = name;
this.Id = id;
this.Filter = filter;
this.Type = type;
this.Exclude = exclude;
this.Folder = null;
this.Files = new Array();
this.exclFolders = null;
this.exclFiles = null;
this.FilterDefs = new Array();
}
FilterDef.prototype.addFilter = filterAddFilter;
FilterDef.prototype.addFiles = filterAddFiles;
FilterDef.prototype.addFilesByMask = filterAddFilesByMask;
FilterDef.prototype.createVCFilter = filterCreateVCFilter;
// add subfilter to object
function filterAddFilter(filter)
{
this.FilterDefs.push(filter);
return this;
}
// add files to object
// folder - parent folder
// files - filename of array if filenames
function filterAddFiles(folder, files)
{
this.Folder = folder;
if (files instanceof Array)
this.Files = this.Files.concat(files);
else
this.Files.push(files);
return this;
}
// add to object files from filder and all subfolders
// excluding exclFolders and exclFiles
// folder - start folder
// exclFolder - regular expression which defines the folders to exclude
// exclFiles - regular expression which defines the files to exclude
function filterAddFilesByMask(folder, exclFolders, exclFiles)
{
this.Folder = folder;
this.exclFolders = exclFolders;
this.exclFiles = exclFiles;
return this;
}
// add file to VCFilter object
// filter - VCFilter object
// filename - filename to add
// filetype - type of file (one of eFileTypexxx)
// exclude - if true then file will be excluded from build
function AddFilterFile(filter, filename, filetype, exclude)
{
var VCFile = filter.AddFile(filename);
if (null != filetype && typeof(VCFile.FileType) != "undefined")
VCFile.FileType = filetype;
var customFileDef = null;
if (exclude)
{
var cfgs = VCFile.FileConfigurations;
for (var i = 1; i <= cfgs.Count; ++i)
{
var cfg = cfgs.Item(i);
if (typeof(cfg.Tool.ToolKind) != "undefined")
{
if (cfg.Tool.ToolKind != "VCCLCompilerTool")
exclude = false;
}
else if (cfg.Tool.ToolName != "C/C++ Compiler Tool")
exclude = false;
cfg.ExcludedFromBuild = exclude;
}
}
else if (".asm" == VCFile.Extension)
InitAsmTool(VCFile);
}
// create VCFilter object from the FilterDef definition
// and add to parent
function filterCreateVCFilter(parent)
{
var VCFilter;
if (null == this.Name)
VCFilter = parent;
else
{
VCFilter = parent.AddFilter(this.Name);
if (null != this.Id)
VCFilter.UniqueIdentifier = this.Id;
if (null != this.Filter)
VCFilter.Filter = this.Filter;
}
if (null != this.Folder)
this.Folder = ReplaceMacros(this.Folder, cmnMacros);
if (0 < this.Files.length)
{
// add specified files
for (var i = 0; i < this.Files.length; ++i)
{
var filename = this.Files[i];
if (null != this.Folder && this.Folder.length > 0)
filename = this.Folder + "\\" + filename;
try
{
fso.GetFile(filename);
}
catch (e)
{
WScript.Echo("File " + filename + " does not exist");
WScript.Quit(3);
}
AddFilterFile(VCFilter, filename, this.Type, this.Exclude);
}
}
else
{
// add files from folder
// create regexp from extensions
var extArray = this.Filter.replace(/\./g, "\\.").split(";");
var rxText = "^";
if (extArray.length != 0)
{
rxText += "(?:" + extArray[0];
for (i = 1; i < extArray.length; ++i)
rxText += "|" + extArray[i];
rxText += ")";
}
rxText += "$";
var rxExts = new RegExp(rxText, "i");
var folder;
try
{
folder = fso.GetFolder(this.Folder);
}
catch (e)
{
WScript.Echo("Folder " + this.Folder + " does not exist");
WScript.Quit(3);
}
// add subfolders as own filters
var enumSubFolders = new Enumerator(folder.SubFolders);
for (; !enumSubFolders.atEnd(); enumSubFolders.moveNext())
{
var subFolder = enumSubFolders.item();
if (null == this.exclFolders || !this.exclFolders.test(subFolder.Name))
{
var filterDef = new FilterDef(subFolder.Name, this.Id,
this.Filter, this.Type, this.Exclude);
filterDef.Folder = subFolder.Path;
filterDef.exclFolders = this.exclFolders;
filterDef.exclFiles = this.exclFiles;
filterDef.createVCFilter(VCFilter);
}
}
// add files
var nfiles = 0;
var enumFiles = new Enumerator(folder.Files);
for (; !enumFiles.atEnd(); enumFiles.moveNext())
{
var file = enumFiles.item();
var fileext = getExtension(file.Name);
if (rxExts.test(fileext) && (null == this.exclFiles || !this.exclFiles.test(file.Name)))
{
++nfiles;
AddFilterFile(VCFilter, file.Path, this.Type, this.Exclude);
}
}
// remove filter if it is empty
if (0 == nfiles)
parent.RemoveFilter(VCFilter);
}
for (var i = 0; i < this.FilterDefs.length; ++i)
this.FilterDefs[i].createVCFilter(VCFilter);
}

View File

@@ -0,0 +1,96 @@
/***************************************************************************
*
* 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.
*
* Copyright 1999-2007 Rogue Wave Software, Inc.
*
**************************************************************************/
extern "C"
{
typedef void (*funptr_t)();
}
// take the address of the function in a way
// that foils even clever optimizers
union {
funptr_t pf;
unsigned long ul;
} funptri;
#ifdef CHECK_DECL
# if defined (__linux__) && defined (__GNUG__) && __GNUG__ < 3
// prevent empty exception specifications from triggering
// gcc 2.9x -fhonor-std link errors looking for std::terminate()
# include <features.h>
# undef __THROW
# define __THROW
# endif // gcc < 3 on Linux
# include HDRNAME
# ifndef NONAMESPACE
namespace std { }
using namespace std;
# endif // NONAMESPACE
int main (int argc, char**)
{
// with gcc, prevent intrinsics from causing false positives
# if TAKE_ADDR
funptri.pf = (funptr_t)&FUNNAME;
return (argc < 1 ? !funptri.ul : !!funptri.ul) + 0;
# else // if !TAKE_ADDR
// disable warnings about an unused variable
(void)&argc;
// call the function using the supplied arguments
#ifdef FUN_PARAMS
FUN_PARAMS;
#endif
(void)FUN;
return 0;
# endif // TAKE_ADDR
}
#else // if !defined (CHECK_DECL)
extern "C" void FUNNAME ();
int main (int argc, char**)
{
funptri.pf = (funptr_t)&FUNNAME;
return (argc < 1 ? !funptri.ul : !!funptri.ul) + 0;
}
#endif // CHECK_DECL

View File

@@ -0,0 +1,464 @@
<?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="generate" prompt="no">
<?job error="false" debug="false" ?>
<runtime>
<description>
Generates solution file for a specified environment
</description>
<named helpstring="Name of the compiler configuration"
name="CONFIG" required="false" type="string"/>
<named helpstring="Top directory of stdcxx sources tree"
name="TOPDIR" required="false" type="string"/>
<named helpstring="Output directory for modules"
name="BUILDDIR" required="false" type="string"/>
<named helpstring="Copy dll to exe option"
name="COPYDLL" required="false" type="string"/>
<named helpstring="Generate locales projects"
name="LOCALES" required="false" type="string"/>
<named helpstring="Generate locales test projects"
name="LOCALETESTS" required="false" type="string"/>
<example>cscript generate.wsf /TOPDIR:"C:\stdcxx"
/BUILDDIR:"C:\stdcxx\build" /CONFIG:msvc-7.1
</example>
<usage>
Usage: cscript generate.wsf [/CONFIG:@CONFIG]
[/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.
</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="generate" language="JScript">
<![CDATA[
//
// Solution generation script for Stdcxx library
//
// constants
var scriptDir = getParentFolder(WScript.ScriptFullName);
var srcDir = getParentFolder(getParentFolder(getParentFolder(scriptDir)));
var outDir = srcDir;
var outDirBase = outDir;
var logFile = "slngen.log";
var logStream = null;
var currentCfg = "";
var copyDll = false;
var buildLocales = false;
var testLocales = false;
var winconfigDir = "\\etc\\config\\windows";
var description = new generate; // run
// the replacement of the WScript.Echo()
function Echo(msg)
{
try
{
// WScript.Echo(msg);
WScript.StdOut.WriteLine(msg);
}
catch(e)
{
}
}
// print message to the stdout and out the message to the logfile
function LogMessage(msg)
{
Echo(msg);
logStream.WriteLine(msg);
}
// the main function of the script
function generate()
{
Echo("Solution generation script");
Echo("Checking arguments...");
readAndCheckArguments();
createBuildDirs();
outDirBase = outDir;
outDir += "\\" + currentCfg;
Echo("Checking consistence...");
// get solution object
if (null == VCProjectEngine && !InitVSObjects(currentCfg))
WScript.Quit(3);
logFile = currentCfg + logFile;
logStream = fso.CreateTextFile(outDir + "\\" + logFile, true, false);
cmnMacros = new Array(
new Macro("%SOLUTION%", currentCfg),
new Macro("%SRCDIR%", srcDir),
new Macro("%BUILDDIR%", outDir));
PrintVars(logStream);
PrintVars(WScript.StdOut);
LogMessage("Creating projects definitions...");
var projectDefs = CreateProjectsDefs(copyDll, buildLocales, testLocales);
LogMessage("Creating projects...");
CreateProjects(projectDefs, LogMessage);
if (VERSION != "7")
{
LogMessage("Configuring project dependencies...");
ConfigureDependencies(projectDefs);
}
LogMessage("Writing solution on disk...");
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 stdcxxDefs = 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(stdcxxDefs).concat(exampleDefs);
var tstsolution = configureDefs.concat(stdcxxDefs).concat(rwtestDefs).concat(testDefs);
var locsolution = configureDefs.concat(stdcxxDefs).concat(utilDefs).concat(localeDefs);
var tstlocsolution = configureDefs.concat(stdcxxDefs).concat(utilDefs).concat(testlocaleDefs);
var runsolution = configureDefs.concat(stdcxxDefs).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;
if (CONVERT)
convertSolutions(new Array(solutionName, exsolutionName,
tstsolutionName, locsolutionName,
tstlocsolutionName, runsolutionName));
LogMessage("Generating build.bat...");
generateBuildBatch(srcDir, outDirBase);
logStream.WriteLine("Solution created");
logStream.Close();
var logPath = outDir + "\\" + currentCfg + "slngen.log";
var resLogPath = "file://" + logPath.replace(/\\/mg, "/");
Echo("Solution was generated successfully. See " +
resLogPath + " for details.");
WScript.Quit(0);
}
// convert solution(s) from msvc to icc format
function convertSolutions(solNames)
{
if (typeof(solNames) == "string")
solNames = new Array(solNames);
for (var i = 0; i < solNames.length; ++i)
{
var solName = solNames[i];
try
{
LogMessage("Converting solution " + solName + " to ICC.");
var res = WshShell.Run(ICCCONVERT + " \"" + outDir + "\\" + solName + "\" /IC", 0, true);
if (0 != res)
LogMessage("Conversion finished with code " + res);
}
catch(e)
{
LogMessage("Conversion failed");
}
}
}
// performs checking of the script parameters
function readAndCheckArguments()
{
if (WScript.Arguments.Named.Exists("CONFIG"))
currentCfg = WScript.Arguments.Named("CONFIG");
else
{
// try to deduce it
// ICC cannot be used without VisualStudio installed
// so we check only for MSVC
Echo("CONFIG parameter not specified, trying to detect it...");
var cfgs = new Array("msvc-8.0", "msvc-7.1", "msvc-7.0");
for (var i = 0; i < cfgs.length; ++i)
{
var curCfg = cfgs[i];
Echo("Trying " + curCfg + "...");
if (InitVSObjects(curCfg))
{
Echo("Succeeded. Using CONFIG=" + curCfg + ".");
currentCfg = curCfg;
break;
}
Echo(curCfg + " checking failed.");
}
}
if ("" == currentCfg)
{
WScript.StdErr.WriteLine("No suitable config file detected.");
WScript.Quit(2);
}
if (WScript.Arguments.Named.Exists("BUILDDIR"))
{
outDir = WScript.Arguments.Named("BUILDDIR");
outDir = fso.GetAbsolutePathName (outDir);
}
else
{
// use current directory
outDir = WshShell.CurrentDirectory;
Echo("BUILDDIR parameter not specified, using BUILDDIR=" + outDir);
}
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);
Echo("TOPDIR parameter not specified, using TOPDIR=" + srcDir);
}
if (srcDir != "")
{
if (!fso.FolderExists(srcDir))
{
WScript.StdErr.WriteLine(
"Generate: Unable to read sources folder "
+ srcDir);
WScript.Quit(2);
}
}
if (WScript.Arguments.Named.Exists("COPYDLL"))
{
var copyOption = WScript.Arguments.Named("COPYDLL");
copyOption = copyOption.toLowerCase();
if (copyOption == "yes" || copyOption == "y")
copyDll = true;
}
if (WScript.Arguments.Named.Exists("LOCALES"))
{
var option = WScript.Arguments.Named("LOCALES");
option = option.toLowerCase();
if (option != "no" && option != "n")
buildLocales = true;
}
if (WScript.Arguments.Named.Exists("LOCALETESTS"))
{
var option = WScript.Arguments.Named("LOCALETESTS");
option = option.toLowerCase();
if (option != "no" && option != "n")
testLocales = true;
}
}
// creates build directory tree
function createBuildDirs()
{
try
{
var builddir = outDir;
var topdir = srcDir;
if (! fso.FolderExists(builddir))
{
var flddir = builddir;
var fldrs = new Array();
while (! fso.FolderExists(flddir))
{
fldrs.push (flddir);
flddir = fso.GetParentFolderName (flddir);
if ("" == flddir)
{
WScript.StdErr.WriteLine("Generate: Fatal error: " +
"Failed to create folder " + builddir);
WScript.Quit(3);
}
}
while (fldrs.length > 0)
fso.CreateFolder(fldrs.pop());
}
builddir += "\\" + currentCfg;
if (! fso.FolderExists(builddir))
fso.CreateFolder(builddir);
Echo("Building directory tree created");
}
catch(e)
{
WScript.StdErr.WriteLine("Generate: Fatal error: Failed to"
+ " open folder " + builddir);
WScript.Quit(3);
}
}
// creates the build.bat file
// sourcesDir - main folder of the stdcxx sources
// buildDir - folder for build output files
function generateBuildBatch(sourcesDir, buildDir)
{
try
{
var buildBatchFileName = buildDir + "\\" + "build_" + currentCfg + ".bat";
if (fso.FileExists(buildBatchFileName))
return 1;
var buildBatchFile = fso.CreateTextFile(buildBatchFileName);
buildBatchFile.WriteLine("@echo off");
buildBatchFile.WriteLine("set ERRORLEVEL=0");
buildBatchFile.WriteLine("");
buildBatchFile.WriteLine("set topdir=" + sourcesDir);
buildBatchFile.WriteLine("set builddir=" + buildDir);
buildBatchFile.WriteLine("set scriptdir=etc\\config\\windows");
buildBatchFile.WriteLine("set makelog=makelog.wsf");
buildBatchFile.WriteLine("set cfg=11s Debug Static");
buildBatchFile.WriteLine("set cfgbrief=11s");
buildBatchFile.WriteLine("set devenv=\"" + DEVENV + "\"");
buildBatchFile.WriteLine("");
buildBatchFile.WriteLine("if \"%1\"==\"\" goto buildcfg");
buildBatchFile.WriteLine("");
buildBatchFile.WriteLine(":cfgloop");
buildBatchFile.WriteLine("set cfg=");
buildBatchFile.WriteLine("");
for (var i = 0; i < confNames.length; ++i)
{
var lcfg = confNames[i];
var scfg = configs.get(lcfg).out;
buildBatchFile.WriteLine("if \"%1\"==\"" + scfg + "\" (");
buildBatchFile.WriteLine("set cfg=" + lcfg);
buildBatchFile.WriteLine("set cfgbrief=" + scfg);
buildBatchFile.WriteLine(")");
buildBatchFile.WriteLine("");
}
buildBatchFile.WriteLine("if \"%cfg%\"==\"\" (");
buildBatchFile.WriteLine("echo Unknown configuration to build: %1");
buildBatchFile.WriteLine("set ERRORLEVEL=1");
buildBatchFile.WriteLine("goto nextcfg");
buildBatchFile.WriteLine(")");
buildBatchFile.WriteLine("");
buildBatchFile.WriteLine(":buildcfg");
buildBatchFile.WriteLine("echo Building %cfg%...");
buildBatchFile.WriteLine("cscript /nologo "
+ "\"%topdir%\\%scriptdir%\\build.wsf\""
+ " /BUILDDIR:\"%builddir%\" /TOPDIR:\"%topdir%\""
+ " /BUILDTYPE:%cfgbrief% /CONFIG:" + currentCfg);
buildBatchFile.WriteLine("cscript /nologo "
+ "\"%topdir%\\%scriptdir%\\%makelog%\""
+ " /BUILDDIR:\"%builddir%\" /BUILDTYPE:%cfgbrief%"
+ " /CONFIG:" + currentCfg);
buildBatchFile.WriteLine("");
buildBatchFile.WriteLine(":nextcfg");
buildBatchFile.WriteLine("shift");
buildBatchFile.WriteLine("if not \"%1\"==\"\" goto cfgloop");
buildBatchFile.WriteLine("");
buildBatchFile.WriteLine(":continue");
buildBatchFile.WriteLine("echo Build complete");
buildBatchFile.WriteLine("");
buildBatchFile.Close();
return 1;
}
catch(e)
{
Echo("error creating the build batch file");
return 0;
}
}
]]>
</script>
</job>
</package>

View File

@@ -0,0 +1,36 @@
//
// $Id: icc-10.0-x64.config 580483 2007-09-28 20:55:52Z sebor $
//
// icc-10.0-x64.config - configuration file for 64 bit Intel C++ 10.0
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-8.0-x64
DEVENVFLAGS=/useenv
CPPFLAGS=
LDFLAGS=
CONVERT=1
CXX=icl
LD=icl
AR=xilib
CLVARSBAT=%ICPP_COMPILER10%\EM64T\Bin\iclvars.bat
ICCCONVERT=ICProjConvert100.exe
ICCVER=10.0

View File

@@ -0,0 +1,36 @@
//
// $Id: icc-10.0.config 580483 2007-09-28 20:55:52Z sebor $
//
// icc-10.0.config - configuration file for Intel C++ 10.0
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-8.0
DEVENVFLAGS=/useenv
CPPFLAGS=
LDFLAGS=
CONVERT=1
CXX=icl
LD=icl
AR=xilib
CLVARSBAT=%ICPP_COMPILER10%\IA32\Bin\iclvars.bat
ICCCONVERT=ICProjConvert100.exe
ICCVER=10.0

View File

@@ -0,0 +1,27 @@
//
// $Id: icc-10.1-x64.config 620039 2008-02-08 23:43:37Z faridz $
//
// icc-10.1-x64.config - configuration file for 64 bit Intel C++ 10.1
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include icc-10.0-x64
ICCVER=10.1

View File

@@ -0,0 +1,27 @@
//
// $Id: icc-10.1.config 620039 2008-02-08 23:43:37Z faridz $
//
// icc-10.1.config - configuration file for Intel C++ 10.1
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include icc-10.0
ICCVER=10.1

View File

@@ -0,0 +1,35 @@
//
// $Id: icc-9.0.config 580483 2007-09-28 20:55:52Z sebor $
//
// icc-9.0.config - configuration file for Intel C++ 9.0
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-7.1
DEVENVFLAGS=/useenv
CPPFLAGS=
LDFLAGS=
CONVERT=1
CXX=icl
LD=icl
AR=xilib
CLVARSBAT=%ICPP_COMPILER90%\IA32\Bin\iclvars.bat
ICCVER=9.0

View File

@@ -0,0 +1,35 @@
//
// $Id: icc-9.1-x64.config 580483 2007-09-28 20:55:52Z sebor $
//
// icc-9.1-x64.config - configuration file for 64 bit Intel C++ 9.1
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-8.0-x64
DEVENVFLAGS=/useenv
CPPFLAGS=
LDFLAGS=
CONVERT=1
CXX=icl
LD=icl
AR=xilib
CLVARSBAT=%ICPP_COMPILER91%\EM64T\Bin\iclvars.bat
ICCVER=9.1

View File

@@ -0,0 +1,35 @@
//
// $Id: icc-9.1.config 580483 2007-09-28 20:55:52Z sebor $
//
// icc-9.1.config - configuration file for Intel C++ 9.1
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-8.0
DEVENVFLAGS=/useenv
CPPFLAGS=
LDFLAGS=
CONVERT=1
CXX=icl
LD=icl
AR=xilib
CLVARSBAT=%ICPP_COMPILER91%\IA32\Bin\iclvars.bat
ICCVER=9.1

View File

@@ -0,0 +1,283 @@
<?xml version="1.0" ?>
<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="makelog" prompt="no">
<?job error="false" debug="false" ?>
<runtime>
<description>
Gathers logs and makes the build summary log.
</description>
<named helpstring="The build directory" name="BUILDDIR"
required="true" type="string"/>
<named helpstring="The build type" name="BUILDTYPE"
required="true" type="string"/>
<named helpstring="The configuration" name="CONFIG"
required="true" type="string"/>
<example>
cscript makelog.wsf /BUILDDIR"C:\stdcxx\build" /BUILDTYPE:11d /CONFIG:msvc-7.1
</example>
<usage>
Usage: cscript makebuildlog.wsf /BUILDDIR:@BUILDDIR
/BUILDTYPE:@BUILDTYPE /CONFIG:@CONFIG
where
@BUILDDIR is the build directory,
@BUILDTYPE is the build type (11d, 11s, etc).
@CONFIG is the compiler configuration (msvc-7.1, icc-9.0, etc).
</usage>
</runtime>
<object id="fso" progid="Scripting.FileSystemObject"/>
<object id="WshShell" progid="WScript.Shell"/>
<script language="JScript" src="config.js"/>
<script language="JScript" src="utilities.js"/>
<script language="JScript" src="summary.js"/>
<script id="makelog" language="JScript">
<![CDATA[
//
// Summary build log maker script
//
var buildDir = ""; // path to the root directory containing executables
var buildDirBase = ""; // path to the root directory containing executables
var buildType = ""; // the buid type (11d, 11s, etc)
var buildCfg = ""; // the build configuration (MSVC-7.1, ICC-9.0, etc)
var buildlogFile = "BuildLog.htm";
var summaryFileName = "Summary.htm";
var htmFolderName = "temphtm";
var buildSummaryPrefix = "msvc-7.1-";
var buildLogUnicode = 0;
var libBuildDir = "src";
var examplesBuildDir = "examples";
var testsBuildDir = "tests";
var rwtestBuildDir = "tests\\src";
var description = new makelog; // run
// the main function of the script
function makelog()
{
readAndCheckArguments();
getCompilerOpts(buildCfg);
var useUnicode = UNICODELOG;
if (useUnicode)
buildLogUnicode = -1;
// check for build failures
var sumTempFileNameEx = buildDir + "\\" + buildType + "\\" +
examplesBuildDir + "\\" + summaryFileName;
checkForFailures(buildDir + "\\" + buildType + "\\" + examplesBuildDir, buildType,
buildlogFile, sumTempFileNameEx, htmFolderName, true, useUnicode);
var sumTempFileNameTst = buildDir + "\\" + buildType + "\\" +
testsBuildDir + "\\" + summaryFileName;
checkForFailures(buildDir + "\\" + buildType + "\\" + testsBuildDir, buildType,
buildlogFile, sumTempFileNameTst, htmFolderName, true, useUnicode);
// make build summary log file
var fSum = makeSummaryLog(buildDirBase, buildSummaryPrefix, buildType);
var logPath = getSummaryLogPath(buildDirBase,
buildSummaryPrefix, buildType);
// read information about library
var libInfo = new ItemBuildInfo(".stdcxx");
getLibraryBuildInfo(buildDir + "\\" + buildType +
"\\" + libBuildDir, libInfo);
// and test driver
var rwtestInfo = new ItemBuildInfo(".rwtest");
getTestDriverBuildInfo(buildDir + "\\" + buildType +
"\\" + rwtestBuildDir, rwtestInfo);
// save headers for library and test driver
saveSummaryHeaderLib(fSum, libInfo, hdrLibrary);
saveSummaryHeaderTestDriver(fSum, rwtestInfo, hdrTestDriver);
// save headers for examples and tests
saveSummaryHeaderMulti(fSum, buildDir + "\\" + buildType + "\\" + examplesBuildDir,
buildType, hdrExamples);
saveSummaryHeaderMulti(fSum, buildDir + "\\" + buildType + "\\" + testsBuildDir,
buildType, hdrTests);
// save build summary for library and test driver
saveBuildSummarySingle(fSum, libInfo, hdrLibrary);
saveBuildSummarySingle(fSum, rwtestInfo, hdrTestDriver);
// save build summary for examples and tests
saveBuildSummariesFromFolder(fSum,
buildDir + "\\" + buildType + "\\" + examplesBuildDir,
htmFolderName);
saveBuildSummariesFromFolder(fSum,
buildDir + "\\" + buildType + "\\" + testsBuildDir,
htmFolderName);
closeSummaryLog(fSum);
deleteTemporaryFiles();
var resLogPath = logPath.replace(/\\/mg, "/");
WScript.Echo("Summary log was generated in file://" + resLogPath);
WScript.Quit(0);
}
// performs checking of the script parameters
function readAndCheckArguments()
{
if (!WScript.Arguments.Named.Exists("BUILDDIR"))
{
WScript.StdErr.WriteLine(
"Generate: Missing required argument BUILDDIR.");
WScript.Arguments.ShowUsage();
WScript.Quit(2);
}
buildDir = WScript.Arguments.Named("BUILDDIR");
buildDirBase = buildDir;
if (!WScript.Arguments.Named.Exists("CONFIG"))
{
WScript.StdErr.WriteLine(
"Generate: Missing required argument CONFIG.");
WScript.Arguments.ShowUsage();
WScript.Quit(2);
}
buildCfg = WScript.Arguments.Named("CONFIG");
buildSummaryPrefix = buildCfg + "-";
buildDir = buildDir + "\\" + buildCfg;
if (WScript.Arguments.Named.Exists("BUILDTYPE"))
buildType = WScript.Arguments.Named("BUILDTYPE");
else
buildType = "11d";
if (! fso.FolderExists(buildDir))
{
WScript.StdErr.WriteLine(
"Generate: Could not find directory " + buildDir);
WScript.Quit(3);
}
}
// collects information about build process of the stdcxx library
// libDir - output directory for the stdcxx library
// libInfo - ItemBuildInfo object to hold the collected information
function getLibraryBuildInfo(libDir, libInfo)
{
if (! fso.FolderExists(libDir))
return;
var blogFilePath = libDir + "\\" + buildlogFile;
if (! fso.FileExists(blogFilePath))
return;
var blogFile = fso.OpenTextFile(blogFilePath, 1, false, buildLogUnicode);
var blogData = blogFile.ReadAll();
var posTmp = getCommandLinesInfo(libInfo, blogData, 0);
posTmp = getCompilationInfo(libInfo, blogData, posTmp);
posTmp = getBuildSummaryInfo(libInfo, blogData, posTmp);
}
// collects information about build process of the rwtest library
// rwtestDir - output directory for the rwtest library
// rwtestInfo - ItemBuildInfo object to hold the collected information
function getTestDriverBuildInfo(rwTestDir, rwtestInfo)
{
if (! fso.FolderExists(rwTestDir))
return;
var blogFilePath = rwTestDir + "\\" + buildlogFile;
if (! fso.FileExists(blogFilePath))
return;
var blogFile = fso.OpenTextFile(blogFilePath, 1, false, buildLogUnicode);
var blogData = blogFile.ReadAll();
var posTmp = getCommandLinesInfo(rwtestInfo, blogData, 0);
posTmp = getCompilationInfo(rwtestInfo, blogData, posTmp);
posTmp = getBuildSummaryInfo(rwtestInfo, blogData, posTmp);
}
// removes the temporary files created by this script and by run_all.wsf script
function deleteTemporaryFiles()
{
// delete temphtm folders
deleteTempFolders(buildDir + "\\" + buildType + "\\" + examplesBuildDir, htmFolderName);
deleteTempFolders(buildDir + "\\" + buildType + "\\" + testsBuildDir, htmFolderName);
// delete Summary.htm files
var sumTempFileNameEx = buildDir + "\\" + buildType + "\\" + examplesBuildDir + "\\" + summaryFileName;
if (fso.FileExists(sumTempFileNameEx))
fso.DeleteFile(sumTempFileNameEx);
var sumTempFileNameTst = buildDir + "\\" + buildType + "\\" + testsBuildDir + "\\" + summaryFileName;
if (fso.FileExists(sumTempFileNameTst))
fso.DeleteFile(sumTempFileNameTst);
}
// removes the subfolders with the specified name in specified folder
// startDir - starting folder
// tempName - name of the folder with temporary files
function deleteTempFolders(startDir, tempName)
{
if (!fso.FolderExists(startDir))
return;
var startFolder = fso.GetFolder(startDir);
var enumHtmSubFolders = new Enumerator(startFolder.SubFolders);
for (; !enumHtmSubFolders.atEnd(); enumHtmSubFolders.moveNext())
{
var htmFName = enumHtmSubFolders.item().Name;
var htmParent = enumHtmSubFolders.item().ParentFolder.Name;
if (htmFName == tempName)
{
try
{
fso.DeleteFolder(enumHtmSubFolders.item().Path);
}
catch(e)
{
WScript.StdErr.Write("Could not delete temporary folder " +
enumHtmSubFolders.item().Path);
}
}
else
{
deleteTempFolders(startDir + "\\" + htmFName, tempName);
}
}
}
]]>
</script>
</job>
</package>

View File

@@ -0,0 +1,109 @@
//
// $Id: msvc-7.0.config 580483 2007-09-28 20:55:52Z sebor $
//
// msvc-7.0.config - configuration file for Microsoft Visual C++ 7.0
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
// Version of the used MS VisualStudio:
// 7 for MS VisualStudio .NET
// 7.1 for MS VisualStudio .NET 2003
// 8.0 for MS VisualStudio 2005 and MSVC 2005 Express Edition
// 9.0 for MS VisualStudio 2008
VERSION=7
// Path to the MS VisualStudio IDE executable:
// devenv.exe for MS VisualStudio
// VCExpress.exe for MSVC 2005 Express Edition
// if empty it will be tried to be detected automatically
DEVENV=
// Additional flags for devenv.exe
DEVENVFLAGS=
// Path to the WinDiff utility:
// if empty it will be tried to be detected automatically
WINDIFF=
// Path of the ICProjConvertxx.exe utility:
// if path is empty it will be tried to be detected automatically
ICCCONVERT=
// Convert solution to ICC format
// 0 for all MSVC
// 1 for all ICC
CONVERT=0
// additional flags for the compiler
CPPFLAGS=
// additional flags for the linker
LDFLAGS=
// additional libraries
LIBS=
// CXX, LD, AR used only at configure build step
// CXX - command invoked to compile the test source file
// LD - command invoked to link the test
// AR - command invoked to make library
// AS will be used at solution generation build step
// to initialize Custom Build Rule for compiling .asm files
CXX=cl
LD=cl
AR=lib
AS=ml
// Use singlethreaded or mutlithreaded CRT in 11s, 11d solution configurations
// 0 for MS VisualStudio .NET and MS VisualStudio .NET 2003
// 1 for MS VisualStudio 2005 and MSVC 2005 Express Edition
NOSTCRT=0
// target platform
// Win32 for MS VisualStudio .NET and MS VisualStudio .NET 2003
// and MSVC 2005 Express Edition
// Win32 or x64 for MS VisualStudio 2005
PLATFORM=Win32
// Version of the solution file format:
// 7.00 for MS VisualStudio .NET
// 8.00 for MS VisualStudio .NET 2003
// 9.00 for MS VisualStudio 2005 and MSVC 2005 Express Edition
// 10.00 for MS VisualStudio 2008
SLNVER=7.00
// Comment in produced solution file:
// empty for MS VisualStudio .NET and MS VisualStudio .NET 2003
// Visual Studio 2005 - for MS VisualStudio 2005
// Visual C++ Express 2005 - for MSVC 2005 Express Edition
// Visual Studio 2008 - for MS VisualStudio 2008
SLNCOMMENT=
// Type of produced file buildlog.htm:
// 0 - non-unicode
// 1 - unicode
UNICODELOG=0
// Path to the ICC iclvars.bat
// Should be empty for MSVC
CLVARSBAT=
// Version of the Intel C++
// Should be empty for MSVC
ICCVER=

View File

@@ -0,0 +1,30 @@
//
// $Id: msvc-7.1.config 580483 2007-09-28 20:55:52Z sebor $
//
// msvc-7.1.config - configuration file for Microsoft Visual C++ 7.1
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-7.0
VERSION=7.1
CPPFLAGS=
LDFLAGS=
SLNVER=8.00

View File

@@ -0,0 +1,29 @@
//
// $Id: msvc-8.0-x64.config 580483 2007-09-28 20:55:52Z sebor $
//
// msvc-8.0-x64.config - configuration file for
// 64 bit Microsoft Visual C++ 8.0
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-8.0
PLATFORM=x64
AS=ml64

View File

@@ -0,0 +1,33 @@
//
// $Id: msvc-8.0.config 580483 2007-09-28 20:55:52Z sebor $
//
// msvc-8.0.config - configuration file for Microsoft Visual C++ 8.0
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-7.0
VERSION=8.0
CPPFLAGS=/D_CRT_SECURE_NO_DEPRECATE
LDFLAGS=
SLNVER=9.00
SLNCOMMENT=Visual Studio 2005
UNICODELOG=1
NOSTCRT=1

View File

@@ -0,0 +1,29 @@
//
// $Id: msvc-9.0-x64.config 580483 2007-09-28 20:55:52Z sebor $
//
// msvc-9.0-x64.config - configuration file for
// 64 bit Microsoft Visual C++ 9.0
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-9.0
PLATFORM=x64
AS=ml64

View File

@@ -0,0 +1,29 @@
//
// $Id: msvc-9.0.config 580483 2007-09-28 20:55:52Z sebor $
//
// msvc-9.0.config - configuration file for Microsoft Visual C++ 9.0
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-8.0
VERSION=9.0
SLNVER=10.00
SLNCOMMENT=Visual Studio 2008

View File

@@ -0,0 +1,30 @@
//
// $Id: msvcex-8.0.config 580483 2007-09-28 20:55:52Z sebor $
//
// msvcex-8.0.config - configuration file for
// Microsoft Visual C++ 8.0 Express Edition
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
#include msvc-8.0
DEVENV=VCExpress.exe
SLNCOMMENT=Visual C++ Express 2005
LIBS=user32.lib

View File

@@ -0,0 +1,968 @@
//
// $Id: projectdef.js 590686 2007-10-31 14:49:24Z faridz $
//
// projectdef.js - ProjectDef class definition
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
var TristateUseDefault = -2;
var TristateTrue = -1;
var TristateFalse = 0;
var dte = null;
var VCProjectEngine = null;
var ICConvertTool = "ICProjConvert90.exe";
// test availability of utility file
// returns true if utility is available
// otherwise returns false
function TestUtil(cmd)
{
try
{
return (0 == WshShell.Run(cmd + " /?", 0, true));
}
catch (e) {}
return false;
}
// init VisualStudio objects using specified configuration
// config - name of configuration (e.g. msvc-7.0)
// freedte - if undefined or true then free dte inside function
function InitVSObjects(config, freedte)
{
getCompilerOpts(config);
try
{
dte = WScript.CreateObject("VisualStudio.DTE." + VERSION);
if (DEVENV == "")
{
// use devenv.com executable, if it present
var comName = dte.FullName.replace(/\.exe$/i, ".com");
DEVENV = fso.FileExists(comName) ? comName : dte.FullName;
}
}
catch (e) {}
if (CONVERT)
{
if (ICCCONVERT == "")
ICCCONVERT = "ICProjConvert90.exe";
var ICConvertTool = ICCCONVERT;
var arrPath = new Array(ICConvertTool);
if (0 > ICConvertTool.indexOf("\\"))
{
// no file path specified
// try to detect the path
if (null != dte)
{
try
{
var isettings = dte.GetObject("IntelOptions");
for (var i = 1; i <= isettings.CompilersCount; ++i)
{
var paths = isettings.Compiler(i).ExecutablePath.split(";");
for (var j = 0; j < paths.length; ++j)
arrPath.push("\"" + isettings.Evaluate(paths[j]) + "\\" + ICConvertTool + "\"");
}
isettings = null;
}
catch (e) {}
}
}
var success = false;
for (var i = 0; i < arrPath.length; ++i)
if (TestUtil(arrPath[i]))
{
success = true;
ICCCONVERT = arrPath[i];
break;
}
if (!success)
{
WScript.StdErr.WriteLine(ICCCONVERT + " conversion utility not found");
WScript.StdErr.WriteLine("You should check ICCCONVERT configuration variable");
WScript.Quit(3);
}
}
if (("undefined" == typeof(freedte) || true == freedte) && (null != dte))
{
dte.Quit();
dte = null;
}
try
{
VCProjectEngine = WScript.CreateObject("VisualStudio.VCProjectEngine." + VERSION);
}
catch (e)
{
WScript.StdErr.WriteLine("Unable to create VCProjectEngine object: " + e.message);
return false;
}
return true;
}
//------------------------------------------------
// ProjectDef class
//------------------------------------------------
// ProjectDef .ctor
function ProjectDef(name, type)
{
this.Name = name;
this.Type = type;
this.SubSystem = typeGeneric == type ? null :
(typeApplication == type ? subSystemConsole : subSystemWindows);
this.RTTI = true;
this.VCProjDir = "%BUILDDIR%";
this.FilterDefs = new Array();
this.Defines = null;
this.Includes = null;
this.PrepOpts = null
this.CppOpts = null;
this.LnkOpts = null;
this.LibOpts = null;
this.OutDir = null;
this.IntDir = null;
this.Libs = null;
this.OutFile = null;
this.CustomBuildFile = null;
this.CustomBuildDesc = null;
this.CustomBuildCmd = null;
this.CustomBuildOut = null;
this.CustomBuildDeps = null;
this.PreLinkDesc = null;
this.PreLinkCmd = null;
this.PreBuildDesc = null;
this.PreBuildCmd = null;
this.PostBuildDesc = null;
this.PostBuildCmd = null;
this.VSProject = null;
this.PrjRefs = new Array();
this.PrjDeps = new Array();
}
ProjectDef.prototype.clone = projectCloneDef;
ProjectDef.prototype.createVCProject = projectCreateVCProject;
ProjectDef.prototype.createProjectDefsFromFolder = projectCreateProjectDefsFromFolder;
ProjectDef.prototype.createLocaleDefs = projectCreateLocaleDefs;
ProjectDef.prototype.createTestLocaleDefs = projectCreateTestLocaleDefs;
ProjectDef.prototype.createTestLocalesDef = projectCreateTestLocalesDef;
// returns copy of ProjectDef object
function projectCloneDef()
{
var clone = new ProjectDef(this.Name, this.Type);
clone.SubSystem = this.SubSystem;
clone.RTTI = this.RTTI;
clone.VCProjDir = this.VCProjDir;
clone.FilterDefs = this.FilterDefs.concat(new Array());
clone.Defines = this.Defines;
clone.Includes = this.Includes;
clone.PrepOpts = this.PrepOpts;
clone.CppOpts = this.CppOpts;
clone.LnkOpts = this.LnkOpts;
clone.LibOpts = this.LibOpts;
clone.OutDir = this.OutDir;
clone.IntDir = this.IntDir;
clone.Libs = this.Libs;
clone.OutFile = this.OutFile;
clone.CustomBuildFile = this.CustomBuildFile;
clone.CustomBuildDesc = this.CustomBuildDesc;
clone.CustomBuildCmd = this.CustomBuildCmd;
clone.CustomBuildOut = this.CustomBuildOut;
clone.CustomBuildDeps = this.CustomBuildDeps;
clone.PreLinkDesc = this.PreLinkDesc;
clone.PreLinkCmd = this.PreLinkCmd;
clone.PreBuildDesc = this.PreBuildDesc;
clone.PreBuildCmd = this.PreBuildCmd;
clone.PostBuildDesc = this.PostBuildDesc;
clone.PostBuildCmd = this.PostBuildCmd;
clone.VSProject = this.VSProject;
clone.PrjRefs = this.PrjRefs.concat(new Array());
clone.PrjDeps = this.PrjDeps.concat(new Array());
return clone;
}
// preprocess defines using info about selected configuration
// defines - string with compiler defines, separated by ';'
// the define syntax can contain ?: construction
// supported conditions: debug, dll, mt
// i.e. "debug?_RWSTD_DEBUG:_RWSTD_RELEASE"
// will be replaced to "_RWSTD_DEBUG" in debug configurations
// and to "_RWSTD_RELEASE" in non-debug configurations
// confInfo - configuration info object
function processDefines(defines, confInfo)
{
var arr = defines.split(";");
var res = new Array();
for (var i = 0; i < arr.length; ++i)
{
var str = arr[i];
var pos1 = str.indexOf("?");
if (pos1 > 0)
{
var pos2 = str.indexOf(":", pos1 + 1);
if (pos2 < 0)
pos2 = str.length;
var s1 = str.substring(0, pos1);
var s2 = str.substring(pos1 + 1, pos2);
var s3 = pos2 < str.length ? str.substr(pos2 + 1) : "";
switch (s1)
{
case "debug":
str = confInfo.debug ? s2 : s3;
break;
case "dll":
str = confInfo.dll ? s2 : s3;
break;
case "mt":
str = confInfo.mt ? s2 : s3;
break;
}
}
if (str.length > 0)
res.push(str);
}
return res.join(";");
}
// returns string with list of files in VCFiles of VCFilters collection
// files - source VCFiles or VCFilters collection
// delim - delimiter
function combFiles(files, delim)
{
var ret = "";
for (var i = 1; i <= files.Count; ++i)
{
if (ret != "")
ret += delim;
ret += files.Item(i).RelativePath;
}
return ret;
}
// returns string with list of files in VCFilter object
// filter - source VCFilter object
// delim - delimiter
function combFilter(filter, delim)
{
var ret = combFiles(filter.Files, delim);
if (ret != "")
ret += delim;
ret += combFilters(filter.Filters, delim);
return ret;
}
// returns string with list of files in VCFilters collection
// filters - VCFilters collection
// delim - delimiter
function combFilters(filters, delim)
{
var ret = "";
for (var i = 1; i <= filters.Count; ++i)
{
if (ret != "")
ret += delim;
ret += combFilter(filters.Item(i), delim);
}
return ret;
}
// assign value to a property if it's exists
function setProperty(property, value)
{
if ("undefined" != typeof(property))
{
property = value;
return true;
}
return false;
}
// create VCProject object from ProjectDef
// engine - VCProjectEngine object
// report - callback function to report progress
function projectCreateVCProject(engine, report)
{
if (typeof(report) != "undefined" && null != report)
report(" Creating " + this.Name + "...");
var PrjName = removeLeadingDot(this.Name);
var prjMacros = cmnMacros.concat();
prjMacros.push(new Macro("%PRJNAME%", PrjName));
var VCProject = engine.CreateProject(this.Name);
VCProject.Name = this.Name;
var PrjDir = ReplaceMacros(this.VCProjDir, prjMacros);
var PrjFile = PrjDir + "\\" + PrjName + ".vcproj";
VCProject.ProjectFile = PrjFile;
VCProject.ProjectGUID = createUUID();
VCProject.AddPlatform(PLATFORM);
var FixedPrjName = PrjName;
var dotObj = ".obj";
var VC7xWknd = 0 <= PrjName.indexOf(dotObj)
&& ("7" == VERSION || "7.1" == VERSION);
var PostBuildCmd = this.PostBuildCmd;
if (VC7xWknd)
{
FixedPrjName = FixedPrjName.replace(new RegExp(dotObj, "ig"), "_obj");
if (null != PostBuildCmd)
PostBuildCmd += "\r\n";
else
PostBuildCmd = "";
var srcDir = "$(OutDir)\\" + FixedPrjName;
var dstDir = "$(OutDir)\\" + PrjName;
PostBuildCmd += "md \"" + dstDir + "\"\r\n" +
"copy \"" + srcDir + "\\" + FixedPrjName + dotObj + "\" \"" + dstDir + "\\" + PrjName + dotObj + "\"\r\n" +
"copy \"" + srcDir + "\\buildlog.htm\" \"" + dstDir + "\"";
}
for (var i = 0; i < confNames.length; ++i)
VCProject.AddConfiguration(confNames[i]);
var OutDir = this.OutDir != null ?
ReplaceMacros(this.OutDir, prjMacros) : "%CONFIG%";
var IntDir = this.IntDir != null ?
ReplaceMacros(this.IntDir, prjMacros) : OutDir + "\\" + FixedPrjName;
// add files
for (var i = 0; i < this.FilterDefs.length; ++i)
this.FilterDefs[i].createVCFilter(VCProject);
prjMacros.push(new Macro("%FILES%", combFiles(VCProject.Files, ";")));
var VCCustomFile = null;
if (null != this.CustomBuildFile)
VCCustomFile = VCProject.Files(this.CustomBuildFile);
// set common configuration settings
for (var i = 1; i <= VCProject.Configurations.Count; ++i)
{
var conf = VCProject.Configurations.Item(i);
var confInfo = configs.get(conf.ConfigurationName);
var cfgMacros = new Array(
new Macro("%CONFIG%", confInfo.out),
new Macro("%CFGNAME%", conf.ConfigurationName));
conf.CharacterSet = charSetMBCS;
conf.IntermediateDirectory = ReplaceMacros(IntDir, cfgMacros);
conf.OutputDirectory = ReplaceMacros(OutDir, cfgMacros);
conf.ConfigurationType = (typeLibrary != this.Type) ?
this.Type :
(confInfo.dll ? typeDynamicLibrary : typeStaticLibrary);
var ext = "";
switch (conf.ConfigurationType)
{
case typeApplication:
ext = ".exe";
break;
case typeDynamicLibrary:
ext = ".dll";
break;
case typeStaticLibrary:
ext = ".lib";
break;
}
cfgMacros.push(new Macro("%EXT%", ext));
var allMacros = prjMacros.concat(cfgMacros);
var OutFile = this.OutFile != null ?
ReplaceMacros(this.OutFile, allMacros) :
"$(OutDir)\\" + PrjName + ext;
var IngoreLibs = "";
if (confInfo.dll)
{
IngoreLibs = confInfo.debug ? "msvcprtd.lib" : "msvcprt.lib";
}
else
{
if (confInfo.mt || NOSTCRT)
IngoreLibs = confInfo.debug ? "libcpmtd.lib" : "libcpmt.lib";
else
IngoreLibs = confInfo.debug ? "libcpd.lib" : "libcp.lib";
}
var compiler = conf.Tools.Item("VCCLCompilerTool");
if (null != compiler)
{
if (null != this.Includes)
compiler.AdditionalIncludeDirectories =
ReplaceMacros(this.Includes, allMacros);
compiler.AdditionalOptions = CPPFLAGS + " " +
(null != this.CppOpts ? this.CppOpts : "");
if (null != this.PrepOpts)
compiler.GeneratePreprocessedFile = this.PrepOpts;
compiler.DebugInformationFormat = debugEnabled;
if (typeStaticLibrary == conf.ConfigurationType)
{
// generate the source pdb in the OutDir
compiler.ProgramDataBaseFileName = changeFileExt(OutFile, "pdb");
}
compiler.SuppressStartupBanner = true;
compiler.WarningLevel = warningLevel_3;
setProperty(compiler.Detect64BitPortabilityProblems, false);
if (null != this.Defines)
compiler.PreprocessorDefinitions = processDefines(this.Defines, confInfo);
if (confInfo.debug)
{
compiler.Optimization = optimizeDisabled;
compiler.MinimalRebuild = true;
//setProperty(compiler.SmallerTypeCheck, true);
setProperty(compiler.BasicRuntimeChecks, runtimeBasicCheckAll);
compiler.BufferSecurityCheck = true;
}
else
{
if (typeApplication == conf.ConfigurationType)
{
if (!setProperty(compiler.OptimizeForWindowsApplication, true))
compiler.AdditionalOptions += " /GA";
}
compiler.Optimization = optimizeMaxSpeed;
compiler.MinimalRebuild = false;
setProperty(compiler.SmallerTypeCheck, false);
setProperty(compiler.BasicRuntimeChecks, runtimeBasicCheckNone);
compiler.BufferSecurityCheck = false;
}
compiler.ExceptionHandling = cppExceptionHandlingYes;
compiler.RuntimeTypeInfo = this.RTTI;
if (confInfo.dll)
{
// the singlethreaded dll runtimes are not present
// always use the multithreaded dll runtime
compiler.RuntimeLibrary = confInfo.debug ?
rtMultiThreadedDebugDLL : rtMultiThreadedDLL;
}
else
{
if (confInfo.mt || NOSTCRT)
// use multithreaded runtimes
compiler.RuntimeLibrary = confInfo.debug ?
rtMultiThreadedDebug : rtMultiThreaded;
else
// use singlethreaded runtimes
compiler.RuntimeLibrary = confInfo.debug ?
rtSingleThreadedDebug : rtSingleThreaded;
}
compiler.UsePrecompiledHeader = pchNone;
if (VC7xWknd)
compiler.ObjectFile = "$(IntDir)/" + FixedPrjName + dotObj;
}
var linker = conf.Tools.Item("VCLinkerTool");
if (null != linker)
{
linker.AdditionalOptions = LDFLAGS + " " +
(null != this.LnkOpts ? this.LnkOpts : "");
if (null != this.Libs)
linker.AdditionalDependencies = this.Libs;
linker.LinkIncremental = linkIncrementalNo;
linker.SuppressStartupBanner = true;
linker.GenerateDebugInformation = true;
linker.ProgramDatabaseFile = changeFileExt(OutFile, "pdb");
linker.IgnoreDefaultLibraryNames = IngoreLibs;
linker.SubSystem = this.SubSystem;
if (confInfo.debug)
{
linker.OptimizeReferences = optReferencesDefault;
linker.EnableCOMDATFolding = optFoldingDefault;
}
else
{
linker.OptimizeReferences = optReferences;
linker.EnableCOMDATFolding = optFolding;
}
linker.OutputFile = OutFile;
if (this.Type != typeApplication)
linker.ImportLibrary = changeFileExt(linker.OutputFile, "lib");
}
var librarian = conf.Tools.Item("VCLibrarianTool");
if (null != librarian)
{
if (null != this.LibOpts)
linker.AdditionalOptions = this.LibOpts;
librarian.SuppressStartupBanner = true;
librarian.IgnoreDefaultLibraryNames = IngoreLibs;
librarian.OutputFile = OutFile;
}
if (null != this.PreLinkCmd)
{
var tool = conf.Tools.Item("VCPreLinkEventTool");
tool.CommandLine = ReplaceMacros(this.PreLinkCmd, allMacros);
if (null != this.PreLinkDesc)
tool.Description = ReplaceMacros(this.PreLinkDesc, allMacros);
}
if (null != this.PreBuildCmd)
{
var tool = conf.Tools.Item("VCPreBuildEventTool");
tool.CommandLine = ReplaceMacros(this.PreBuildCmd, allMacros);
if (null != this.PreBuildDesc)
tool.Description = ReplaceMacros(this.PreBuildDesc, allMacros);
}
if (null != PostBuildCmd)
{
var tool = conf.Tools.Item("VCPostBuildEventTool");
tool.CommandLine = ReplaceMacros(PostBuildCmd, allMacros);
if (null != this.PostBuildDesc)
tool.Description = ReplaceMacros(this.PostBuildDesc, allMacros);
}
if (null != this.CustomBuildCmd)
{
var tool = (null == VCCustomFile) ? conf.Tools.Item("VCCustomBuildTool") :
VCCustomFile.FileConfigurations.Item(conf.ConfigurationName).Tool;
var cmd = ReplaceMacros(this.CustomBuildCmd, allMacros);
if (null != VCCustomFile)
cmd = cmd.replace(/(%CUSTOMFILE%)/g, VCCustomFile.FullPath);
tool.CommandLine = cmd;
tool.Outputs = null != this.CustomBuildOut ?
ReplaceMacros(this.CustomBuildOut, allMacros) : "";
if (null != this.PostBuildDesc)
tool.Description = ReplaceMacros(this.CustomBuildDesc, allMacros);
if (null != this.CustomBuildDeps)
tool.AdditionalDependencies = ReplaceMacros(this.CustomBuildDeps, allMacros);
}
}
if (!fso.FolderExists(PrjDir))
fso.CreateFolder(PrjDir);
VCProject.Save();
this.VSProject = VCProject;
}
// create array of ProjectDef objects (one object for each file)
// startDir - start folder
// inclFiles - regular expression to define include files
// exclDirs - regular expression to define exclude folder
// exclFiles - regular expression to define exclude files
// shiftOutDir - if true then add subfolder name to the OutDir path
function projectCreateProjectDefsFromFolder(startDir,
inclFiles, exclDirs, exclFiles, shiftOutDir)
{
var projectDefs = new Array();
var folder = fso.GetFolder(ReplaceMacros(startDir, cmnMacros));
var enumSubFolders = new Enumerator(folder.SubFolders);
for (; !enumSubFolders.atEnd(); enumSubFolders.moveNext())
{
var subFolder = enumSubFolders.item();
if (exclDirs.test(subFolder.Name))
{
// skip excluded folder
continue;
}
var newDefs = this.createProjectDefsFromFolder(subFolder.Path,
inclFiles, exclDirs, exclFiles, shiftOutDir);
if (shiftOutDir)
{
for (var i = 0; i < newDefs.length; ++i)
newDefs[i].OutDir += "\\" + subFolder.Name;
}
projectDefs = projectDefs.concat(newDefs);
}
var enumFiles = new Enumerator(folder.Files);
for (; !enumFiles.atEnd(); enumFiles.moveNext())
{
var file = enumFiles.item();
if (inclFiles.test(file.Name))
{
if (exclFiles.test(file.Name)) // we should exclude this file
continue;
var lastPoint = file.Name.lastIndexOf(".");
var prjName = file.Name.substr(0, lastPoint);
var projectDef = this.clone();
projectDef.Name = prjName;
projectDef.FilterDefs.push(
new FilterDef(sourceFilterName, sourceFilterUuid,
"cpp;c;cxx;s;cc", eFileTypeCppCode, false).
addFiles(null, new Array(file.Path)));
projectDefs.push(projectDef);
}
}
return projectDefs;
}
//------------------------------------------------
// Locale class
//------------------------------------------------
// Locale .ctor
function Locale(name, cmname, srcname)
{
this.Name = name;
this.cmName = cmname;
this.srcName = srcname;
}
// returns array of Locale objects parsing the gen_list file
// nlsDir - folder containing file "gen_list"
function initLocalesList(nlsDir)
{
var listFileName = nlsDir + "\\gen_list";
if (!fso.FileExists(listFileName))
{
WScript.StdErr.WriteLine("Generate: Fatal error: "
+ "File "+ listFileName + " does not exist");
WScript.Quit(3);
}
var ForReading = 1;
var stream = fso.OpenTextFile(listFileName, ForReading);
if (!stream)
{
WScript.StdErr.WriteLine("Generate: Fatal error: "
+ "Cannot open file "+ listFileName);
WScript.Quit(3);
}
var arrLocales = new Array();
while (!stream.AtEndOfStream)
{
var line = stream.ReadLine();
var name = line.replace(new RegExp("^\([^ ]*\) *\([^ ]*\)"),
"$1\.$2")
.replace(new RegExp("\([^.]*\)\(.euro\)\([^ ]*\)"),
"$1$3@euro")
.replace(new RegExp("\([^.]*\)\(.cyrillic\)\([^ ]*\)"),
"$1$3@cyrillic");
var pos = name.indexOf(" ");
if (0 <= pos)
name = name.substr(0, pos);
var srcname = name.replace(new RegExp("\([^.]*\)\.\([^@]*\)\(.*\)"),
"$1$3")
.replace("@", ".");
var cmname = name.replace(new RegExp("\([^.]*\)\.\([^@]*\)\(.*\)"),
"$2");
arrLocales.push(new Locale(name, cmname, srcname));
}
return arrLocales;
}
// create array of ProjectDef objects for build locales
// (one object for each locale)
// nlsDir - folder containing locale source files
function projectCreateLocaleDefs(nlsDir)
{
nlsDir = ReplaceMacros(nlsDir, cmnMacros);
if (typeof(this.arrLocales) == "undefined")
ProjectDef.prototype.arrLocales = initLocalesList(nlsDir);
var projectDefs = new Array();
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);
}
var projectDef = this.clone();
projectDef.Name = locale.Name;
projectDef.FilterDefs.push(
new FilterDef("Charmap", null, "cm", eFileTypeText, false).
addFiles(null, new Array(cmFile.Path)));
projectDef.FilterDefs.push(
new FilterDef("Src", null, "", eFileTypeText, false).
addFiles(null, new Array(srcFile.Path)));
projectDef.CustomBuildCmd =
"set PATH=$(SolutionDir)%CONFIG%\\lib;%PATH%\r\n" +
"\"$(SolutionDir)%CONFIG%\\bin\\localedef.exe\" -w -c" +
" -f \"" + cmFileName + "\"" + " -i \"" + srcFileName + "\"" +
" \"$(OutDir)\\" + locale.Name + "\"";
projectDef.CustomBuildOut = "$(OutDir)\\" + locale.Name;
projectDefs.push(projectDef);
}
return projectDefs;
}
// create array of ProjectDef objects for test locales
// (one object for each locale)
// nlsDir - folder containing locale source files
function projectCreateTestLocaleDefs(nlsDir)
{
nlsDir = ReplaceMacros(nlsDir, cmnMacros);
if (typeof(this.arrLocales) == "undefined")
ProjectDef.prototype.arrLocales = initLocalesList(nlsDir);
var projectDefs = new Array();
var srcdir = "%SRCDIR%\\etc\\config\\windows";
var bindir = "$(SolutionDir)%CONFIG%\\bin";
var exec = bindir + "\\exec.exe";
var test = bindir + "\\sanity_test";
var setPath = "set PATH=$(SolutionDir)%CONFIG%\\lib;%PATH%";
// create test_locale_sanity project
var sanityDef = this.clone();
sanityDef.Name = "test_locale_sanity";
if (null == sanityDef.PreBuildCmd)
sanityDef.PreBuildCmd = "";
else
sanityDef.PreBuildCmd += "\r\n";
sanityDef.PreBuildCmd +=
"echo cscript /nologo \"" + srcdir + "\\run_locale_utils.wsf\"" +
" /s /b:\"" + bindir + "\" > \"" + test + ".bat\"";
sanityDef.CustomBuildCmd = setPath + "\r\n\"" + exec + "\" -t " + EXEC_TIMEOUT + " \"" + test + ".bat\"";
sanityDef.CustomBuildOut = test + ".out";
projectDefs.push(sanityDef);
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);
}
test = bindir + "\\" + locale.Name;
var projectDef = this.clone();
projectDef.Name = "test_" + locale.Name;
projectDef.FilterDefs.push(
new FilterDef("Charmap", null, "cm", eFileTypeText, false).
addFiles(null, new Array(cmFile.Path)));
projectDef.FilterDefs.push(
new FilterDef("Src", null, "", eFileTypeText, false).
addFiles(null, new Array(srcFile.Path)));
if (null == projectDef.PreBuildCmd)
projectDef.PreBuildCmd = "";
else
projectDef.PreBuildCmd += "\r\n";
projectDef.PreBuildCmd +=
"echo cscript /nologo \"" + srcdir + "\\run_locale_utils.wsf\"" +
" /f /b:\"" + bindir + "\" /i:\"" + nlsDir + "\"" +
" /l:" + locale.Name + " > \"" + test + ".bat\"";
projectDef.CustomBuildCmd = setPath + "\r\n\"" + exec + "\" -t " + EXEC_TIMEOUT + " \"" + test + ".bat\"";
projectDef.CustomBuildOut = test + ".out";
projectDef.PrjDeps.push(sanityDef);
projectDefs.push(projectDef);
}
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 bindir = "$(SolutionDir)%CONFIG%\\bin";
var test = "sanity_test";
// create test_locale_sanity project
var projectDef = this.clone();
if (null == projectDef.PreBuildCmd)
{
projectDef.PreBuildCmd =
"set soldir=%BUILDDIR%\r\n" +
"set bindir=%soldir%\\%CONFIG%\\bin";
}
projectDef.PreBuildCmd += "\r\n" +
"set etcdir=%SRCDIR%\\etc\r\n" +
"set util=\"%etcdir%\\config\\windows\\run_locale_utils.wsf\"\r\n";
projectDef.PreBuildCmd +=
"echo cscript /nologo %util% /s /b:\"%bindir%\" > \"%bindir%\\" + test + ".bat\"";
var arrLocs = new Array();
var locales = "";
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);
}
if (locales.length + locale.Name.length > 1012)
{
arrLocs.push(locales);
locales = "";
}
else
{
if (0 < locales.length)
locales += " ";
locales += locale.Name;
}
}
if (0 < locales.length)
arrLocs.push(locales);
for (var i = 0; i < arrLocs.length; ++i)
{
projectDef.PreBuildCmd += "\r\nset locales=" + arrLocs[i] + "\r\n" +
"for %%l in (%locales%) do " +
"echo cscript /nologo %util% /f /b:\"%bindir%\" " +
"/i:\"%etcdir%\\nls\" /l:%%l > \"%bindir%\\%%l.bat\"";
}
return projectDef;
}

View File

@@ -0,0 +1,558 @@
//
// $Id: projects.js 590167 2007-10-30 17:29:56Z faridz $
//
// projects.js - Definitions of the solution projects
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
var commonDefines = "debug?_RWSTDDEBUG;dll?_RWSHARED";
var commonIncludes = "$(SolutionDir)%CONFIG%\\include";
var stdcxxIncludes = "%SRCDIR%\\include;%SRCDIR%\\include\\ansi;" + commonIncludes;
var rwtestIncludes = "%SRCDIR%\\tests\\include;" + stdcxxIncludes;
var binPath = "$(SolutionDir)%CONFIG%\\bin";
var libPath = "$(SolutionDir)%CONFIG%\\lib";
var ProjectsDir = "%BUILDDIR%\\Projects";
// projects which requires RTTI support
var NonRTTIProjects = new Array();
var rxExcludedFolders =
new RegExp("^(?:\\.svn|Release.*|Debug.*|in|out|CVS)$","i");
// fill and return array of ProjectDef objects
// with definitions of the solution projects
// copyDll - if true then libstd and rwtest dlls will be copied
// to the target folder after build
// buildLocales - if true then generate projects for build locales
// testLocales - if true then generate projects for test locales
function CreateProjectsDefs(copyDll, buildLocales, testLocales)
{
var projectDefs = new Array();
///////////////////////////////////////////////////////////////////////////////
var configureDef = new ProjectDef(".configure", typeGeneric);
configureDef.VCProjDir = ProjectsDir;
configureDef.FilterDefs.push(
new FilterDef(sourceFilterName, sourceFilterUuid, ".cpp;.c;.cxx;.s;.cc", eFileTypeCppCode, false).
addFilesByMask("%SRCDIR%\\etc\\config\\src", rxExcludedFolders, null));
configureDef.FilterDefs.push(
new FilterDef(headerFilterName, headerFilterUuid, ".h;.hpp;.hxx", eFileTypeCppHeader, false).
addFilesByMask("%SRCDIR%\\etc\\config\\src", rxExcludedFolders, null));
configureDef.FilterDefs.push(
new FilterDef("Script Files", null, ".js;.wsf", eFileTypeScript, false).
addFiles("%SRCDIR%\\etc\\config\\windows",
new Array("configure.wsf", "config.js", "data.js", "utilities.js")));
configureDef.OutDir = commonIncludes;
configureDef.IntDir = configureDef.OutDir;
configureDef.CustomBuildFile = "configure.wsf";
if (0 < CLVARSBAT.length)
configureDef.CustomBuildCmd = "echo Calling \"" + CLVARSBAT + "\"\r\n" +
"call \"" + CLVARSBAT + "\"\r\n";
else
configureDef.CustomBuildCmd = "";
configureDef.CustomBuildCmd += "cscript /nologo \"%CUSTOMFILE%\"" +
" /SolutionName:\"%SOLUTION%\"" +
" /ConfigurationName:\"%CFGNAME%\"" +
" /SrcDir:\"%SRCDIR%\\etc\\config\\src\"" +
" /OutDir:\"$(OutDir)\"" +
" /OutFile:\"$(OutDir)\\config.h\"" +
" /LogFile:\"$(OutDir)\\config.log\"";
configureDef.CustomBuildOut = "$(OutDir)\\config.h";
configureDef.CustomBuildDeps = "%FILES%";
projectDefs.push(new Array(configureDef));
///////////////////////////////////////////////////////////////////////////////
var stdcxxDef = new ProjectDef(".stdcxx", typeLibrary);
stdcxxDef.VCProjDir = ProjectsDir;
stdcxxDef.FilterDefs.push(
new FilterDef(sourceFilterName, sourceFilterUuid, sourceFilterExts + ";.inc", eFileTypeCppCode, false).
addFilesByMask("%SRCDIR%\\src", rxExcludedFolders, null));
stdcxxDef.FilterDefs.push(
new FilterDef(headerFilterName, headerFilterUuid, headerFilterExts, eFileTypeCppHeader, true).
addFilesByMask("%SRCDIR%\\src", rxExcludedFolders, null).
addFilter(new FilterDef("Include", headerFilterUuid, headerFilterExts + ";.", eFileTypeCppHeader, true).
addFilesByMask("%SRCDIR%\\include", rxExcludedFolders, null)));
stdcxxDef.Defines = commonDefines;
stdcxxDef.Includes = stdcxxIncludes;
stdcxxDef.OutDir = libPath;
stdcxxDef.IntDir = "$(SolutionDir)%CONFIG%\\src";
stdcxxDef.Libs = LIBS;
stdcxxDef.OutFile = "$(OutDir)\\libstd%CONFIG%%EXT%";
stdcxxDef.PrjDeps.push(configureDef);
projectDefs.push(new Array(stdcxxDef));
///////////////////////////////////////////////////////////////////////////////
var rwtestDef = new ProjectDef(".rwtest", typeLibrary);
rwtestDef.VCProjDir = ProjectsDir;
rwtestDef.FilterDefs.push(
new FilterDef(sourceFilterName, sourceFilterUuid, sourceFilterExts, eFileTypeCppCode, false).
addFilesByMask("%SRCDIR%\\tests\\src", rxExcludedFolders, null));
rwtestDef.FilterDefs.push(
new FilterDef(headerFilterName, headerFilterUuid, headerFilterExts, eFileTypeCppHeader, true).
addFilesByMask("%SRCDIR%\\tests\\src", rxExcludedFolders, null).
addFilter(new FilterDef("Include", headerFilterUuid, headerFilterExts, eFileTypeCppHeader, true).
addFilesByMask("%SRCDIR%\\tests\\include", rxExcludedFolders, null)));
rwtestDef.Defines = commonDefines;
rwtestDef.Includes = rwtestIncludes;
rwtestDef.OutDir = "$(SolutionDir)%CONFIG%\\tests";
rwtestDef.IntDir = rwtestDef.OutDir + "\\src";
rwtestDef.Libs = LIBS;
rwtestDef.PrjRefs.push(stdcxxDef);
projectDefs.push(new Array(rwtestDef));
///////////////////////////////////////////////////////////////////////////////
var utilsArray = new Array();
var execDef = new ProjectDef("util_exec", typeApplication);
execDef.VCProjDir = ProjectsDir + "\\util";
execDef.FilterDefs.push(
new FilterDef(sourceFilterName, sourceFilterUuid, sourceFilterExts, eFileTypeCppCode, false).
addFiles("%SRCDIR%\\util",
new Array("cmdopt.cpp", "display.cpp", "exec.cpp", "output.cpp", "runall.cpp", "util.cpp")));
execDef.FilterDefs.push(
new FilterDef(headerFilterName, headerFilterUuid, headerFilterExts, eFileTypeCppHeader, true).
addFiles("%SRCDIR%\\util",
new Array("cmdopt.h", "display.h", "exec.h", "output.h", "target.h", "util.h")));
execDef.Defines = "";
execDef.Includes = commonIncludes;
execDef.OutDir = binPath;
execDef.Libs = LIBS;
execDef.OutFile = "$(OutDir)\\exec.exe";
execDef.PrjDeps.push(configureDef);
utilsArray.push(execDef);
///////////////////////////////////////////////////////////////////////////////
var localedefDef = new ProjectDef("util_localedef", typeApplication);
localedefDef.VCProjDir = ProjectsDir + "\\util";
localedefDef.FilterDefs.push(
new FilterDef(sourceFilterName, sourceFilterUuid, sourceFilterExts, eFileTypeCppCode, false).
addFiles("%SRCDIR%\\util",
new Array("aliases.cpp", "charmap.cpp", "codecvt.cpp",
"collate.cpp", "ctype.cpp", "def.cpp",
"diagnostic.cpp", "locale.cpp", "localedef.cpp",
"memchk.cpp", "messages.cpp", "monetary.cpp",
"numeric.cpp", "path.cpp", "scanner.cpp",
"time.cpp")));
localedefDef.FilterDefs.push(
new FilterDef(headerFilterName, headerFilterUuid, headerFilterExts, eFileTypeCppHeader, true).
addFiles("%SRCDIR%\\util",
new Array("aliases.h", "charmap.h", "def.h", "diagnostic.h",
"loc_exception.h", "localedef.h", "memchk.h",
"path.h", "scanner.h")));
localedefDef.Defines = commonDefines;
localedefDef.Includes = stdcxxIncludes;
localedefDef.OutDir = binPath;
localedefDef.Libs = LIBS;
localedefDef.OutFile = "$(OutDir)\\localedef.exe";
localedefDef.PrjRefs.push(stdcxxDef);
utilsArray.push(localedefDef);
///////////////////////////////////////////////////////////////////////////////
var localeDef = new ProjectDef("util_locale", typeApplication);
localeDef.VCProjDir = ProjectsDir + "\\util";
localeDef.FilterDefs.push(
new FilterDef(sourceFilterName, sourceFilterUuid, sourceFilterExts, eFileTypeCppCode, false).
addFiles("%SRCDIR%\\util",
new Array("locale_stub.cpp")));
localeDef.Defines = commonDefines;
localeDef.Includes = stdcxxIncludes;
localeDef.OutDir = binPath;
localeDef.Libs = LIBS;
localeDef.OutFile = "$(OutDir)\\locale.exe";
localeDef.PrjDeps.push(configureDef);
utilsArray.push(localeDef);
///////////////////////////////////////////////////////////////////////////////
var gencatDef = new ProjectDef("util_gencat", typeApplication);
gencatDef.VCProjDir = ProjectsDir + "\\util";
gencatDef.FilterDefs.push(
new FilterDef(sourceFilterName, sourceFilterUuid, sourceFilterExts, eFileTypeCppCode, false).
addFiles("%SRCDIR%\\util",
new Array("gencat.cpp")));
gencatDef.Defines = commonDefines;
gencatDef.Includes = stdcxxIncludes;
gencatDef.OutDir = binPath;
gencatDef.Libs = LIBS;
gencatDef.OutFile = "$(OutDir)\\gencat.exe";
gencatDef.PrjRefs.push(stdcxxDef);
utilsArray.push(gencatDef);
///////////////////////////////////////////////////////////////////////////////
var utilsDef = new ProjectDef(".stdcxx_utils", typeGeneric);
utilsDef.VCProjDir = ProjectsDir + "\\util";
utilsDef.OutDir = binPath;
utilsDef.IntDir = utilsDef.OutDir;
utilsDef.PrjDeps.push(execDef);
utilsDef.PrjDeps.push(localedefDef);
utilsDef.PrjDeps.push(localeDef);
utilsDef.PrjDeps.push(gencatDef);
utilsArray.push(utilsDef);
projectDefs.push(utilsArray);
///////////////////////////////////////////////////////////////////////////////
var exampleArray = new Array();
var exampleTplDef = new ProjectDef(null, typeApplication);
exampleTplDef.VCProjDir = ProjectsDir + "\\examples";
exampleTplDef.Defines = commonDefines;
exampleTplDef.Includes = "%SRCDIR%\\examples\\include;" + stdcxxIncludes;
exampleTplDef.OutDir = "$(SolutionDir)%CONFIG%\\examples";
exampleTplDef.Libs = LIBS;
exampleTplDef.PrjRefs.push(stdcxxDef);
var exampleDefs = exampleTplDef.createProjectDefsFromFolder(
"%SRCDIR%\\examples",
new RegExp("^.+\\.(?:cpp)$", "i"),
new RegExp("^(?:\\.svn|Release.*|Debug.*|in|out|CVS)$", "i"),
new RegExp("^(?:rwstdmessages.cpp)$", "i"), false);
exampleArray = exampleArray.concat(exampleDefs);
///////////////////////////////////////////////////////////////////////////////
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).
addFiles("%SRCDIR%\\etc\\config\\windows",
new Array("runall.wsf", "config.js", "utilities.js",
"summary.js")));
runexamplesDef.OutDir = "$(SolutionDir)%CONFIG%\\examples";
runexamplesDef.IntDir = runexamplesDef.OutDir;
runexamplesDef.PreBuildCmd =
"if exist \"$(OutDir)\\summary.htm del\" \"$(OutDir)\\summary.htm\"\r\n" +
"if exist \"$(OutDir)\\runexamples.log\" del \"$(OutDir)\\runexamples.log\"";
runexamplesDef.CustomBuildFile = "runall.wsf";
runexamplesDef.CustomBuildCmd =
"set PATH=$(SolutionDir)%CONFIG%\\bin;$(SolutionDir)%CONFIG%\\lib;" +
"%SRCDIR%\\examples\\manual;%PATH%\r\n" +
"set TZ=MST+7\r\n" +
"cscript /nologo \"%CUSTOMFILE%\"" +
" /INOUTDIR:\"%SRCDIR%\\examples\"" +
" /EXEDIR:\"$(OutDir)\"" +
" /PRJDIR:\"" + runexamplesDef.VCProjDir + "\"" +
" /CONFIG:\"%SOLUTION%\"" +
" /LOGFILE:\"runexamples.log\"" +
" /RUNFLAGS:\"-t " + EXEC_TIMEOUT + "\"";
runexamplesDef.CustomBuildOut = "$(OutDir)\\runexamples.log";
runexamplesDef.CustomBuildDeps = "%FILES%";
//runexamplesDef.PrjDeps.push(allexamplesDef);
runexamplesDef.PrjDeps.push(execDef);
projectDefs.push(new Array(runexamplesDef));
///////////////////////////////////////////////////////////////////////////////
var testArray = new Array();
var testTplDef = new ProjectDef(null, typeApplication);
testTplDef.VCProjDir = ProjectsDir + "\\tests";
testTplDef.Defines = commonDefines;
testTplDef.Includes = rwtestIncludes;
testTplDef.OutDir = "$(SolutionDir)%CONFIG%\\tests";
testTplDef.Libs = LIBS;
testTplDef.PrjRefs.push(stdcxxDef);
testTplDef.PrjRefs.push(rwtestDef);
var testDefs = testTplDef.createProjectDefsFromFolder(
"%SRCDIR%\\tests",
new RegExp("^.+\\.(?:cpp)$", "i"),
new RegExp("^(?:\\.svn|Release.*|Debug.*|in|out|CVS|src|include)$","i"),
new RegExp("^(?:rwstdmessages.cpp)$","i"), false);
testArray = testArray.concat(testDefs);
///////////////////////////////////////////////////////////////////////////////
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).
addFiles("%SRCDIR%\\etc\\config\\windows",
new Array("runall.wsf", "config.js", "utilities.js",
"summary.js")));
runtestsDef.OutDir = "$(SolutionDir)%CONFIG%\\tests";
runtestsDef.IntDir = runtestsDef.OutDir;
runtestsDef.PreBuildCmd =
"if exist \"$(OutDir)\\summary.htm\" del \"$(OutDir)\\summary.htm\"\r\n" +
"if exist \"$(OutDir)\\runtests.log\" del \"$(OutDir)\\runtests.log\"";
runtestsDef.CustomBuildFile = "runall.wsf";
runtestsDef.CustomBuildCmd =
"set PATH=$(SolutionDir)%CONFIG%\\bin;$(SolutionDir)%CONFIG%\\lib;%PATH%\r\n" +
"set TOPDIR=%SRCDIR%\r\n" +
"set BINDIR=$(SolutionDir)%CONFIG%\\bin\r\n" +
"cscript /nologo \"%CUSTOMFILE%\"" +
" /EXEDIR:\"$(OutDir)\"" +
" /PRJDIR:\"" + runtestsDef.VCProjDir + "\"" +
" /CONFIG:\"%SOLUTION%\"" +
" /LOGFILE:\"runtests.log\"" +
" /RUNFLAGS:\"--compat -x \'--compat -O -\' -t " + EXEC_TIMEOUT + "\"";
runtestsDef.CustomBuildOut = "$(OutDir)\\runtests.log";
runtestsDef.CustomBuildDeps = "%FILES%";
//runtestsDef.PrjDeps.push(alltestsDef);
runtestsDef.PrjDeps.push(utilsDef);
projectDefs.push(new Array(runtestsDef));
///////////////////////////////////////////////////////////////////////////////
var localeArray = new Array();
if (buildLocales)
{
var localeTplDef = new ProjectDef(null, typeGeneric);
localeTplDef.VCProjDir = ProjectsDir + "\\locales";
localeTplDef.FilterDefs.push(
new FilterDef("Script Files", null, "js;wsf", eFileTypeScript, false).
addFiles("%SRCDIR%\\etc\\config\\windows",
new Array("run_locale_utils.wsf")));
localeTplDef.OutDir = "$(SolutionDir)nls";
localeTplDef.IntDir = localeTplDef.OutDir + "\\Build\\$(ProjectName)";
localeTplDef.CustomBuildFile = "run_locale_utils.wsf";
localeTplDef.CustomBuildDeps = "%FILES%";
localeTplDef.PrjDeps.push(localedefDef);
var localeDefs = localeTplDef.createLocaleDefs("%SRCDIR%\\etc\\nls");
localeArray = localeArray.concat(localeDefs);
var localesDef = new ProjectDef(".stdcxx_locales", typeGeneric);
localesDef.VCProjDir = ProjectsDir + "\\locales";
localesDef.OutDir = "$(SolutionDir)nls";
localesDef.IntDir = localesDef.OutDir;
localesDef.PrjDeps = localeDefs;
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 = binPath;
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 (testLocales)
{
var testlocaleDefs = testlocaleTplDef.createTestLocaleDefs("%SRCDIR%\\etc\\nls");
testlocaleArray = testlocaleArray.concat(testlocaleDefs);
}
testlocaleTplDef.FilterDefs = new Array();
testlocaleTplDef.FilterDefs.push(
new FilterDef("Script Files", null, ".js;.wsf", eFileTypeScript, false).
addFiles("%SRCDIR%\\etc\\config\\windows",
new Array("runall.wsf", "config.js", "utilities.js",
"summary.js")));
testlocaleTplDef.CustomBuildFile = "runall.wsf";
testlocaleTplDef.CustomBuildCmd =
"set PATH=$(SolutionDir)%CONFIG%\\bin;$(SolutionDir)%CONFIG%\\lib;%PATH%\r\n" +
"cscript /nologo \"%CUSTOMFILE%\"" +
" /EXEDIR:\"$(OutDir)\"" +
" /CONFIG:\"%SOLUTION%\"" +
" /LOGFILE:\"runloctests.log\"" +
" /EXT:bat" +
" /RUNFLAGS:\"-t " + EXEC_TIMEOUT + "\"";
testlocaleTplDef.CustomBuildOut = "$(OutDir)\\runloctests.log";
var testlocalesDef = testlocaleTplDef.createTestLocalesDef("%SRCDIR%\\etc\\nls");
testlocaleArray.push(testlocalesDef);
projectDefs.push(testlocaleArray);
///////////////////////////////////////////////////////////////////////////////
if (copyDll)
{
// if project type is application and
// if it depends on stdcxx project then
// copy libstdxx.dll to project output directory
// if it depends on rwtest project then
// copy rwtest.dll to project output directory
for (var i = 0; i < projectDefs.length; ++i)
{
var projectArray = projectDefs[i];
for (var j = 0; j < projectArray.length; ++j)
{
var projectDef = projectArray[j];
if (projectDef.Type != typeApplication)
continue;
var arrDeps = projectDef.PrjRefs.concat(projectDef.PrjDeps);
var command = "";
var cmdtpl = "set src=_SRC_\r\n" +
"set dst=_DST_\r\n" +
"if /I not %src%==%dst% (\r\n" +
"if exist %src% (\r\n" +
"del %dst%\r\n" +
"copy /Y %src% %dst%\r\n" +
"))";
if (0 <= arrayIndexOf(arrDeps, stdcxxDef))
{
var libname = "libstd%CONFIG%.dll";
var src = "\"" + libPath + "\\" + libname + "\"";
var dst = "\"$(OutDir)\\" + libname + "\"";
var cmd = cmdtpl.replace("_SRC_", src).replace("_DST_", dst);
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 = cmdtpl.replace("_SRC_", src).replace("_DST_", dst);
if (0 == command.length)
command = cmd;
else
command += "\r\n" + cmd;
}
if (null == projectDef.PostBuildCmd || "" == projectDef.PostBuildCmd)
projectDef.PostBuildCmd = command;
else
projectDef.PostBuildCmd = command + "\r\n" + projectDef.PostBuildCmd;
}
}
}
return projectDefs;
}
// create VCProject's using ProjectDed definitions
// projectDefs - array with project definitions
// report - callback function to report progress
function CreateProjects(projectDefs, report)
{
for (var i = 0; i < projectDefs.length; ++i)
{
var projectArray = projectDefs[i];
for (var j = 0; j < projectArray.length; ++j)
{
var projectDef = projectArray[j];
// turn off RTTI support if project in NonRTTIProjects array
if (0 <= arrayIndexOf(NonRTTIProjects, projectDef.Name))
projectDef.RTTI = false;
projectDef.createVCProject(VCProjectEngine, report);
}
}
}
// configure dependencies between projects
// (insert <References> section to the .vcproj file)
// projectDefs - array with project definitions
function ConfigureDependencies(projectDefs)
{
for (var i = 0; i < projectDefs.length; ++i)
{
var projectArray = projectDefs[i];
for (var j = 0; j < projectArray.length; ++j)
{
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)
{
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();
}
}
}

View File

@@ -0,0 +1,731 @@
<?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="run_locale_utils" prompt="no">
<?job error="false" debug="false" ?>
<runtime>
<description>
Checks locale utilities:
1. Locale utilities sanity: location, output, etc;
2. Functionality:
- (re)generation of databases;
</description>
<named helpstring="Debug output" name="d"/>
<named helpstring="Perform sanity check" name="s"/>
<named helpstring="Perform functionality check" name="f"/>
<named helpstring="Path to the locale source files"
name="i" type="string"/>
<named helpstring="Locale name" name="l" type="string"/>
<named helpstring="Output file" name="O" type="string"/>
<example>cscript run_locale_utils.wsf /s /b:..\..\..\bin\11s"
</example>
<usage>
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>"
- "/l:@LocaleName>";
- "/b:@BinDir";
- "/O:@OutFile"
</usage>
</runtime>
<object id="fso" progid="Scripting.FileSystemObject"/>
<object id="WshShell" progid="WScript.Shell"/>
<script id="run_locale_utils" language="JScript">
<![CDATA[
//
// run_locale_utils script for Stdcxx library
//
var dbgout = false;
var chk_sanity = false;
var chk_func = false;
var nlsdir = "";
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;
var run_stdout;
var run_stderr;
var WEnv = WshShell.Environment("PROCESS");
// printf the message line to the stderr
function DebugOutLine(msg)
{
if (dbgout)
WScript.StdErr.WriteLine(msg);
}
// printf the message to the stderr
function DebugOut(msg)
{
if (dbgout)
WScript.StdErr.Write(msg);
}
// execute command and set run_stdout to the cmd stdout content;
// set run_stderr to the cmd stderr content
function Run(cmd)
{
var exec = WshShell.Exec(cmd);
run_stdout = "";
run_stderr = "";
while (0 == exec.Status) {
WScript.Sleep(100);
run_stdout += exec.StdOut.ReadAll();
run_stderr += exec.StdErr.ReadAll();
}
run_stdout += exec.StdOut.ReadAll();
run_stderr += exec.StdErr.ReadAll();
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)
{
var s = num.toString();
var spaces = width - s.length;
for (var i = 0; i < spaces; ++i)
s = " " + s;
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
//////////////////////////////////////////////////////////////////////////////
// Function definitions - checking sanity
//////////////////////////////////////////////////////////////////////////////
function check_locale_help()
{
DebugOut("Checking \"locale --help\" output...");
var cmd = locale + " --help";
var exec = Run(cmd);
var xout = new Array("NAME", "SYNOPSIS", "DESCRIPTION");
for (var i = 0; i < xout.length; ++i)
{
++assertions;
if (0 > run_stdout.search(xout[i]))
{
DebugOutLine(" incorrect.");
DebugOutLine("ERROR: \"locale --help\" gives wrong output ("
+ xout[i] + ").");
++failedassertions;
return;
}
}
DebugOutLine(" correct.");
}
function check_locale_all()
{
DebugOut("Checking \"locale -a\" output...");
var cmd = locale + " -a";
var exec = Run(cmd);
var aout = run_stdout.split("\n");
for (var i = 0; i < aout.length; ++i)
{
++assertions;
var line = aout[i].replace("\r", "").replace("\n", "");
if (0 == line.length || "C" == line)
continue;
if (0 > line.search(new RegExp("[a-z]\{2\}_[A-Z]\{2\}")))
{
DebugOutLine(" incorrect.");
DebugOutLine(" Warning: Locale name " + line
+ " not matching pattern.");
++failedassertions;
return;
}
}
DebugOutLine("check completed.");
}
function check_locale_m()
{
DebugOut("Checking \"locale -m\" output...");
var cmd = locale + " -m";
var exec = Run(cmd);
var aout = run_stdout.split("\n");
for (var i = 0; i < aout.length; ++i)
{
++assertions;
var line = aout[i].replace("\r", "").replace("\n", "");
if (0 > line.search(new RegExp(".cm")))
{
DebugOutLine(" incorrect.");
DebugOutLine("ERROR: \"locale -m\" failed.");
++failedassertions;
return;
}
}
DebugOutLine(" correct.");
}
function check_locale_k()
{
DebugOut("Checking \"locale -k LC_ALL\" output...")
var cmd = locale + " -k LC_ALL";
var exec = Run(cmd);
var xout = new Array("upper", "lower", "space", "print", "cntrl",
"alpha", "digit", "punct", "graph", "xdigit", "toupper",
"tolower", "abday", "day", "abmon", "", "mon", "am_pm",
"d_t_fmt", "d_fmt", "t_fmt", "t_fmt_ampm", "int_curr_symbol",
"currency_symbol", "mon_decimal_point", "mon_thousands_sep",
"mon_grouping", "positive_sign", "negative_sign", "int_frac_digits",
"frac_digits", "p_cs_precedes", "p_sep_by_space", "n_cs_precedes",
"n_sep_by_space", "p_sign_posn", "n_sign_posn", "decimal_point",
"thousands_sep", "grouping");
var any_failed = false;
for (var i = 0; i < xout.length; ++i)
{
++assertions;
if (0 > run_stdout.search(xout[i]))
{
// output text only for the first failure
if (!any_failed)
DebugOutLine(" incorrect.");
DebugOutLine("ERROR: \"locale -k\" gives wrong output (" +
+ xout[i] +").");
++failedassertions;
any_failed = true;
}
}
if (!any_failed)
DebugOutLine(" correct.");
}
function check_localedef_help()
{
DebugOut("Checking \"localedef --help\" output...");
var cmd = localedef + " --help";
var exec = Run(cmd);
var xout = new Array("NAME", "SYNOPSIS", "DESCRIPTION");
for (var i = 0; i < xout.length; ++i)
{
++assertions;
if (0 > run_stdout.search(xout[i]))
{
DebugOutLine(" incorrect.");
DebugOutLine("ERROR: \"localedef --help\" gives wrong output ("
+ xout[i] + ").");
++failedassertions;
return;
}
}
DebugOutLine(" correct.");
}
//////////////////////////////////////////////////////////////////////////////
// Function definitions - checking functionality
//////////////////////////////////////////////////////////////////////////////
//
// Generates one specified locale
//
function generate_locale(charmap, src, locname)
{
var err = "Cannot generate locale database - ";
// charmap - character map file used in generating the locale database
// src - source/locale definition file
// locname - locale database name
if (charmap == "")
{
outstrm.WriteLine(err + "character maps file not specified.");
Exit(1);
}
if (src == "")
{
outstrm.WriteLine(err + "source input file not specified.");
Exit(1);
}
if (locname == "")
{
outstrm.WriteLine(err + "output locale name not specified.");
Exit(1);
}
++assertions;
// Generating the database
var cmd = localedef + " -w -c -f " + charmap
+ " -i " + src + " " + locname;
DebugOutLine(cmd);
var exec = Run(cmd);
DebugOut(run_stdout);
var retcode = exec.ExitCode;
if (retcode)
{
// 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(locname, dumpfile)
{
var err = "Cannot dump locale database - ";
// locname: LC_ALL value
// dumpfile: current locale dump file
if (dumpfile == "")
{
outstrm.WriteLine(err + " - no output file specified.");
Exit(1);
}
++assertions;
// Dumping locale database
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)
{
dmpfile.Write(run_stdout);
dmpfile.Close();
}
var retcode = exec.ExitCode;
if (retcode)
{
// exit with the same status as the tool
Exit(retcode);
}
}
//
// Test one locale
//
function test_locale(nlsdir, tmpdir, fname)
{
var err = "Cannot test locale - ";
// 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.");
Exit(1);
}
if (tmpdir == "")
{
outstrm.WriteLine(err + " - temporary directory not specified.");
Exit(1);
}
if (fname == "")
{
outstrm.WriteLine(err+ " - locale database name not specified.");
Exit(1);
}
// get locale's name and encoding
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);
++assertions;
var locname1 = stage_1 + "\\" + fname;
var cm_path1 = cm_dir1 + "\\" + charmap;
var src_path1 = stage_1 + "\\" + source;
// generate stage 1 locale database from the orignal sources
generate_locale(cm_path, src_path, locname1);
++assertions;
// 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);
++assertions;
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;
++assertions;
// 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;
// create a directory for stage 2 charmap source files
var cm_dir3 = stage_3 + "\\charmaps";
DebugOutLine("mkdir " + cm_dir3);
CreateFolder(cm_dir3);
++assertions;
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("## AssertionFailed: " + src_path2 +
" and " + src_path3 + " differ.");
++failedassertions;
}
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);
}
}
//////////////////////////////////////////////////////////////////////////////
// Main code
//////////////////////////////////////////////////////////////////////////////
function run_locale_utils()
{
if (WScript.Arguments.Named.Exists("d"))
dbgout = true;
if (WScript.Arguments.Named.Exists("s"))
chk_sanity = true;
if (WScript.Arguments.Named.Exists("f"))
chk_func = true;
if (WScript.Arguments.Named.Exists("i"))
nlsdir = WScript.Arguments.Named("i");
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");
locale = bindir + "\\" + locale;
localedef = bindir + "\\" + localedef;
}
if (WScript.Arguments.Named.Exists("O"))
{
var outfile = WScript.Arguments.Named("O");
outstrm = fso.CreateTextFile(outfile, true);
if (!outstrm)
{
WScript.StdErr.WriteLine("Unable to create " + outfile + ", aborting");
WScript.Quit(2);
}
}
if (chk_sanity)
{
// checking locale sanity
check_locale_help();
check_locale_all();
check_locale_m();
check_locale_k();
check_localedef_help();
}
else if (chk_func)
{
// create the temp dir
if (!CreateFolder(tmpdir))
{
WScript.StdErr.WriteLine("Unable to create " + tmpdir + ", aborting");
WScript.Quit(1);
}
// test only one locale
test_locale(nlsdir, tmpdir, locale_db);
Cleanup();
}
else
{
// Invocation is wrong
WScript.Arguments.ShowUsage();
WScript.Quit(2);
}
if (assertions)
{
var pcnt = 100 * (assertions - failedassertions) / assertions;
pcnt = Math.floor(pcnt + 0.5);
outstrm.WriteLine("# +-----------------------+----------+----------+----------+");
outstrm.WriteLine("# | DIAGNOSTIC | ACTIVE | TOTAL | INACTIVE |");
outstrm.WriteLine("# +-----------------------+----------+----------+----------+");
outstrm.WriteLine("# | (S7) ASSERTION | " + FormatNumber(failedassertions, 8)
+ " | " + FormatNumber(assertions, 8) + " | " + FormatNumber(pcnt, 7) + "% |");
outstrm.WriteLine("# +-----------------------+----------+----------+----------+");
outstrm.WriteLine();
}
outstrm.WriteLine("## Warnings = 0");
outstrm.WriteLine("## Assertions = " + assertions);
outstrm.WriteLine("## FailedAssertions = " + failedassertions);
outstrm.WriteLine();
}
]]>
</script>
</job>
</package>

View File

@@ -0,0 +1,494 @@
<?xml version="1.0" ?>
<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="runexamples" prompt="no">
<?job error="false" debug="false" ?>
<runtime>
<description>
runs examples and checks results.
</description>
<named helpstring="The root directory with executables"
name="EXEDIR" required="true" type="string"/>
<named helpstring="The directory with project files of the executables"
name="PRJDIR" required="false" type="string"/>
<named helpstring="The configuration" name="CONFIG"
required="true" type="string"/>
<named helpstring="The root directory with .in and .out files"
name="INOUTDIR" required="false" type="string"/>
<named helpstring="The log file" name="LOGFILE"
required="false" type="string"/>
<named helpstring="The examples extension" name="EXT"
required="false" type="string"/>
<named helpstring="The additional options for exec utility"
name="RUNFLAGS" required="false" type="string"/>
<example>
cscript runall.wsf /EXEDIR:"C:\stdcxx\build\examples"
/PRJDIR:"C:\stdcxx\build\projects\examples"
/INOUTDIR:"C:\stdcxx\examples" /CONFIG:msvc-7.1
</example>
<usage>
Usage: cscript runexamples.wsf /EXEDIR:@EXEDIR /CONFIG:@CONFIG
[/PRJDIR:@PRJDIR] [/INOUTDIR:@INOUTDIR] [/LOGFILE:@LOGFILE]
[/EXT:@EXT] [/RUNFLAGS:@RUNFLAGS]
where
@EXEDIR is the root directory with executables to be run and checked,
@PRJDIR is the directory with .vcproj files of the executables,
@INOUTDIR is the root directory with .in and .out files ,
required by executables,
@CONFIG is the compiler configuration (msvc-7.1, icc-9.0, etc),
@LOGFILE is the log file name,
@EXT is the extension of the example files, default value: "exe".
@RUNFLAGS is the additional options for exec utility
</usage>
</runtime>
<object id="fso" progid="Scripting.FileSystemObject"/>
<object id="WshShell" progid="WScript.Shell"/>
<script language="JScript" src="config.js"/>
<script language="JScript" src="utilities.js"/>
<script language="JScript" src="summary.js"/>
<script id="runexamples" language="JScript">
<![CDATA[
//
// Examples running script for stdcxx library
//
var examplesDir = ""; // path to the root directory containing executables
var projectsDir = ""; // path to the directory containing projects of the executables
var inoutDir = ""; // path to the root directory
// containing the .in and .out files
var currentCfg = "msvc-7.1" // the configuration
var logFileName = ""; // the log file name
var logFileDefault = "runexamples.log"; // the default log file name
var ext = "exe";
var runflags = "";
var varOut = "out";
var exRun = 0;
var exRunSucceeded = 0;
var exRunFailed = 0;
var exRunTimedOut = 0;
var exBadCode = 0;
var exNotCompiled = 0;
var buildlogFile = "BuildLog.htm";
var summaryFileName = "Summary.htm";
var htmFolderName = "temphtm";
var utlExec = "exec.exe";
var unicodeLog = false;
var description = new runexamples; // run
// the main function of the script
function runexamples()
{
readAndCheckArguments();
getCompilerOpts(currentCfg);
unicodeLog = UNICODELOG;
var buildOutDir = examplesDir;
if (! fso.FolderExists(buildOutDir))
fso.CreateFolder(buildOutDir);
var fLog = fso.CreateTextFile(examplesDir + "\\" + logFileName);
var fSummary = fso.CreateTextFile(buildOutDir + "\\" + summaryFileName);
runAllExamples(examplesDir, projectsDir, inoutDir, fLog, fSummary, ext);
var logMsg = "Total run " + exRun + "; " + exRunSucceeded + " succeeded, " +
exRunFailed + " failed, " + exRunTimedOut + " failed because of timeout, " +
exBadCode + " exited with non-zero code, " +
exNotCompiled + " has not compiled";
WScript.Echo(logMsg);
fLog.WriteLine(logMsg);
fLog.Close();
fSummary.Close();
WScript.Quit(0);
}
// performs checking of the script parameters
function readAndCheckArguments()
{
if (!WScript.Arguments.Named.Exists("EXEDIR"))
{
WScript.StdErr.WriteLine(
"Generate: Missing required argument EXEDIR.");
WScript.Arguments.ShowUsage();
WScript.Quit(2);
}
if (!WScript.Arguments.Named.Exists("CONFIG"))
{
WScript.StdErr.WriteLine(
"Generate: Missing required argument CONFIG.");
WScript.Arguments.ShowUsage();
WScript.Quit(2);
}
examplesDir = WScript.Arguments.Named("EXEDIR");
currentCfg = WScript.Arguments.Named("CONFIG");
if (WScript.Arguments.Named.Exists("PRJDIR"))
projectsDir = WScript.Arguments.Named("PRJDIR");
if (WScript.Arguments.Named.Exists("INOUTDIR"))
inoutDir = WScript.Arguments.Named("INOUTDIR");
if (WScript.Arguments.Named.Exists("LOGFILE"))
logFileName = WScript.Arguments.Named("LOGFILE");
else
logFileName = logFileDefault;
if (WScript.Arguments.Named.Exists("EXT"))
ext = WScript.Arguments.Named("EXT");
if (WScript.Arguments.Named.Exists("RUNFLAGS"))
{
runflags = WScript.Arguments.Named("RUNFLAGS");
runflags = runflags.replace(/\'/g, "\"");
}
if (! fso.FolderExists(examplesDir))
{
WScript.StdErr.WriteLine(
"Generate: Could not find directory " + examplesDir);
WScript.Quit(3);
}
if (0 < inoutDir.length && !fso.FolderExists(inoutDir))
{
WScript.StdErr.WriteLine(
"Generate: Could not find directory " + inoutDir);
WScript.Quit(3);
}
}
// run all executables starting from exeDir
// exeDir - folder containing the executables
// prjDir - folder with .vcproj files of the executables
// srcDir - starting folder to search .in and .out files for the executable
// fileLog - filename of the logfile
// fileSimmary - filename of the summary file
function runAllExamples(exeDir, prjDir, srcDir, fileLog, fileSummary, exeExt)
{
if (!fso.FolderExists(exeDir))
return;
if (0 < prjDir.length && !fso.FolderExists(prjDir))
return;
var enumFolder = fso.GetFolder(0 < prjDir.length ? prjDir : exeDir);
var htmDir = exeDir + "\\" + htmFolderName;
if (! fso.FolderExists(htmDir))
fso.CreateFolder(htmDir);
var exeFiles = new Array();
var arrInfo = new Array();
var enumFiles = new Enumerator(enumFolder.Files);
for (; !enumFiles.atEnd(); enumFiles.moveNext())
{
var fileName = enumFiles.item().Name;
if (0 < prjDir.length)
{
// skip "stdcxx_..." projects
if (0 == fileName.indexOf("stdcxx_") ||
"vcproj" != fso.GetExtensionName(fileName))
{
continue;
}
}
else if (exeExt != fso.GetExtensionName(fileName))
continue;
var pureFileName = fso.GetBaseName(fileName);
var exeFileName = pureFileName + "." + exeExt;
var itemInfo = new ItemBuildInfo(pureFileName);
readBuildLog(exeDir, itemInfo, unicodeLog);
itemInfo.runReqOutput = readOutFile(srcDir, exeFileName);
exeFiles.push(exeFileName);
arrInfo.push(itemInfo);
++exRun;
}
var runCmd = utlExec;
if (0 < srcDir.length)
runCmd += " -d \"" + srcDir + "\"";
if (0 < runflags.length)
runCmd += " " + runflags + " ";
var targets = exeFiles.join(" ");
var target_list = null;
var prevDir = WshShell.CurrentDirectory;
WshShell.CurrentDirectory = exeDir;
// the max command line len == 2047 for Win2000
// http://support.microsoft.com/kb/830473
var MaxCmdLineLen = 2047;
if (MaxCmdLineLen >= runCmd.length + targets.length)
runCmd += exeFiles.join(" ");
else
{
target_list = "targets.lst";
var strm = fso.CreateTextFile(target_list, true);
for (var i = 0; i < exeFiles.length; ++i)
strm.WriteLine(exeFiles[i]);
strm.Close();
runCmd += "@" + target_list;
}
try
{
runCmd = "cmd /c " + runCmd + " 2>&1";
var oExec = WshShell.Exec(runCmd);
var execOut = "";
while (oExec.Status == 0)
{
execOut += oExec.StdOut.ReadAll();
WScript.Sleep(100);
}
execOut += oExec.StdOut.ReadAll();
WScript.Echo(execOut);
}
catch (e)
{
WScript.Echo("Exception in WshShell.Exec(" + runCmd + "): " + e.message);
return;
}
finally
{
if (null != target_list)
fso.DeleteFile(target_list);
WshShell.CurrentDirectory = prevDir;
}
for (var i = 0; i < arrInfo.length; ++i)
{
var itemInfo = arrInfo[i];
var outFileName = exeDir + "\\" + itemInfo.name + ".out";
if (fso.FileExists(outFileName))
{
try
{
var outFile = fso.OpenTextFile(outFileName, 1);
if (!outFile.AtEndOfStream)
itemInfo.runOutput = outFile.ReadAll();
outFile.Close();
fso.DeleteFile(outFileName);
}
catch(e)
{
WScript.Echo("Could not delete temporary file " + outFileName);
}
}
itemInfo.exitCode = parseStatus(itemInfo.name + "." + exeExt, execOut);
switch (itemInfo.exitCode)
{
case 0: // OK
case -7: // OUTPUT
case -8: // FORMAT
case -9: // NOUT
++exRunSucceeded;
fileLog.WriteLine(itemInfo.name + " completed successfully, exit code " +
itemInfo.exitCode);
break;
case -1: // other
case -4: // SEGV
case -10: // TRAP
++exRunFailed;
fileLog.WriteLine(itemInfo.name + " failed");
break;
case -2: // KILLED
++exRunTimedOut;
fileLog.WriteLine(itemInfo.name + " timed out");
break;
case -3: // DIFF
fileLog.WriteLine(itemInfo.name + " completed successfully, " +
"but output differs from the expected");
getDifferencesInfo(itemInfo);
++exRunFailed;
break;
case -5: // COMP
case -6: // LINK
fileLog.WriteLine(itemInfo.name + " has not compiled");
++exNotCompiled;
break;
default:
++exBadCode;
fileLog.WriteLine(itemInfo.name + " completed successfully, exit code " +
itemInfo.exitCode);
}
saveBuildInfo(itemInfo, htmDir, "htm");
saveBuildSummary(itemInfo, fileSummary);
}
}
// parse the exec utility output to get status of the running executable
// exename - filename of the executable
// exeOut - stdout content of the exec utility
function parseStatus(exeName, execOut)
{
var res = 0;
// maxNameLen is the width of the "NAME" column in the exec utility output
var maxNameLen = 30;
var pos = execOut.indexOf(exeName.substr(0, maxNameLen));
if (0 <= pos)
{
pos += maxNameLen + 1;
var status = execOut.substring(pos, execOut.indexOf(" ", pos + 6));
res = parseInt(status);
if (isNaN(res))
{
switch (status)
{
case "KILLED":
res = -2;
break;
case " DIFF":
res = -3;
break;
case " SEGV":
res = -4;
break;
case " COMP":
res = -5;
break;
case " LINK":
res = -6;
break;
case "OUTPUT":
res = -7;
break;
case "FORMAT":
res = -8;
break;
case " NOUT":
res = -9;
break;
case " TRAP":
res = -10;
break;
default:
res = -1;
}
}
}
return res;
}
// 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
// nameSuffix - one of varIn, varOut
function readAllFromFile(srcDir, exeFileName, nameSuffix)
{
if (! fso.FolderExists(srcDir))
return "";
var pureName = fso.GetBaseName(exeFileName);
var someDir = srcDir + "\\" + nameSuffix;
if (! fso.FolderExists(someDir))
return "";
var someFileName = someDir + "\\" + pureName + "." + nameSuffix;
if (! fso.FileExists(someFileName))
return "";
var someFile = fso.OpenTextFile(someFileName);
if (! someFile)
return "";
return (someFile.ReadAll());
}
// 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);
var outBegin = (idxEOL != -1) ? outData.substr(0, idxEOL) : outData;
var rgWords = outBegin.split(" ");
if (rgWords[0] != "link")
return outData;
// try to open file using the link
var linkedFileName = srcDir + "\\" + varOut + "\\" + rgWords[1];
if (! fso.FileExists(linkedFileName))
return outData;
var linkedFile = fso.OpenTextFile(linkedFileName);
if (! linkedFile)
return "";
return (linkedFile.ReadAll());
}
]]>
</script>
</job>
</package>

View File

@@ -0,0 +1,700 @@
//
// $Id: summary.js 550991 2007-06-26 23:58:07Z sebor $
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
// 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, useUnicode)
{
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 uniMode = (true == useUnicode) ? -1 : 0;
var blogFile;
try
{
blogFile = fso.OpenTextFile(blogFilePath, 1, false, uniMode);
}
catch (e)
{
WScript.Echo("Cannot open file: " + blogFilePath);
return;
}
var blogData = blogFile.AtEndOfStream ? "" : 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);
var posPrjTmp = posPrjName;
posPrjName = summaryData.indexOf(String.fromCharCode(10), posPrjTmp);
if (-1 == posPrjName)
{
posPrjName = summaryData.indexOf("\r\n", posPrjTmp);
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 extractTextBlockData(blogData, posTextBlock)
{
var nextTableBlock = blogData.indexOf("<table", posTextBlock);
var textData = "";
if (nextTableBlock > 0)
{
textData =
blogData.substr(posTextBlock, nextTableBlock - posTextBlock);
}
else
{
textData = blogData.substr(posTextBlock);
}
var posPreTag = textData.indexOf("<pre", 0);
if (-1 == posPreTag)
textData = "<pre>" + textData + "</pre>";
return textData;
}
function extractTableData(blogData, posStart)
{
var posMainTable = blogData.indexOf("<table", posStart);
if (-1 == posMainTable)
return "";
// check that we have data in table form
var posFirstCloseTable = blogData.indexOf("</table>", posStart);
if (-1 != posFirstCloseTable && posMainTable - posFirstCloseTable > 20)
return extractTextBlockData(blogData, posFirstCloseTable + 8);
// 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",
encodeHTML(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;
return outDir + "\\" + buildSummaryPrefix + buildType + ".html";
}
function makeSummaryLog(buildDir, buildSummaryPrefix, buildType)
{
var outDir = buildDir;
if (! fso.FolderExists(outDir))
fso.CreateFolder(outDir);
var oFolder = fso.GetFolder(outDir);
var sumFileName = buildSummaryPrefix + buildType + ".html";
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 + "\\" + summaryFileName;
if (fso.FileExists(lsumFileName))
{
var fileLSum = fso.OpenTextFile(lsumFileName);
if (!fileLSum.AtEndOfStream)
{
var lsumData = fileLSum.ReadAll();
fSum.Write(lsumData);
}
fileLSum.Close();
}
fSum.WriteLine("</table>");
fSum.WriteLine("<br/>");
}
function saveBuildSummarySingle(fSum, libInfo, hdrLibrary)
{
saveBuildInfoTable(fSum, libInfo, hdrLibrary, true);
fSum.WriteLine("<br/>");
}
function saveBuildSummaryMulti(fSum, htmDir)
{
if (!fso.FolderExists(htmDir))
return;
var htmFolder = fso.GetFolder(htmDir);
var enumHtmSubFolders = new Enumerator(htmFolder.SubFolders);
for (; !enumHtmSubFolders.atEnd(); enumHtmSubFolders.moveNext())
{
var htmFName = enumHtmSubFolders.item().Name;
saveBuildSummariesFromFolder(fSum,
enumHtmSubFolders.item().Path, htmFolderName);
saveBuildSummaryMulti(fSum, htmDir + "\\" + htmFName);
}
}
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, useUnicode)
{
if (!fso.FolderExists(testDir))
return;
var testFolder = fso.GetFolder(testDir);
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, useUnicode);
}
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 uniMode = (true == useUnicode) ? -1 : 0;
var blogFile =
fso.OpenTextFile(testFolder.Path + "\\" + htmFileName,
1, false, uniMode);
var blogData = blogFile.AtEndOfStream ? "" : 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();
}

View File

@@ -0,0 +1,552 @@
//
// $Id: utilities.js 580483 2007-09-28 20:55:52Z sebor $
//
// defines different utility functions
//
//////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////
var VERSION = "";
var DEVENV = "";
var DEVENVFLAGS = "";
var CPPFLAGS = "";
var LDFLAGS = "";
var LIBS = "";
var CONVERT = false;
var CXX = "";
var LD = "";
var AR = "";
var AS = "";
var SLNVER="";
var SLNCOMMENT="";
var UNICODELOG = false;
var NOSTCRT = false;
var WINDIFF = "";
var ICCCONVERT = "";
var PLATFORM = "";
var CLVARSBAT = "";
var ICCVER="";
// timeout for exec utility in seconds
var EXEC_TIMEOUT = 300;
// expand system macros
function expandSysMacro(str)
{
var env = null;
var pos = 0;
while (true)
{
pos = str.indexOf("%", pos);
if (0 > pos)
break;
++pos;
var pos2 = str.indexOf("%", pos);
if (0 > pos2)
break;
if (null == env)
env = WshShell.Environment("PROCESS");
var macro = str.substring(pos, pos2);
pos = pos2 + 1;
var value = env.Item(macro);
if ("undefined" != typeof(value) && "" != value)
str = str.replace("%" + macro + "%", value);
}
return str;
}
// read and parse compiler configuration file
// config - name of the compiler configuration
function parseConfig(config)
{
var scriptDir = getParentFolder(WScript.ScriptFullName);
var configFileName = scriptDir + "\\" + config + ".config";
var ForReading = 1;
var configFile = null;
try
{
configFile = fso.OpenTextFile(configFileName, ForReading);
}
catch (e) {}
if (null == configFile)
{
WScript.StdErr.WriteLine("Cannot open configuration file: " + configFileName);
WScript.Quit(3);
}
var rx = /^\s*([A-Z]+)\s*=\s*(\S.*)$/;
while (!configFile.AtEndOfStream)
{
var line = configFile.ReadLine();
if (0 == line.length || 0 == line.indexOf("//"))
continue;
var inc = "#include ";
var pos = line.indexOf(inc);
if (0 == pos)
parseConfig(line.substr(pos + inc.length));
var arr = rx.exec(line);
if (null == arr || 0 == arr[2].length)
continue;
arr[2] = expandSysMacro(arr[2]);
switch (arr[1])
{
case "VERSION":
VERSION = arr[2];
break;
case "DEVENV":
DEVENV = arr[2];
break;
case "DEVENVFLAGS":
DEVENVFLAGS = arr[2];
break;
case "CPPFLAGS":
CPPFLAGS = arr[2];
break;
case "LDFLAGS":
LDFLAGS = arr[2];
break;
case "LIBS":
LIBS = arr[2];
break;
case "CONVERT":
CONVERT = parseInt(arr[2]) != 0;
break;
case "CXX":
CXX = arr[2];
break;
case "LD":
LD = arr[2];
break;
case "AR":
AR = arr[2];
break;
case "AS":
AS = arr[2];
break;
case "SLNVER":
SLNVER = arr[2];
break;
case "SLNCOMMENT":
SLNCOMMENT = arr[2];
break;
case "UNICODELOG":
UNICODELOG = parseInt(arr[2]) != 0;
break;
case "NOSTCRT":
NOSTCRT = parseInt(arr[2]) != 0;
break;
case "WINDIFF":
WINDIFF = arr[2];
break;
case "ICCCONVERT":
ICCCONVERT = arr[2];
break;
case "PLATFORM":
PLATFORM = arr[2];
break;
case "CLVARSBAT":
CLVARSBAT = arr[2];
break;
case "ICCVER":
ICCVER = arr[2];
break;
}
}
}
// init script variables for specified compiler configuration
function getCompilerOpts(config)
{
// set vars to initial state
VERSION = "";
DEVENV = "";
DEVENVFLAGS = "";
CPPFLAGS = "";
LDFLAGS = "";
LIBS = "";
CONVERT = false;
CXX = "";
LD = "";
AR = "";
AS = "";
SLNVER="";
SLNCOMMENT="";
UNICODELOG = false;
NOSTCRT = false;
WINDIFF = "";
ICCCONVERT = "";
PLATFORM = "";
CLVARSBAT = "";
ICCVER = "";
parseConfig(config);
if (0 == WINDIFF.length)
{
if (VERSION.length)
{
var ver = "";
if (0 <= VERSION.indexOf("."))
ver = VERSION.replace(".", "");
var path = WshShell.Environment.Item("VS" + ver + "COMNTOOLS");
if (path.length)
{
WINDIFF = "\"" +
fso.BuildPath(path.replace(/\"/g, ""), "bin\\windiff") +
"\"";
}
}
if (0 == WINDIFF.length)
WINDIFF = "windiff";
}
}
// out variables and their values to the stream
function PrintVars(stream)
{
stream.WriteLine("Variables:");
stream.WriteLine(" VERSION=" + VERSION);
stream.WriteLine(" DEVENV=" + DEVENV);
stream.WriteLine(" DEVENVFLAGS=" + DEVENVFLAGS);
stream.WriteLine(" CPPFLAGS=" + CPPFLAGS);
stream.WriteLine(" LDFLAGS=" + LDFLAGS);
stream.WriteLine(" LIBS=" + LIBS);
stream.WriteLine(" CONVERT=" + CONVERT);
stream.WriteLine(" CXX=" + CXX);
stream.WriteLine(" LD=" + LD);
stream.WriteLine(" AR=" + AR);
stream.WriteLine(" AS=" + AS);
stream.WriteLine(" SLNVER=" + SLNVER);
stream.WriteLine(" SLNCOMMENT=" + SLNCOMMENT);
stream.WriteLine(" UNICODELOG=" + UNICODELOG);
stream.WriteLine(" NOSTCRT=" + NOSTCRT);
stream.WriteLine(" WINDIFF=" + WINDIFF);
stream.WriteLine(" ICCCONVERT=" + ICCCONVERT);
stream.WriteLine(" PLATFORM=" + PLATFORM);
stream.WriteLine(" CLVARSBAT=" + CLVARSBAT);
stream.WriteLine(" ICCVER=" + ICCVER);
stream.WriteLine("");
}
// returns parent folder for a path
function getParentFolder(path)
{
var idx = path.lastIndexOf('\\');
return path.substr(0, idx);
}
// returns filename from a path
function getFileName(path)
{
var idx = path.lastIndexOf('\\');
return path.substr(idx + 1);
}
// returns extension of the file name (with dot at first character)
function getExtension(filename)
{
var idx = filename.lastIndexOf('.');
return 0 <= idx ? filename.substr(idx) : ".";
}
/////////////////////////////////////////////////////////////////////////
// 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";
}
}
// create temporary file and return path to this file
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;
}
// encode symbols within string with escaped analog
// srcString - source string
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], "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 decodeHTML(srcString).replace(new RegExp("> <", "g"), "><")
.replace(new RegExp("><", "g"), ">\r\n<")
.replace(new RegExp("(^<[\\s\\S]+?>)", "gm"), "")
.replace(new RegExp("\r", "g"), "")
.replace(new RegExp("\n{2,}", "g"), "\n\n")
.replace(new RegExp("</pre>", "g"), "")
.replace(new RegExp("</h3>", "g"), "")
.replace(new RegExp("</font>", "g"), "");
}
// returns source string without first character if it equal to symbol
// dotName - source string
// symbol - symbol to remove
function removeLeadingSymbol(dotName, symbol)
{
var index = dotName.indexOf(symbol);
if (0 != index)
return dotName;
var resName = dotName.substr(symbol.length);
return resName;
}
// returns source string without first character is is a dot
function removeLeadingDot(dotName)
{
var index = dotName.indexOf(".");
if (0 != index)
return dotName;
var resName = dotName.substr(1);
return resName;
}
// returns the source filename with replaced extension to new one
// filename - source filename
// ext - new extension
function changeFileExt(filename, ext)
{
var arr = filename.split(".");
arr[arr.length - 1] = ext;
return arr.join(".");
}
// returns new UUID
function createUUID()
{
return WScript.CreateObject("scriptlet.typelib").guid;
}
// returns index of value in array or -1
function arrayIndexOf(array, value)
{
for (var i = 0; i < array.length; ++i)
if (array[i] == value)
return i;
return -1;
}
// create MSVS solution file
// projects - array of the projects
// path - output folder
// name - name of the solutuion file
function generateSolution(projects, path, name)
{
path += "\\";
var sln = fso.CreateTextFile(path + name, true, false);
// header
sln.WriteLine("Microsoft Visual Studio Solution File, Format Version " + SLNVER);
if (0 < SLNCOMMENT.length)
sln.WriteLine("# " + SLNCOMMENT);
for (var i = 0; i < projects.length; ++i)
{
// project section header
var Project = projects[i];
var VCProject = Project.VSProject;
sln.Write("Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ");
sln.Write("\"" + VCProject.Name + "\"");
var projectFile = VCProject.ProjectFile;
var pos = projectFile.indexOf(path);
if (0 == pos)
projectFile = projectFile.substr(path.length);
sln.Write(", \"" + projectFile + "\"");
sln.WriteLine(", \"" + VCProject.ProjectGUID + "\"");
if (SLNVER != "7.00")
{
// project dependencies
sln.WriteLine(
"\tProjectSection(ProjectDependencies) = postProject");
var deps = Project.PrjRefs.concat(Project.PrjDeps);
for (var j = 0; j < deps.length; ++j)
{
var depGUID = deps[j].VSProject.ProjectGUID;
sln.WriteLine("\t\t" + depGUID + " = " + depGUID);
}
sln.WriteLine("\tEndProjectSection");
}
// project section end
sln.WriteLine("EndProject");
}
// Global section
sln.WriteLine("Global");
// solution configurations
sln.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution");
for (var i = 0; i < confNames.length; ++i)
{
var confName = confNames[i];
var confKey = (SLNVER == "7.00" ? "ConfigName." + i : confName);
sln.WriteLine("\t\t" + confKey + " = " + confName);
}
sln.WriteLine("\tEndGlobalSection");
// project dependencies for MSVC 7.0
if (SLNVER == "7.00")
{
sln.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution");
for (var i = 0; i < projects.length; ++i)
{
var Project = projects[i];
var VCProject = Project.VSProject;
var prjGUID = VCProject.ProjectGUID;
var deps = Project.PrjRefs.concat(Project.PrjDeps);
for (var j = 0; j < deps.length; ++j)
{
var depGUID = deps[j].VSProject.ProjectGUID;
sln.WriteLine("\t\t" + prjGUID + "." + j + " = " + depGUID);
}
}
sln.WriteLine("\tEndGlobalSection");
}
// project configurations
sln.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution");
for (var i = 0; i < projects.length; ++i)
{
var Project = projects[i];
var VCProject = Project.VSProject;
var prjGUID = VCProject.ProjectGUID;
var cfgs = VCProject.Configurations;
for (var j = 1; j <= cfgs.Count; ++j)
{
var cfg = cfgs.Item(j);
sln.WriteLine("\t\t" + prjGUID + "." + cfg.ConfigurationName +
".ActiveCfg = " + cfg.Name);
sln.WriteLine("\t\t" + prjGUID + "." + cfg.ConfigurationName +
".Build.0 = " + cfg.Name);
}
}
sln.WriteLine("\tEndGlobalSection");
// some unknown stuff
sln.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution");
sln.WriteLine("\tEndGlobalSection");
sln.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution");
sln.WriteLine("\tEndGlobalSection");
sln.WriteLine("EndGlobal");
sln.Close();
}