diff --git a/code/nel/tools/misc/bnp_make/main.cpp b/code/nel/tools/misc/bnp_make/main.cpp index 4b7a13e49..9f4cb77b3 100644 --- a/code/nel/tools/misc/bnp_make/main.cpp +++ b/code/nel/tools/misc/bnp_make/main.cpp @@ -226,6 +226,7 @@ struct BNPHeader string gDestBNPFile; BNPHeader gBNPHeader; std::vector gDirectories; +bool gNoRecurse = false; // --------------------------------------------------------------------------- void append(const string &filename1, const string &filename2, uint32 sizeToRead) @@ -260,7 +261,7 @@ void packSubRecurse(const std::vector &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) diff --git a/code/nel/tools/pipeline/plugin_nel/process_package_bnp.cpp b/code/nel/tools/pipeline/plugin_nel/process_package_bnp.cpp index 051eb852a..c3dda0d8b 100644 --- a/code/nel/tools/pipeline/plugin_nel/process_package_bnp.cpp +++ b/code/nel/tools/pipeline/plugin_nel/process_package_bnp.cpp @@ -40,10 +40,54 @@ namespace PIPELINE { +void CProcessPackageBNP::buildPackageBNP(const std::string &dependLog, const std::string &errorLog, const std::vector &srcDirectories, const std::string &dstFile) +{ + nldebug("Build: Package BNP '%s'", dstFile.c_str()); + std::vector arguments; + arguments.push_back("/p"); + arguments.push_back(dstFile); + for (std::vector::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 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 &resultAppend) diff --git a/code/nel/tools/pipeline/plugin_nel/process_package_bnp.h b/code/nel/tools/pipeline/plugin_nel/process_package_bnp.h index 03a19273c..b759f4e14 100644 --- a/code/nel/tools/pipeline/plugin_nel/process_package_bnp.h +++ b/code/nel/tools/pipeline/plugin_nel/process_package_bnp.h @@ -51,6 +51,8 @@ public: CProcessPackageBNP() { } virtual ~CProcessPackageBNP() { } + void buildPackageBNP(const std::string &dependLog, const std::string &errorLog, const std::vector &srcDirectories, const std::string &dstFile); + virtual void build(); NLMISC_DECLARE_CLASS(CProcessPackageBNP) diff --git a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_default.cfg b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_default.cfg index 3e8d28dfc..3644ea6d8 100644 --- a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_default.cfg +++ b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_default.cfg @@ -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! diff --git a/code/nel/tools/pipeline/service/pipeline_process_impl.cpp b/code/nel/tools/pipeline/service/pipeline_process_impl.cpp index b6480fe60..b410217e9 100644 --- a/code/nel/tools/pipeline/service/pipeline_process_impl.cpp +++ b/code/nel/tools/pipeline/service/pipeline_process_impl.cpp @@ -186,6 +186,7 @@ void CPipelineProcessImpl::runConsoleTool(const std::string &executablePath, con ss << executablePath; for (std::vector::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(); diff --git a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_process_package_bnp.dfn b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_process_package_bnp.dfn index ca5b90619..c4b4e8452 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_process_package_bnp.dfn +++ b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_process_package_bnp.dfn @@ -1,12 +1,12 @@ - + - + - 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 +Fri Mar 02 21:20:22 2012 (Kaetemi) Header State = 1 +Sun Aug 05 21:13:38 2012 (kaetemi) Dfn Structure = diff --git a/code/ryzom/common/data_leveldesign/leveldesign/pipeline/packages/interfaces.pipeline_package b/code/ryzom/common/data_leveldesign/leveldesign/pipeline/packages/interfaces.pipeline_package index 98f4cbcfe..fe8c3f6ad 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/pipeline/packages/interfaces.pipeline_package +++ b/code/ryzom/common/data_leveldesign/leveldesign/pipeline/packages/interfaces.pipeline_package @@ -16,6 +16,7 @@ +