我正在制作Doors中的DXL程序,该程序应该将所有源模块,目标,链接集和每个(源/目标)模块的版本输出到csv文件。我已经成功输出了“源模块,目标,链接集,但是我无法提取模块的版本。有人知道怎么做吗?
以下是我的代码:
答案 0 :(得分:0)
以下内容使用位于C:\ Temp中的输出文件,但是您可以轻松地对其进行更改。 它通过使用grep字符串匹配模块来工作,您也可以更改为适合。 我有不同的模块类型,因此在这种情况下,我只能在前缀“ STR”上获得结果。我决定为不同的前缀模块使用多个脚本,而不是动态传递STR关键字。
您需要输入“ modPathname”的文件夹和子文件夹 然后调整Regexp“ GrepString”以适合您的命名约定 或者,您可以通过对值进行硬编码来绕过所有这些操作。
string filename = "C:\\TEMP\\STR_Baseline_Info.txt"
Stream outFile = write filename
string Modtype = "STR"
void PrintAndOutput ( string s)
{
// print (s) // Enable if you want output
outFile << s
}
void DisplayResults( string Modtype )
{
Item modItem
Module mName
Regexp GrepString = regexp2 "^" Modtype "-[0-8][0-9][0-9]"
Folder modPathname = folder "/EnterYourFolderHere/AnySubFolders/" Modtype ""
string fullModuleName , CommentStr , moduleName
Baseline b
PrintAndOutput "------------------------------------------------------------------------------\n"
CommentStr = "This File is automatically produced via the " Modtype " Baseline Info.dxl script. \n" Modtype " Versions as of : " dateAndTime(today) "\n"
PrintAndOutput CommentStr
PrintAndOutput "-------------------------------------------------------------------------------\n\n"
for modItem in modPathname do
{
if (type (modItem ) == "Formal")
{
moduleName = (name modItem)
if (GrepString moduleName)
{
fullModuleName = (fullName(modItem))
mName = read(fullName modItem , false)
b= getMostRecentBaseline (mName)
if (b != null )
{
PrintAndOutput moduleName " -\tBaseline : "(major b)"."(minor b)(suffix b) " \t " (dateOf b) "\n"
}
else
{
PrintAndOutput moduleName " \t### No Baseline Information ### \t" " \n"
}
}
}
}
}
DisplayResults ( Modtype)