From 5a1e30df86bd54f0abe02bf369caa0a20912c9a4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 11 Oct 2012 14:04:21 +0200 Subject: qdoc: qdoc now can run in 2 passes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two command line options have been added, -prepare and -generate. If you run qdoc with -prepare, qdoc reads and parses the source files but does not generate the documentation. It only creates the .index file for the module you are running qdoc on. If you run qdoc with -generate, qdoc reads and parses the source files as well as the .index files created by running qdoc with -prepare, and it generates the documentation but no .index file. If you run without either option, qdoc runs as before, i.e. it runs both passes as a single pass. Task number: QTBUG-27539 Change-Id: Idbfe3f0f9dff58283596b504f00dff3f70f6e371 Reviewed-by: Tor Arne Vestbø --- src/tools/qdoc/generator.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/tools/qdoc/generator.cpp') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 1c7727db70..c6db340f74 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -96,6 +96,7 @@ QStringList Generator::styleDirs; QStringList Generator::styleFiles; bool Generator::debugging_ = false; bool Generator::noLinkErrors_ = false; +Generator::Passes Generator::qdocPass_ = Both; void Generator::setDebugSegfaultFlag(bool b) { -- cgit v1.2.3 From 1c370b2215dbef4f7a9c4adcb26ede5faf980922 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 23 Oct 2012 15:11:06 +0200 Subject: qdoc: Clear outputdir in -prepare phase only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qdoc now clears the outputdir in the -prepare phase but not in the -generate phase. It also does not print error and warning messages in the -prepare phase. It does print fatal errors in the -prepare phase, of course, and the QML parser prints syntax errors in the -prepare phase, but all the qdoc errors and warnings are only printed in the -generate phase. Task number: QTBUG-27688 Change-Id: I9973a473260b4f79428f6b8e12a5ac35f3be15b4 Reviewed-by: Tor Arne Vestbø --- src/tools/qdoc/generator.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/tools/qdoc/generator.cpp') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index c6db340f74..0384765157 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -1484,22 +1484,24 @@ void Generator::initialize(const Config &config) QDir dirInfo; if (dirInfo.exists(outDir_)) { - if (!Config::removeDirContents(outDir_)) - config.lastLocation().error(tr("Cannot empty output directory '%1'").arg(outDir_)); + if (!runGenerateOnly()) { + if (!Config::removeDirContents(outDir_)) + config.lastLocation().error(tr("Cannot empty output directory '%1'").arg(outDir_)); + } } else { if (!dirInfo.mkpath(outDir_)) config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_)); } - if (!dirInfo.mkdir(outDir_ + "/images")) - config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_ + "/images")); - if (!dirInfo.mkdir(outDir_ + "/images/used-in-examples")) - config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_ + "/images/used-in-examples")); - if (!dirInfo.mkdir(outDir_ + "/scripts")) - config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_ + "/scripts")); - if (!dirInfo.mkdir(outDir_ + "/style")) - config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_ + "/style")); + if (!dirInfo.exists(outDir_ + "/images") && !dirInfo.mkdir(outDir_ + "/images")) + config.lastLocation().fatal(tr("Cannot create images directory '%1'").arg(outDir_ + "/images")); + if (!dirInfo.exists(outDir_ + "/images/used-in-examples") && !dirInfo.mkdir(outDir_ + "/images/used-in-examples")) + config.lastLocation().fatal(tr("Cannot create images used in examples directory '%1'").arg(outDir_ + "/images/used-in-examples")); + if (!dirInfo.exists(outDir_ + "/scripts") && !dirInfo.mkdir(outDir_ + "/scripts")) + config.lastLocation().fatal(tr("Cannot create scripts directory '%1'").arg(outDir_ + "/scripts")); + if (!dirInfo.exists(outDir_ + "/style") && !dirInfo.mkdir(outDir_ + "/style")) + config.lastLocation().fatal(tr("Cannot create style directory '%1'").arg(outDir_ + "/style")); } imageFiles = config.getCleanPathList(CONFIG_IMAGES); -- cgit v1.2.3 From 2cf7aceb4ecb73b47494f1058224eb44b39f0d55 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 8 Nov 2012 15:22:10 +0100 Subject: qdoc: better copying of .css files This fix searches for the css files specified in the stylesheets variable. It searches for them in the directory specified as the templatedir. It copies them into the style subdirectory of the outputdir. Task-number: QTBUG-27878 Change-Id: Ic9ff43ab6f939cb50f1b41a9cc58f3f8686ebaf5 Reviewed-by: Jerome Pasion --- src/tools/qdoc/generator.cpp | 86 +++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 46 deletions(-) (limited to 'src/tools/qdoc/generator.cpp') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 0384765157..67e18b45dd 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -1546,55 +1546,49 @@ void Generator::initialize(const Config &config) } // Documentation template handling - QString templateDir = config.getString((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR); - QStringList searchDirs; - if (!templateDir.isEmpty()) { - searchDirs.append(templateDir); - } - if (!Config::installDir.isEmpty()) { - searchDirs.append(Config::installDir); + QString templateDir = config.getString((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR); + if (templateDir.isEmpty()) + templateDir = "."; + searchDirs.append(templateDir); + + QStringList noExts; + QStringList scripts = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS); + e = scripts.constBegin(); + while (e != scripts.constEnd()) { + QString userFriendlyFilePath; + QString filePath = Config::findFile(config.lastLocation(), + scriptFiles, + searchDirs, + *e, + noExts, + userFriendlyFilePath); + if (!filePath.isEmpty()) + Config::copyFile(config.lastLocation(), + filePath, + userFriendlyFilePath, + (*g)->outputDir() + + "/scripts"); + ++e; } - if (!searchDirs.isEmpty()) { - QStringList noExts; - QStringList scripts = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS); - e = scripts.constBegin(); - while (e != scripts.constEnd()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - scriptFiles, - searchDirs, - *e, - noExts, - userFriendlyFilePath); - if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - userFriendlyFilePath, - (*g)->outputDir() + - "/scripts"); - ++e; - } - - QStringList styles = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS); - e = styles.constBegin(); - while (e != styles.constEnd()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - styleFiles, - searchDirs, - *e, - noExts, - userFriendlyFilePath); - if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - userFriendlyFilePath, - (*g)->outputDir() + - "/style"); - ++e; - } + QStringList styles = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS); + e = styles.constBegin(); + while (e != styles.constEnd()) { + QString userFriendlyFilePath; + QString filePath = Config::findFile(config.lastLocation(), + styleFiles, + searchDirs, + *e, + noExts, + userFriendlyFilePath); + if (!filePath.isEmpty()) + Config::copyFile(config.lastLocation(), + filePath, + userFriendlyFilePath, + (*g)->outputDir() + + "/style"); + ++e; } } ++g; -- cgit v1.2.3 From 6326746d226fa55175a83d6b197630d75cd6a9cb Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Nov 2012 15:33:02 +0100 Subject: qdoc: better copying of .css files This fix searches for the css files specified in the stylesheets variable. It searches for them in the directory specified as the templatedir. It copies them into the style subdirectory of the outputdir. It also tests QT_INSTALL_DOCS before setting it to the library info. If it was set on the command line, it is not set from the library info. This change also includes some debug code, which will be removed after testing. Task-number: QTBUG-27878 Change-Id: I7a9469b840e13b966aca44b99aebba102e5d4f0c Reviewed-by: Jerome Pasion --- src/tools/qdoc/generator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/tools/qdoc/generator.cpp') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 67e18b45dd..b728aa363a 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -1548,10 +1548,10 @@ void Generator::initialize(const Config &config) // Documentation template handling QStringList searchDirs; QString templateDir = config.getString((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR); + qDebug() << "TEMPLATEDIR:" << templateDir << (*g)->format() + Config::dot + CONFIG_TEMPLATEDIR; if (templateDir.isEmpty()) templateDir = "."; searchDirs.append(templateDir); - QStringList noExts; QStringList scripts = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS); e = scripts.constBegin(); @@ -1573,6 +1573,10 @@ void Generator::initialize(const Config &config) } QStringList styles = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS); + qDebug() << "STYLES:" << styles; + qDebug() << "SEARCHDIRS:" << searchDirs; + qDebug() << "STYLEFILES:" << styleFiles; + Config::debug = true; e = styles.constBegin(); while (e != styles.constEnd()) { QString userFriendlyFilePath; @@ -1582,6 +1586,7 @@ void Generator::initialize(const Config &config) *e, noExts, userFriendlyFilePath); + qDebug() << "FILEPATH:" << filePath; if (!filePath.isEmpty()) Config::copyFile(config.lastLocation(), filePath, @@ -1590,6 +1595,7 @@ void Generator::initialize(const Config &config) "/style"); ++e; } + Config::debug = false; } ++g; } -- cgit v1.2.3 From d4f1f4a56b87c5fee8d808705910f598b5670072 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 16 Nov 2012 11:38:32 +0100 Subject: qdoc: better copying of .css files This change ignores templatedir for css files. It assumes that the paths in the stylesheets variable are relative to the qdocconf file that contains the stylesheets variable. Task-number: QTBUG-27878 Change-Id: I2155e58f352e17d710c93ad4e92679beb169d823 Reviewed-by: Jerome Pasion --- src/tools/qdoc/generator.cpp | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'src/tools/qdoc/generator.cpp') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index b728aa363a..9529823343 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -697,12 +697,14 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) if (!best.isEmpty() && !documentedItems.contains(best)) details = tr("Maybe you meant '%1'?").arg(best); - node->doc().location().warning(tr("No such enum item '%1' in %2").arg(*a).arg(node->plainFullName()), details); + node->doc().location().warning(tr("No such enum item '%1' in %2") + .arg(*a).arg(node->plainFullName()), details); if (*a == "Void") qDebug() << "VOID:" << node->name() << definedItems; } else if (!documentedItems.contains(*a)) { - node->doc().location().warning(tr("Undocumented enum item '%1' in %2").arg(*a).arg(node->plainFullName())); + node->doc().location().warning(tr("Undocumented enum item '%1' in %2") + .arg(*a).arg(node->plainFullName())); } ++a; } @@ -1526,7 +1528,8 @@ void Generator::initialize(const Config &config) if (outputFormats.contains((*g)->format())) { currentGenerator_ = (*g); (*g)->initializeGenerator(config); - QStringList extraImages = config.getCleanPathList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format()); + QStringList extraImages = + config.getCleanPathList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format()); QStringList::ConstIterator e = extraImages.constBegin(); while (e != extraImages.constEnd()) { QString userFriendlyFilePath; @@ -1540,15 +1543,15 @@ void Generator::initialize(const Config &config) Config::copyFile(config.lastLocation(), filePath, userFriendlyFilePath, - (*g)->outputDir() + - "/images"); + (*g)->outputDir() + "/images"); ++e; } // Documentation template handling QStringList searchDirs; - QString templateDir = config.getString((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR); - qDebug() << "TEMPLATEDIR:" << templateDir << (*g)->format() + Config::dot + CONFIG_TEMPLATEDIR; + QString templateDir = config.getPath((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR); + qDebug() << "TEMPLATEDIR:" << templateDir + << (*g)->format() + Config::dot + CONFIG_TEMPLATEDIR; if (templateDir.isEmpty()) templateDir = "."; searchDirs.append(templateDir); @@ -1567,35 +1570,24 @@ void Generator::initialize(const Config &config) Config::copyFile(config.lastLocation(), filePath, userFriendlyFilePath, - (*g)->outputDir() + - "/scripts"); + (*g)->outputDir() + "/scripts"); ++e; } - QStringList styles = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS); + //QStringList styles = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS); + QStringList styles = config.getPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS); qDebug() << "STYLES:" << styles; - qDebug() << "SEARCHDIRS:" << searchDirs; - qDebug() << "STYLEFILES:" << styleFiles; - Config::debug = true; e = styles.constBegin(); while (e != styles.constEnd()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - styleFiles, - searchDirs, - *e, - noExts, - userFriendlyFilePath); + QString filePath = *e; qDebug() << "FILEPATH:" << filePath; if (!filePath.isEmpty()) Config::copyFile(config.lastLocation(), filePath, - userFriendlyFilePath, - (*g)->outputDir() + - "/style"); + filePath, + (*g)->outputDir() + "/style"); ++e; } - Config::debug = false; } ++g; } -- cgit v1.2.3 From 0f4a1d44217ff90b1b4313b14751ea340415ddcb Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 16 Nov 2012 11:58:14 +0100 Subject: qdoc: Removed debug code Just removing calls to qDebug(). Task-number: QTBUG-27878 Change-Id: I592ddbb8541b5b65aee9e0f940b50217e84b3a5e Reviewed-by: Jerome Pasion --- src/tools/qdoc/generator.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/tools/qdoc/generator.cpp') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 9529823343..9026573ed6 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -1550,8 +1550,6 @@ void Generator::initialize(const Config &config) // Documentation template handling QStringList searchDirs; QString templateDir = config.getPath((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR); - qDebug() << "TEMPLATEDIR:" << templateDir - << (*g)->format() + Config::dot + CONFIG_TEMPLATEDIR; if (templateDir.isEmpty()) templateDir = "."; searchDirs.append(templateDir); @@ -1574,13 +1572,10 @@ void Generator::initialize(const Config &config) ++e; } - //QStringList styles = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS); QStringList styles = config.getPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS); - qDebug() << "STYLES:" << styles; e = styles.constBegin(); while (e != styles.constEnd()) { QString filePath = *e; - qDebug() << "FILEPATH:" << filePath; if (!filePath.isEmpty()) Config::copyFile(config.lastLocation(), filePath, -- cgit v1.2.3 From b75980d7f5b25ef11879305517a4036af0e324cf Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 16 Nov 2012 14:08:49 +0100 Subject: qdoc: Handle scripts exactly like styles The values of the scripts variable in the qdocconf file must now be paths that are relative to the location of the qdocconf file, just like for styles. They can be absolute paths, of course, but if they are relative, they must be relative to the qdocconf file containing the scripts variable. Task-number: QTBUG-27878 Change-Id: Iec12d1937ca9db540a2aa5e378fadc60de0a2d8c Reviewed-by: Jerome Pasion --- src/tools/qdoc/generator.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/tools/qdoc/generator.cpp') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 9026573ed6..882af2a2f3 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -1548,26 +1548,14 @@ void Generator::initialize(const Config &config) } // Documentation template handling - QStringList searchDirs; - QString templateDir = config.getPath((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR); - if (templateDir.isEmpty()) - templateDir = "."; - searchDirs.append(templateDir); - QStringList noExts; - QStringList scripts = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS); + QStringList scripts = config.getPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS); e = scripts.constBegin(); while (e != scripts.constEnd()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - scriptFiles, - searchDirs, - *e, - noExts, - userFriendlyFilePath); + QString filePath = *e; if (!filePath.isEmpty()) Config::copyFile(config.lastLocation(), filePath, - userFriendlyFilePath, + filePath, (*g)->outputDir() + "/scripts"); ++e; } -- cgit v1.2.3 From a5f2a0816b6906053a295b14a5eebcc2dce4704c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 16 Nov 2012 14:47:45 +0100 Subject: qdoc: Handle extra imahes exactly like styles The values of the extraimages variable in the qdocconf file must now be paths that are relative to the location of the qdocconf file, just like for styles. They can be absolute paths, of course, but if they are relative, they must be relative to the qdocconf file containing the extraimages variable. The extraimages variable is for including images used in the HTML heard and footer that are not referred to in the documentation. Task-number: QTBUG-27878 Change-Id: If5e0d1dee7ba231a9c1a73f02a1bbaeb7bfe52c8 Reviewed-by: Jerome Pasion --- src/tools/qdoc/generator.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'src/tools/qdoc/generator.cpp') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 882af2a2f3..2854aedbbe 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -1528,21 +1528,14 @@ void Generator::initialize(const Config &config) if (outputFormats.contains((*g)->format())) { currentGenerator_ = (*g); (*g)->initializeGenerator(config); - QStringList extraImages = - config.getCleanPathList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format()); + QStringList extraImages = config.getCleanPathList((*g)->format() + + Config::dot + + CONFIG_EXTRAIMAGES); QStringList::ConstIterator e = extraImages.constBegin(); while (e != extraImages.constEnd()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - imageFiles, - imageDirs, - *e, - imgFileExts[(*g)->format()], - userFriendlyFilePath); + QString filePath = *e; if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - userFriendlyFilePath, + Config::copyFile(config.lastLocation(), filePath, filePath, (*g)->outputDir() + "/images"); ++e; } @@ -1553,9 +1546,7 @@ void Generator::initialize(const Config &config) while (e != scripts.constEnd()) { QString filePath = *e; if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - filePath, + Config::copyFile(config.lastLocation(), filePath, filePath, (*g)->outputDir() + "/scripts"); ++e; } @@ -1565,9 +1556,7 @@ void Generator::initialize(const Config &config) while (e != styles.constEnd()) { QString filePath = *e; if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - filePath, + Config::copyFile(config.lastLocation(), filePath, filePath, (*g)->outputDir() + "/style"); ++e; } -- cgit v1.2.3