CMakePM: Copy auto package-manager to ${buildDir}/.qtc/ directory

By copying the ${IDE:ResourcePath}/package-manager to
${buildDir}/.qtc/ the problem with hardcoding paths
to old an Qt Creator version can no longer occur.

This also fixes the issue with remote projects by reffering
to the code residing on the host.

With the above issues fixed, enable "Package manager auto setup"
by default.

Change-Id: Ia49654a3b9059f83886e64d065019b2d55e9299c
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Cristian Adam
2023-02-07 18:15:58 +01:00
parent f5bd330277
commit a6ccfb09e5
7 changed files with 31 additions and 13 deletions

View File

@@ -5,7 +5,9 @@
#include "builddirparameters.h"
#include "cmakeparser.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectmanagertr.h"
#include "cmakespecificsettings.h"
#include <coreplugin/progressmanager/processprogress.h>
#include <projectexplorer/buildsystem.h>
@@ -87,6 +89,16 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
}
}
// Copy the "package-manager" CMake code from the ${IDE:ResourcePath} to the build directory
if (Internal::CMakeSpecificSettings::instance()->packageManagerAutoSetup.value()) {
const FilePath localPackageManagerDir = buildDirectory.pathAppended(Constants::PACKAGE_MANAGER_DIR);
const FilePath idePackageManagerDir = FilePath::fromString(
parameters.expander->expand(QStringLiteral("%{IDE:ResourcePath}/package-manager")));
if (!localPackageManagerDir.exists() && idePackageManagerDir.exists())
idePackageManagerDir.copyRecursively(localPackageManagerDir);
}
const auto parser = new CMakeParser;
parser->setSourceDirectory(parameters.sourceDirectory);
m_parser.addLineParser(parser);