Added: #1440 Pipeline process for bnp_make

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent b1f9270037
commit 4ec3c5086f

@ -226,6 +226,7 @@ struct BNPHeader
string gDestBNPFile;
BNPHeader gBNPHeader;
std::vector<std::string> gDirectories;
bool gNoRecurse = false;
// ---------------------------------------------------------------------------
void append(const string &filename1, const string &filename2, uint32 sizeToRead)
@ -260,7 +261,7 @@ void packSubRecurse(const std::vector<std::string> &directories)
{
printf("Treating directory : %s\n", (*it).c_str());
ToolLogger.writeDepend(PIPELINE::DIRECTORY, gDestBNPFile, *it);
CPath::getPathContent(*it, true, false, true, pathContent);
CPath::getPathContent(*it, !gNoRecurse, false, true, pathContent);
}
// Sort filename
@ -388,6 +389,11 @@ uint readOptions (int nNbArg, char **ppArgs)
gDirectories.push_back(string(ppArgs[i+1]));
optionCount += 2;
}
if ((strcmp (ppArgs[i], "-norecurse") == 0))
{
gNoRecurse = true;
optionCount += 1;
}
}
return optionCount;
}
@ -406,34 +412,34 @@ int main (int nNbArg, char **ppArgs)
bool cmdPack = (strcmp(ppArgs[1], "/p") == 0) || (strcmp(ppArgs[1], "/P") == 0) ||
(strcmp(ppArgs[1], "-p") == 0) || (strcmp(ppArgs[1], "-P") == 0);
if (cmdPack && gDirectories.size() > 0)
if (cmdPack)
{
// Pack a directory
// Read options
uint count = readOptions(nNbArg, ppArgs);
nNbArg -= count;
}
if (cmdPack && gDirectories.size() > 0)
{
if (nNbArg < 3)
{
usage();
return -1;
}
gDestBNPFile = CPath::standardizePath(ppArgs[2]);
gDestBNPFile = ppArgs[2];
remove(gDestBNPFile.c_str());
gBNPHeader.OffsetFromBeginning = 0;
packSubRecurse(gDirectories);
gBNPHeader.append(gDestBNPFile);
return 0;
}
if (cmdPack && gDirectories.size() == 0)
{
// Pack a directory
uint count = readOptions (nNbArg, ppArgs);
nNbArg -= count;
// Read options
string sCurDir;
if (nNbArg >= 4)

@ -40,10 +40,54 @@
namespace PIPELINE {
void CProcessPackageBNP::buildPackageBNP(const std::string &dependLog, const std::string &errorLog, const std::vector<std::string> &srcDirectories, const std::string &dstFile)
{
nldebug("Build: Package BNP '%s'", dstFile.c_str());
std::vector<std::string> arguments;
arguments.push_back("/p");
arguments.push_back(dstFile);
for (std::vector<std::string>::const_iterator it = srcDirectories.begin(), end = srcDirectories.end(); it != end; ++it)
{
arguments.push_back("-dir");
arguments.push_back(*it);
}
arguments.push_back("-dependlog");
arguments.push_back(dependLog);
arguments.push_back("-errorlog");
arguments.push_back(errorLog);
arguments.push_back("-norecurse");
m_PipelineProcess->runConsoleTool(m_PipelineProcess->getConfig("ToolBnpMake"), arguments);
}
void CProcessPackageBNP::build()
{
// TODO: Divisions
nldebug("Build process plugin: CProcessPackageBNP");
m_PipelineProcess->setExit(FINISH_ERROR, "Not implemented");
std::string tempDir = m_PipelineProcess->getTempDirectory();
std::string dependLog = tempDir + "depend.log";
std::string errorLog = tempDir + "error.log";
breakable
{
std::string root = "Package.BNP.";
std::vector<std::string> srcDirectories;
if (!m_PipelineProcess->getValues(srcDirectories, root + "SrcDirectories")) break;
std::string dstFile;
if (!m_PipelineProcess->getValue(dstFile, root + "DstFile")) break;
if (m_PipelineProcess->needsToBeRebuilt(srcDirectories, dstFile, false))
{
m_PipelineProcess->makePaths(dstFile);
buildPackageBNP(dependLog, errorLog, srcDirectories, dstFile);
if (m_PipelineProcess->needsExit()) return;
m_PipelineProcess->parseToolLog(dependLog, errorLog, false);
}
if (m_PipelineProcess->needsExit()) return;
}
m_PipelineProcess->deleteDirectoryIfEmpty(tempDir);
}
void CProcessPackageBNPInfo::getDependentDirectories(std::vector<std::string> &resultAppend)

@ -51,6 +51,8 @@ public:
CProcessPackageBNP() { }
virtual ~CProcessPackageBNP() { }
void buildPackageBNP(const std::string &dependLog, const std::string &errorLog, const std::vector<std::string> &srcDirectories, const std::string &dstFile);
virtual void build();
NLMISC_DECLARE_CLASS(CProcessPackageBNP)

@ -44,6 +44,7 @@ PrimitivesDirectory = SharedLeveldesign + "/primitives";
ToolBuildInterface = "build_interface";
ToolTga2Dds = "tga2dds";
ToolBnpMake = "bnp_make";
// Ignored process plugins, like CProcessMaxShape, which should be completely ignored by the master service, even if they are configured to be used inside the process sheets.
// MasterIgnoreProcessPlugins = { }; // Only used by the master service. NOT USED, USE WORKSPACE INTEAD!

@ -186,6 +186,7 @@ void CPipelineProcessImpl::runConsoleTool(const std::string &executablePath, con
ss << executablePath;
for (std::vector<std::string>::const_iterator it = arguments.begin(), end = arguments.end(); it != end; ++it)
ss << " " << *it;
nldebug("System: '%s'", ss.str().c_str());
system(ss.str().c_str());
#else
pid_t fork_id = fork();

@ -1,12 +1,12 @@
<?xml version="1.0"?>
<DFN Revision="$Revision$" State="checked">
<DFN Revision="$Revision$" State="modified">
<ELEMENT Name="SrcDirectories" Type="Type" Filename="pipeline_path_endslash.typ" Array="true"/>
<ELEMENT Name="Subdivisions" Type="Type" Filename="string.typ" Array="true"/>
<ELEMENT Name="Divisions" Type="Type" Filename="string.typ" Array="true"/>
<ELEMENT Name="DstFile" Type="Type" Filename="pipeline_path.typ"/>
<COMMENTS></COMMENTS>
<LOG>Sat Feb 18 13:50:40 2012 (Kaetemi) Dfn Parents =
Sat Feb 18 13:58:21 2012 (Kaetemi) Dfn Structure =
Sat Feb 18 14:19:17 2012 (Kaetemi) Dfn Structure =
Fri Mar 02 21:20:17 2012 (Kaetemi) Header Comments = dfsd
Fri Mar 02 21:20:22 2012 (Kaetemi) Header State = 1</LOG>
Fri Mar 02 21:20:22 2012 (Kaetemi) Header State = 1
Sun Aug 05 21:13:38 2012 (kaetemi) Dfn Structure = </LOG>
</DFN>

@ -16,6 +16,7 @@
<ATOM Value="[$DatabaseDirectory]/interfaces/v3_doc/htm"/>
<ATOM Value="[$DatabaseDirectory]/interfaces/v3_doc"/>
<ATOM Value="[$DatabaseDirectory]/interfaces/v3_quick_help"/>
<ATOM Value="[$DatabaseDirectory]/interfaces/v3_quick_help/graph"/>
<ATOM Value="[$DatabaseDirectory]/interfaces/r2_3d"/>
</ARRAY>
<ATOM Name="DstFile" Value="[$PackageDirectory]/interfaces.bnp"/>

Loading…
Cancel
Save