Utils: De-noise BuildableLibrary a bit

Change-Id: Ia63fff31b55002d32fb20005c41df3db3b09f87c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-08-09 09:14:34 +02:00
parent b98b807bc9
commit ac1adc1ac0
2 changed files with 12 additions and 18 deletions

View File

@@ -200,7 +200,7 @@ bool BuildableHelperLibrary::copyFiles(const QString &sourcePath,
if (!FilePath::fromString(targetDirectory).removeRecursively(errorMessage)) if (!FilePath::fromString(targetDirectory).removeRecursively(errorMessage))
return false; return false;
if (!QDir().mkpath(targetDirectory)) { if (!QDir().mkpath(targetDirectory)) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", "The target directory %1 could not be created.").arg(targetDirectory); *errorMessage = tr("The target directory %1 could not be created.").arg(targetDirectory);
return false; return false;
} }
for (const QString &file : files) { for (const QString &file : files) {
@@ -211,7 +211,7 @@ bool BuildableHelperLibrary::copyFiles(const QString &sourcePath,
if (destInfo.lastModified() >= QFileInfo(source).lastModified()) if (destInfo.lastModified() >= QFileInfo(source).lastModified())
continue; continue;
if (!QFile::remove(dest)) { if (!QFile::remove(dest)) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", "The existing file %1 could not be removed.").arg(destInfo.absoluteFilePath()); *errorMessage = tr("The existing file %1 could not be removed.").arg(destInfo.absoluteFilePath());
return false; return false;
} }
} }
@@ -219,7 +219,7 @@ bool BuildableHelperLibrary::copyFiles(const QString &sourcePath,
QDir().mkpath(destInfo.dir().absolutePath()); QDir().mkpath(destInfo.dir().absolutePath());
if (!QFile::copy(source, dest)) { if (!QFile::copy(source, dest)) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", "The file %1 could not be copied to %2.").arg(source, dest); *errorMessage = tr("The file %1 could not be copied to %2.").arg(source, dest);
return false; return false;
} }
} }
@@ -303,22 +303,17 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
proc.setWorkingDirectory(arguments.directory); proc.setWorkingDirectory(arguments.directory);
proc.setProcessChannelMode(QProcess::MergedChannels); proc.setProcessChannelMode(QProcess::MergedChannels);
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", log->append(tr("Building helper \"%1\" in %2\n").arg(arguments.helperName, arguments.directory));
"Building helper \"%1\" in %2\n").arg(arguments.helperName,
arguments.directory));
log->append(newline); log->append(newline);
const FilePath makeFullPath = arguments.environment.searchInPath(arguments.makeCommand); const FilePath makeFullPath = arguments.environment.searchInPath(arguments.makeCommand);
if (QFileInfo::exists(arguments.directory + QLatin1String("/Makefile"))) { if (QFileInfo::exists(arguments.directory + QLatin1String("/Makefile"))) {
if (makeFullPath.isEmpty()) { if (makeFullPath.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", *errorMessage = tr("%1 not found in PATH\n").arg(arguments.makeCommand);
"%1 not found in PATH\n").arg(arguments.makeCommand);
return false; return false;
} }
const QString cleanTarget = QLatin1String("distclean"); const QString cleanTarget = QLatin1String("distclean");
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", log->append(tr("Running %1 %2...\n").arg(makeFullPath.toUserOutput(), cleanTarget));
"Running %1 %2...\n")
.arg(makeFullPath.toUserOutput(), cleanTarget));
if (!runBuildProcess(proc, makeFullPath, QStringList(cleanTarget), 30, true, log, errorMessage)) if (!runBuildProcess(proc, makeFullPath, QStringList(cleanTarget), 30, true, log, errorMessage))
return false; return false;
} }
@@ -331,20 +326,17 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
qmakeArgs << arguments.qmakeArguments; qmakeArgs << arguments.qmakeArguments;
log->append(newline); log->append(newline);
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", log->append(tr("Running %1 %2 ...\n").arg(arguments.qmakeCommand.toUserOutput(),
"Running %1 %2 ...\n").arg(arguments.qmakeCommand.toUserOutput(), qmakeArgs.join(' ')));
qmakeArgs.join(QLatin1Char(' '))));
if (!runBuildProcess(proc, arguments.qmakeCommand, qmakeArgs, 30, false, log, errorMessage)) if (!runBuildProcess(proc, arguments.qmakeCommand, qmakeArgs, 30, false, log, errorMessage))
return false; return false;
log->append(newline); log->append(newline);
if (makeFullPath.isEmpty()) { if (makeFullPath.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", *errorMessage = tr("%1 not found in PATH\n").arg(arguments.makeCommand);
"%1 not found in PATH\n").arg(arguments.makeCommand);
return false; return false;
} }
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", log->append(tr("Running %1 %2 ...\n")
"Running %1 %2 ...\n")
.arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' ')))); .arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' '))));
return runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage); return runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage);
} }

View File

@@ -34,6 +34,8 @@ namespace Utils {
class QTCREATOR_UTILS_EXPORT BuildableHelperLibrary class QTCREATOR_UTILS_EXPORT BuildableHelperLibrary
{ {
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::DebuggingHelperLibrary)
public: public:
// returns the full path to the first qmake, qmake-qt4, qmake4 that has // returns the full path to the first qmake, qmake-qt4, qmake4 that has
// at least version 2.0.0 and thus is a qt4 qmake // at least version 2.0.0 and thus is a qt4 qmake