diff options
author | Thomas Haller <thomas.haller@redheads.de> | 2019-05-14 07:45:27 (GMT) |
---|---|---|
committer | Thomas Haller <thomas.haller@redheads.de> | 2019-05-14 11:08:53 (GMT) |
commit | 9dda0c6ddc5117f800afcb19fb8c6be031fe6c27 (patch) | |
tree | 269a05c29cd270f804d2ccd590757f803c347598 /src | |
parent | 577e3a15a0c17ce6ef7ae501116050bd6f403afd (diff) | |
download | Doxygen-9dda0c6ddc5117f800afcb19fb8c6be031fe6c27.zip Doxygen-9dda0c6ddc5117f800afcb19fb8c6be031fe6c27.tar.gz Doxygen-9dda0c6ddc5117f800afcb19fb8c6be031fe6c27.tar.bz2 |
delayed creation and update of .md5 files after successful creation of output files
Diffstat (limited to 'src')
-rw-r--r-- | src/dot.cpp | 88 | ||||
-rw-r--r-- | src/dot.h | 7 |
2 files changed, 52 insertions, 43 deletions
diff --git a/src/dot.cpp b/src/dot.cpp index d48f147..c437b16 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -764,11 +764,10 @@ static void calculateMd5Signature(QGString const & theGraph, QCString & sigStr) } /*! Checks if a file "baseName".md5 exists. If so the contents - * are compared with \a md5. If equal FALSE is returned. If the .md5 - * file does not exist or its contents are not equal to \a md5, - * a new .md5 is generated with the \a md5 string as contents. + * are compared with \a md5. If equal FALSE is returned. + * The .md5 is created or updated after successful creation of the output file. */ -static bool checkAndUpdateMd5Signature(const QCString &baseName, +static bool checkMd5Signature(const QCString &baseName, const QCString &md5) { QFile f(baseName+".md5"); @@ -786,12 +785,6 @@ static bool checkAndUpdateMd5Signature(const QCString &baseName, } } f.close(); - // create checksum file - if (f.open(IO_WriteOnly)) - { - f.writeBlock(md5.data(),32); - f.close(); - } return TRUE; } @@ -830,12 +823,12 @@ int DotNodeList::compareValues(const DotNode *n1,const DotNode *n2) const //-------------------------------------------------------------------- -DotRunner::DotRunner(const QCString &file,const QCString &path, - bool checkResult,const QCString &imageName) +DotRunner::DotRunner(const QCString& baseName, const QCString& path, const QCString& md5Hash, + bool checkResult, const QCString& imageName) : m_dotExe(Config_getString(DOT_PATH)+"dot"), - m_file(file), m_path(path), + m_baseName(baseName), m_path(path), m_checkResult(checkResult), m_imageName(imageName), - m_imgExt(getDotImageExtension()) + m_imgExt(getDotImageExtension()), m_md5Hash(md5Hash) { static bool dotCleanUp = Config_getBool(DOT_CLEANUP); static bool dotMultiTargets = Config_getBool(DOT_MULTI_TARGETS); @@ -866,14 +859,14 @@ bool DotRunner::run() DotConstString *s; if (m_multiTargets) { - dotArgs=QCString("\"")+m_file.data()+"\""; + dotArgs=QCString("\"")+m_baseName.data()+".dot\""; for (li.toFirst();(s=li.current());++li) { dotArgs+=' '; dotArgs+=s->data(); } if ((exitCode=portable_system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; - dotArgs=QCString("\"")+m_file.data()+"\""; + dotArgs=QCString("\"")+m_baseName.data()+".dot\""; bool redo = FALSE; for (li.toFirst();(s=li.current());++li) { @@ -898,7 +891,7 @@ bool DotRunner::run() { for (li.toFirst();(s=li.current());++li) { - dotArgs=QCString("\"")+m_file.data()+"\" "+s->data(); + dotArgs=QCString("\"")+m_baseName.data()+".dot\" "+s->data(); if ((exitCode=portable_system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; if (s->pdfData()) { @@ -924,9 +917,18 @@ bool DotRunner::run() { //printf("removing dot file %s\n",m_file.data()); //QDir(path).remove(file); - m_cleanupItem.file.set(m_file.data()); + m_cleanupItem.file.set((QCString(m_baseName.data()) + ".dot").data()); m_cleanupItem.path.set(m_path.data()); } + if (!m_md5Hash.isEmpty()) { + // create checksum file + QFile f(QCString(m_baseName.data())+".md5"); + if (f.open(IO_WriteOnly)) + { + f.writeBlock(m_md5Hash.data(),32); + f.close(); + } + } return TRUE; error: err("Problems running dot: exit code=%d, command='%s', arguments='%s'\n", @@ -2404,7 +2406,7 @@ void DotGfxHierarchyTable::createGraph(DotNode *n,FTextStream &out, calculateMd5Signature(theGraph, sigStr); bool regenerate=FALSE; - if (checkAndUpdateMd5Signature(absBaseName,sigStr) || + if (checkMd5Signature(absBaseName,sigStr) || !checkDeliverables(absImgName,absMapName)) { regenerate=TRUE; @@ -2416,7 +2418,7 @@ void DotGfxHierarchyTable::createGraph(DotNode *n,FTextStream &out, t << theGraph; f.close(); - DotRunner *dotRun = new DotRunner(dotName,d.absPath().data(),TRUE,absImgName); + DotRunner *dotRun = new DotRunner(absBaseName,d.absPath().data(),sigStr,TRUE,absImgName); dotRun->addJob(imgFmt,absImgName); dotRun->addJob(MAP_CMD,absMapName); DotManager::instance()->addRun(dotRun); @@ -3190,12 +3192,13 @@ static bool updateDotGraph(DotNode *root, const QCString &rank, bool renderParents, bool backArrows, + QCString & md5, const QCString &title=QCString() ) { QCString theGraph; // TODO: write graph to theGraph, then compute md5 checksum - QCString md5 = computeMd5Signature( + md5 = computeMd5Signature( root,gt,format,rank,renderParents, backArrows,title,theGraph); QFile f(baseName+".dot"); @@ -3204,7 +3207,7 @@ static bool updateDotGraph(DotNode *root, FTextStream t(&f); t << theGraph; } - return checkAndUpdateMd5Signature(baseName,md5); // graph needs to be regenerated + return checkMd5Signature(baseName,md5); // graph needs to be regenerated } QCString DotClassGraph::writeGraph(FTextStream &out, @@ -3253,6 +3256,7 @@ QCString DotClassGraph::writeGraph(FTextStream &out, QCString absImgName = absBaseName+"."+imgExt; bool regenerate = FALSE; + QCString md5; if (updateDotGraph(m_startNode, m_graphType, absBaseName, @@ -3260,6 +3264,7 @@ QCString DotClassGraph::writeGraph(FTextStream &out, m_lrRank ? "LR" : "", m_graphType==DotNode::Inheritance, TRUE, + md5, m_startNode->label() ) || !checkDeliverables(graphFormat==GOF_BITMAP ? absImgName : @@ -3270,8 +3275,8 @@ QCString DotClassGraph::writeGraph(FTextStream &out, regenerate=TRUE; if (graphFormat==GOF_BITMAP) // run dot to create a bitmap image { - DotRunner *dotRun = new DotRunner(absDotName, - d.absPath().data(),TRUE,absImgName); + DotRunner *dotRun = new DotRunner(absBaseName, + d.absPath().data(), md5, TRUE,absImgName); dotRun->addJob(imgFmt,absImgName); if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName); DotManager::instance()->addRun(dotRun); @@ -3279,7 +3284,7 @@ QCString DotClassGraph::writeGraph(FTextStream &out, } else if (graphFormat==GOF_EPS) // run dot to create a .eps image { - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),FALSE); + DotRunner *dotRun = new DotRunner(absBaseName, d.absPath().data(), md5, FALSE); if (usePDFLatex) { dotRun->addJob("pdf",absPdfName,absBaseName); @@ -3599,6 +3604,7 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out, QCString absImgName = absBaseName+"."+imgExt; bool regenerate = FALSE; + QCString md5; if (updateDotGraph(m_startNode, DotNode::Dependency, absBaseName, @@ -3606,6 +3612,7 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out, "", // lrRank FALSE, // renderParents m_inverse, // backArrows + md5, m_startNode->label() ) || !checkDeliverables(graphFormat==GOF_BITMAP ? absImgName : @@ -3617,14 +3624,14 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out, if (graphFormat==GOF_BITMAP) { // run dot to create a bitmap image - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),TRUE,absImgName); + DotRunner *dotRun = new DotRunner(absBaseName, d.absPath().data(), md5, TRUE, absImgName); dotRun->addJob(imgFmt,absImgName); if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName); DotManager::instance()->addRun(dotRun); } else if (graphFormat==GOF_EPS) { - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),FALSE); + DotRunner *dotRun = new DotRunner(absBaseName, d.absPath().data(), md5, FALSE); if (usePDFLatex) { dotRun->addJob("pdf",absPdfName,absBaseName); @@ -3914,7 +3921,7 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat graphForma QCString absImgName = absBaseName+"."+imgExt; bool regenerate = FALSE; - + QCString md5; if (updateDotGraph(m_startNode, DotNode::CallGraph, absBaseName, @@ -3922,6 +3929,7 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat graphForma m_inverse ? "RL" : "LR", // lrRank FALSE, // renderParents m_inverse, // backArrows + md5, m_startNode->label() ) || !checkDeliverables(graphFormat==GOF_BITMAP ? absImgName : @@ -3933,7 +3941,7 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat graphForma if (graphFormat==GOF_BITMAP) { // run dot to create a bitmap image - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),TRUE,absImgName); + DotRunner *dotRun = new DotRunner(absBaseName, d.absPath().data(), md5, TRUE, absImgName); dotRun->addJob(imgFmt,absImgName); if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName); DotManager::instance()->addRun(dotRun); @@ -3942,7 +3950,7 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat graphForma else if (graphFormat==GOF_EPS) { // run dot to create a .eps image - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),FALSE); + DotRunner *dotRun = new DotRunner(absBaseName, d.absPath().data(), md5, FALSE); if (usePDFLatex) { dotRun->addJob("pdf",absPdfName,absBaseName); @@ -4077,7 +4085,7 @@ QCString DotDirDeps::writeGraph(FTextStream &out, QCString sigStr(33); calculateMd5Signature(theGraph, sigStr); bool regenerate=FALSE; - if (checkAndUpdateMd5Signature(absBaseName,sigStr) || + if (checkMd5Signature(absBaseName,sigStr) || !checkDeliverables(graphFormat==GOF_BITMAP ? absImgName : usePDFLatex ? absPdfName : absEpsName, graphFormat==GOF_BITMAP && generateImageMap ? absMapName : QCString()) @@ -4097,14 +4105,14 @@ QCString DotDirDeps::writeGraph(FTextStream &out, if (graphFormat==GOF_BITMAP) { // run dot to create a bitmap image - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),TRUE,absImgName); + DotRunner *dotRun = new DotRunner(absBaseName, d.absPath().data(), sigStr, TRUE, absImgName); dotRun->addJob(imgFmt,absImgName); if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName); DotManager::instance()->addRun(dotRun); } else if (graphFormat==GOF_EPS) { - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),FALSE); + DotRunner *dotRun = new DotRunner(absBaseName, d.absPath().data(), sigStr, FALSE); if (usePDFLatex) { dotRun->addJob("pdf",absPdfName,absBaseName); @@ -4223,7 +4231,7 @@ void generateGraphLegend(const char *path) QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT); QCString imgName = "graph_legend."+imgExt; QCString absImgName = absBaseName+"."+imgExt; - if (checkAndUpdateMd5Signature(absBaseName,sigStr) || + if (checkMd5Signature(absBaseName,sigStr) || !checkDeliverables(absImgName)) { QFile dotFile(absDotName); @@ -4239,7 +4247,7 @@ void generateGraphLegend(const char *path) // run dot to generate the a bitmap image from the graph - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),TRUE,absImgName); + DotRunner *dotRun = new DotRunner(absBaseName, d.absPath().data(),sigStr,TRUE,absImgName); dotRun->addJob(imgFmt,absImgName); DotManager::instance()->addRun(dotRun); } @@ -4274,7 +4282,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, QCString absImgName = d.absPath().utf8()+"/"+imgName; QCString absOutFile = d.absPath().utf8()+"/"+outFile; - DotRunner dotRun(inFile,d.absPath().data(),FALSE,absImgName); + DotRunner dotRun(inFile,d.absPath().data(),QCString(),FALSE,absImgName); if (format==GOF_BITMAP) dotRun.addJob(imgFmt,absImgName); else // format==GOF_EPS @@ -4329,7 +4337,7 @@ void writeDotImageMapFromFile(FTextStream &t, QCString imgName = baseName+"."+imgExt; QCString absOutFile = d.absPath().utf8()+"/"+mapName; - DotRunner dotRun(inFile,d.absPath().data(),FALSE); + DotRunner dotRun(baseName,d.absPath().data(),QCString(),FALSE); dotRun.addJob(MAP_CMD,absOutFile); dotRun.preventCleanUp(); if (!dotRun.run()) @@ -4641,7 +4649,7 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t, QCString absPdfName = absBaseName+".pdf"; QCString absEpsName = absBaseName+".eps"; bool regenerate=FALSE; - if (checkAndUpdateMd5Signature(absBaseName,sigStr) || + if (checkMd5Signature(absBaseName,sigStr) || !checkDeliverables(graphFormat==GOF_BITMAP ? absImgName : usePDFLatex ? absPdfName : absEpsName, graphFormat==GOF_BITMAP /*&& generateImageMap*/ ? absMapName : QCString()) @@ -4659,7 +4667,7 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t, if (graphFormat==GOF_BITMAP) // run dot to create a bitmap image { - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),FALSE); + DotRunner *dotRun = new DotRunner(absBaseName,d.absPath().data(),sigStr,FALSE); dotRun->addJob(imgFmt,absImgName); if (writeImageMap) dotRun->addJob(MAP_CMD,absMapName); DotManager::instance()->addRun(dotRun); @@ -4667,7 +4675,7 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t, } else if (graphFormat==GOF_EPS) { - DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),FALSE); + DotRunner *dotRun = new DotRunner(absBaseName,d.absPath().data(),sigStr,FALSE); if (usePDFLatex) { dotRun->addJob("pdf",absPdfName,absBaseName); @@ -393,8 +393,8 @@ class DotRunner }; /** Creates a runner for a dot \a file. */ - DotRunner(const QCString &file,const QCString &fontPath,bool checkResult, - const QCString &imageName = QCString()); + DotRunner(const QCString& baseName, const QCString& path, const QCString& md5Hash, + bool checkResult, const QCString &imageName = QCString()); /** Adds an additional job to the run. * Performing multiple jobs one file can be faster. @@ -415,13 +415,14 @@ class DotRunner QList<DotConstString> m_jobs; DotConstString m_postArgs; DotConstString m_postCmd; - DotConstString m_file; + DotConstString m_baseName; DotConstString m_path; bool m_checkResult; DotConstString m_imageName; DotConstString m_imgExt; bool m_cleanUp; CleanupItem m_cleanupItem; + DotConstString m_md5Hash; }; /** Helper class to insert a set of map file into an output file */ |