Changed: #1440 Write the depend log

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 7d38c69820
commit 31744c25cc

@ -474,7 +474,7 @@ int main(int nNbArg, char **ppArgs)
string findTGAName; string findTGAName;
for (i = 0; i < mapSize; ++i) for (i = 0; i < mapSize; ++i)
{ {
// get the string whitout path // get the string without path
findTGAName = toLower(CFile::getFilename(AllMapNames[i])); findTGAName = toLower(CFile::getFilename(AllMapNames[i]));
if( findTGAName == sTGAname ) if( findTGAName == sTGAname )
break; break;

@ -82,6 +82,9 @@ public:
/// Get the temporary directory for the current process. The directory must be deleted when the process ends. May return random temporary directories if no process is running. /// Get the temporary directory for the current process. The directory must be deleted when the process ends. May return random temporary directories if no process is running.
virtual std::string getTempDirectory() = 0; virtual std::string getTempDirectory() = 0;
/// Delete a directory if it's empty
virtual void deleteDirectoryIfEmpty(const std::string &path) = 0;
/// Get a value from the currently active project configuration. If false, don't use, no need to write warnings to service log, already written, set exit state and exit if necessary /// Get a value from the currently active project configuration. If false, don't use, no need to write warnings to service log, already written, set exit state and exit if necessary
virtual bool getValue(std::string &result, const std::string &name) = 0; virtual bool getValue(std::string &result, const std::string &name) = 0;
virtual bool getValues(std::vector<std::string> &resultAppend, const std::string &name) = 0; virtual bool getValues(std::vector<std::string> &resultAppend, const std::string &name) = 0;

@ -51,11 +51,11 @@ CProcessInterface::~CProcessInterface()
} }
void CProcessInterface::buildAtlas(const std::vector<std::string> &srcDirectories, const std::string &dstFile) void CProcessInterface::buildAtlas(const std::string &dependLog, const std::string &errorLog, const std::vector<std::string> &srcDirectories, const std::string &dstFile)
{ {
nldebug("Build atlas '%s'", dstFile.c_str()); nldebug("Build atlas '%s'", dstFile.c_str());
std::stringstream ss; std::stringstream ss;
ss << "build_interface " << dstFile; ss << "build_interface -d" << dependLog << " -e" << errorLog << " " << dstFile;
for (std::vector<std::string>::const_iterator it = srcDirectories.begin(), end = srcDirectories.end(); it != end; ++it) for (std::vector<std::string>::const_iterator it = srcDirectories.begin(), end = srcDirectories.end(); it != end; ++it)
{ {
const std::string &path = *it; const std::string &path = *it;
@ -68,6 +68,10 @@ void CProcessInterface::build()
{ {
nldebug("Building process interface!"); nldebug("Building process interface!");
std::string tempDir = m_PipelineProcess->getTempDirectory();
std::string dependLog = tempDir + "depend.log";
std::string errorLog = tempDir + "error.log";
{ {
uint nb; uint nb;
if (m_PipelineProcess->getValueNb(nb, "Interface.Atlas")) if (m_PipelineProcess->getValueNb(nb, "Interface.Atlas"))
@ -86,10 +90,13 @@ void CProcessInterface::build()
ss << "Interface.Atlas[" << i << "].DstFile"; ss << "Interface.Atlas[" << i << "].DstFile";
if (!m_PipelineProcess->getValue(dstFile, ss.str())) break; if (!m_PipelineProcess->getValue(dstFile, ss.str())) break;
} }
if (m_PipelineProcess->needsToBeRebuilt(srcDirectories, dstFile)) std::vector<std::string> dstFiles;
dstFiles.push_back(dstFile); // .tga
dstFiles.push_back(dstFile.substr(0, dstFile.size() - 3) + "txt"); // .txt
if (m_PipelineProcess->needsToBeRebuilt(srcDirectories, dstFiles))
{ {
m_PipelineProcess->makePaths(dstFile); m_PipelineProcess->makePaths(dstFiles);
buildAtlas(srcDirectories, dstFile); buildAtlas(dependLog, errorLog, srcDirectories, dstFile);
m_PipelineProcess->parseToolLog("", "", false); m_PipelineProcess->parseToolLog("", "", false);
} }
if (m_PipelineProcess->needsExit()) return; if (m_PipelineProcess->needsExit()) return;
@ -97,6 +104,7 @@ void CProcessInterface::build()
} }
} }
m_PipelineProcess->deleteDirectoryIfEmpty(tempDir);
m_PipelineProcess->setExit(FINISH_ERROR, "Not yet implemented"); m_PipelineProcess->setExit(FINISH_ERROR, "Not yet implemented");
} }

@ -50,7 +50,7 @@ public:
CProcessInterface(); CProcessInterface();
virtual ~CProcessInterface(); virtual ~CProcessInterface();
void buildAtlas(const std::vector<std::string> &srcDirectories, const std::string &dstFile); void buildAtlas(const std::string &dependLog, const std::string &errorLog, const std::vector<std::string> &srcDirectories, const std::string &dstFile);
virtual void build(); virtual void build();

@ -100,6 +100,20 @@ std::string CPipelineProcessImpl::getTempDirectory()
} }
} }
void CPipelineProcessImpl::deleteDirectoryIfEmpty(const std::string &path)
{
std::vector<std::string> dummy;
NLMISC::CPath::getPathContent(path, false, true, true, dummy);
if (dummy.size())
{
nlwarning("Directory '%s' not empty", path.c_str());
}
else
{
NLMISC::CFile::deleteDirectory(path);
}
}
bool CPipelineProcessImpl::getValue(std::string &result, const std::string &name) bool CPipelineProcessImpl::getValue(std::string &result, const std::string &name)
{ {
if (m_ActiveProject == NULL) if (m_ActiveProject == NULL)

@ -60,6 +60,7 @@ public:
virtual std::string getOutputDirectory(); virtual std::string getOutputDirectory();
virtual std::string getTempDirectory(); virtual std::string getTempDirectory();
virtual void deleteDirectoryIfEmpty(const std::string &path);
virtual bool getValue(std::string &result, const std::string &name); virtual bool getValue(std::string &result, const std::string &name);
virtual bool getValues(std::vector<std::string> &resultAppend, const std::string &name); virtual bool getValues(std::vector<std::string> &resultAppend, const std::string &name);
virtual bool getValueNb(uint &result, const std::string &name); virtual bool getValueNb(uint &result, const std::string &name);

@ -47,7 +47,8 @@ namespace PIPELINE {
void CPipelineProcessImpl::parseToolLog(const std::string &dependLogFile, const std::string &errorLogFile, bool writeOutputMeta) void CPipelineProcessImpl::parseToolLog(const std::string &dependLogFile, const std::string &errorLogFile, bool writeOutputMeta)
{ {
m_SubTaskResult = FINISH_SUCCESS; m_SubTaskErrorMessage = "Log parsing not implemented, goodbye";
m_SubTaskResult = FINISH_ERROR;
} }
} /* namespace PIPELINE */ } /* namespace PIPELINE */

Loading…
Cancel
Save