qdoc: Clear outputdir in -prepare phase only
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ø <tor.arne.vestbo@digia.com>bb10
parent
2b6edec5c2
commit
1c370b2215
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
#include <qdebug.h>
|
||||
#include "config.h"
|
||||
#include "location.h"
|
||||
|
||||
#include "generator.h"
|
||||
#include <qdir.h>
|
||||
#include <qregexp.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -260,25 +260,30 @@ QString Location::canonicalRelativePath(const QString &path) const
|
|||
|
||||
/*!
|
||||
Writes \a message and \a detals to stderr as a formatted
|
||||
warning message.
|
||||
warning message. Does not write the message if qdoc is in
|
||||
the Prepare phase.
|
||||
*/
|
||||
void Location::warning(const QString& message, const QString& details) const
|
||||
{
|
||||
emitMessage(Warning, message, details);
|
||||
if (!Generator::runPrepareOnly())
|
||||
emitMessage(Warning, message, details);
|
||||
}
|
||||
|
||||
/*!
|
||||
Writes \a message and \a detals to stderr as a formatted
|
||||
error message.
|
||||
error message. Does not write the message if qdoc is in
|
||||
the Prepare phase.
|
||||
*/
|
||||
void Location::error(const QString& message, const QString& details) const
|
||||
{
|
||||
emitMessage(Error, message, details);
|
||||
if (!Generator::runPrepareOnly())
|
||||
emitMessage(Error, message, details);
|
||||
}
|
||||
|
||||
/*!
|
||||
Writes \a message and \a detals to stderr as a formatted
|
||||
error message and then exits the program.
|
||||
error message and then exits the program. qdoc prints fatal
|
||||
errors in either phase (Prepare or Generate).
|
||||
*/
|
||||
void Location::fatal(const QString& message, const QString& details) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue