summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-02-26 15:29:27 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-12 16:11:13 +0000
commit1d7326e1bff06bda3c90f378b7ff65c46a6f968d (patch)
tree81d66084b088adf89c52c06a3581fe55a8963fc0
parent123a57edd73b65736332412ef35e7da684dd75af (diff)
Move internal linguist tools to libexec
The tools lprodump, lupdate-pro and lrelease-pro are purely internal and should not clutter the bin directory. Task-number: QTBUG-88791 Change-Id: If0d7d33b7c0571281e4d5aba92ff7e4e2638b30a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c1c4a35203629aff5cae97fff0cb794f02d85d56) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/linguist/lprodump/CMakeLists.txt1
-rw-r--r--src/linguist/lrelease-pro/CMakeLists.txt1
-rw-r--r--src/linguist/lrelease/main.cpp2
-rw-r--r--src/linguist/lupdate-pro/CMakeLists.txt1
-rw-r--r--src/linguist/lupdate/main.cpp2
-rw-r--r--src/linguist/shared/runqttool.cpp17
-rw-r--r--src/linguist/shared/runqttool.h5
7 files changed, 20 insertions, 9 deletions
diff --git a/src/linguist/lprodump/CMakeLists.txt b/src/linguist/lprodump/CMakeLists.txt
index 03a48ff4c..5195e24b6 100644
--- a/src/linguist/lprodump/CMakeLists.txt
+++ b/src/linguist/lprodump/CMakeLists.txt
@@ -8,6 +8,7 @@ qt_get_tool_target_name(target_name lprodump)
qt_internal_add_tool(${target_name}
TARGET_DESCRIPTION "Qt Linguist QMake Project Dump Tool"
TOOLS_TARGET Linguist # special case
+ INSTALL_DIR "${INSTALL_LIBEXECDIR}"
SOURCES
../shared/ioutils.cpp ../shared/ioutils.h
../shared/profileevaluator.cpp ../shared/profileevaluator.h
diff --git a/src/linguist/lrelease-pro/CMakeLists.txt b/src/linguist/lrelease-pro/CMakeLists.txt
index 74487447c..b1c314ef0 100644
--- a/src/linguist/lrelease-pro/CMakeLists.txt
+++ b/src/linguist/lrelease-pro/CMakeLists.txt
@@ -8,6 +8,7 @@ qt_get_tool_target_name(target_name lrelease-pro)
qt_internal_add_tool(${target_name}
TARGET_DESCRIPTION "Qt Translation File Compiler for QMake Projects"
TOOLS_TARGET Linguist # special case
+ INSTALL_DIR "${INSTALL_LIBEXECDIR}"
SOURCES
../shared/runqttool.cpp ../shared/runqttool.h
main.cpp
diff --git a/src/linguist/lrelease/main.cpp b/src/linguist/lrelease/main.cpp
index 202a6de7f..95617a8a4 100644
--- a/src/linguist/lrelease/main.cpp
+++ b/src/linguist/lrelease/main.cpp
@@ -288,7 +288,7 @@ int main(int argc, char **argv)
QString errorString;
if (!extractProFiles(&inputFiles).isEmpty()) {
- runQtTool(QStringLiteral("lrelease-pro"), app.arguments().mid(1));
+ runInternalQtTool(QStringLiteral("lrelease-pro"), app.arguments().mid(1));
return 0;
}
diff --git a/src/linguist/lupdate-pro/CMakeLists.txt b/src/linguist/lupdate-pro/CMakeLists.txt
index 765bf0103..104f6c96f 100644
--- a/src/linguist/lupdate-pro/CMakeLists.txt
+++ b/src/linguist/lupdate-pro/CMakeLists.txt
@@ -8,6 +8,7 @@ qt_get_tool_target_name(target_name lupdate-pro)
qt_internal_add_tool(${target_name}
TARGET_DESCRIPTION "Qt Translation File Update Tool for QMake Projects"
TOOLS_TARGET Linguist # special case
+ INSTALL_DIR "${INSTALL_LIBEXECDIR}"
SOURCES
../shared/runqttool.cpp ../shared/runqttool.h
main.cpp
diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp
index 77e5c29bc..95620d0b4 100644
--- a/src/linguist/lupdate/main.cpp
+++ b/src/linguist/lupdate/main.cpp
@@ -1004,7 +1004,7 @@ int main(int argc, char **argv)
QString errorString;
if (!proFiles.isEmpty()) {
- runQtTool(QStringLiteral("lupdate-pro"), app.arguments().mid(1));
+ runInternalQtTool(QStringLiteral("lupdate-pro"), app.arguments().mid(1));
return 0;
}
diff --git a/src/linguist/shared/runqttool.cpp b/src/linguist/shared/runqttool.cpp
index 1bf043a3e..caf1e4135 100644
--- a/src/linguist/shared/runqttool.cpp
+++ b/src/linguist/shared/runqttool.cpp
@@ -45,10 +45,9 @@ class FMT {
Q_DECLARE_TR_FUNCTIONS(Linguist)
};
-static QString qtToolFilePath(const QString &toolName)
+static QString qtToolFilePath(const QString &toolName, QLibraryInfo::LibraryPath location)
{
- QString filePath = QCoreApplication::instance()->applicationDirPath()
- + QLatin1Char('/') + toolName;
+ QString filePath = QLibraryInfo::path(location) + QLatin1Char('/') + toolName;
#ifdef Q_OS_WIN
filePath.append(QLatin1String(".exe"));
#endif
@@ -89,10 +88,11 @@ static QString commandLineForSystem(const QString &program,
+ shellQuoted(arguments).join(QLatin1Char(' '));
}
-void runQtTool(const QString &toolName, const QStringList &arguments)
+void runQtTool(const QString &toolName, const QStringList &arguments,
+ QLibraryInfo::LibraryPath location)
{
int exitCode = 0;
- const QString commandLine = commandLineForSystem(qtToolFilePath(toolName), arguments);
+ const QString commandLine = commandLineForSystem(qtToolFilePath(toolName, location), arguments);
#if defined(Q_OS_WIN)
exitCode = _wsystem(reinterpret_cast<const wchar_t *>(commandLine.utf16()));
#elif defined(Q_OS_UNIX)
@@ -105,6 +105,11 @@ void runQtTool(const QString &toolName, const QStringList &arguments)
exit(exitCode);
}
+void runInternalQtTool(const QString &toolName, const QStringList &arguments)
+{
+ runQtTool(toolName, arguments, QLibraryInfo::LibraryExecutablesPath);
+}
+
std::unique_ptr<QTemporaryFile> createProjectDescription(QStringList args)
{
std::unique_ptr<QTemporaryFile> file(new QTemporaryFile(QStringLiteral("XXXXXX.json")));
@@ -114,6 +119,6 @@ std::unique_ptr<QTemporaryFile> createProjectDescription(QStringList args)
}
file->close();
args << QStringLiteral("-out") << file->fileName();
- runQtTool(QStringLiteral("lprodump"), args);
+ runInternalQtTool(QStringLiteral("lprodump"), args);
return file;
}
diff --git a/src/linguist/shared/runqttool.h b/src/linguist/shared/runqttool.h
index 16fe54fde..4d92066ce 100644
--- a/src/linguist/shared/runqttool.h
+++ b/src/linguist/shared/runqttool.h
@@ -29,13 +29,16 @@
#ifndef RUNQTTOOL_H
#define RUNQTTOOL_H
+#include <QtCore/qlibraryinfo.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qtemporaryfile.h>
#include <memory>
-void runQtTool(const QString &toolName, const QStringList &arguments);
+void runQtTool(const QString &toolName, const QStringList &arguments,
+ QLibraryInfo::LibraryPath location = QLibraryInfo::BinariesPath);
+void runInternalQtTool(const QString &toolName, const QStringList &arguments);
std::unique_ptr<QTemporaryFile> createProjectDescription(QStringList args);
#endif // RUNQTTOOL_H