Merge remote-tracking branch 'origin/master' into 4.11

Change-Id: Ia99614078444b3b7e1e8473b6d2708f21e89e315
This commit is contained in:
Eike Ziller
2019-10-02 07:37:13 +02:00
35 changed files with 292 additions and 298 deletions

View File

@@ -212,7 +212,7 @@ bool AndroidBuildApkStep::init()
if (!AbstractProcessStep::init())
return false;
QString command = version->qmakeProperty("QT_HOST_BINS");
QString command = version->hostBinPath().toString();
if (!command.endsWith('/'))
command += '/';
command += "androiddeployqt";
@@ -510,7 +510,6 @@ QString AndroidBuildApkStep::buildTargetSdk() const
void AndroidBuildApkStep::setBuildTargetSdk(const QString &sdk)
{
m_buildTargetSdk = sdk;
AndroidManager::updateGradleProperties(target());
}
QVariant AndroidBuildApkStep::data(Core::Id id) const

View File

@@ -104,6 +104,7 @@ QWidget *AndroidBuildApkWidget::createApplicationGroup()
connect(targetSDKComboBox, cbActivated, this, [this, targetSDKComboBox](int idx) {
const QString sdk = targetSDKComboBox->itemText(idx);
m_step->setBuildTargetSdk(sdk);
AndroidManager::updateGradleProperties(step()->target(), QString()); // FIXME: Use real key.
});
auto hbox = new QHBoxLayout(group);

View File

@@ -240,7 +240,7 @@ bool AndroidDeployQtStep::init()
emit addOutput(tr("Cannot find the androiddeploy Json file."), OutputFormat::Stderr);
return false;
}
m_command = FilePath::fromString(version->qmakeProperty("QT_HOST_BINS"));
m_command = version->hostBinPath();
if (m_command.isEmpty()) {
emit addOutput(tr("Cannot find the androiddeployqt tool."), OutputFormat::Stderr);
return false;

View File

@@ -238,9 +238,8 @@ int AndroidManager::minimumSDK(const ProjectExplorer::Kit *kit)
int minSDKVersion = -1;
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit);
if (version && version->targetDeviceTypes().contains(Constants::ANDROID_DEVICE_TYPE)) {
Utils::FilePath stockManifestFilePath =
Utils::FilePath::fromUserInput(version->qmakeProperty("QT_INSTALL_PREFIX") +
QLatin1String("/src/android/templates/AndroidManifest.xml"));
Utils::FilePath stockManifestFilePath = Utils::FilePath::fromUserInput(
version->prefix().toString() + "/src/android/templates/AndroidManifest.xml");
QDomDocument doc;
if (openXmlFile(doc, stockManifestFilePath)) {
minSDKVersion = parseMinSdk(doc.documentElement());
@@ -276,7 +275,7 @@ QJsonObject AndroidManager::deploymentSettings(const Target *target)
return {};
QJsonObject settings;
settings["_description"] = "This file is generated by QtCreator to be read by androiddeployqt and should not be modified by hand.";
settings["qt"] = qt->qmakeProperty("QT_INSTALL_PREFIX");
settings["qt"] = qt->prefix().toString();
settings["ndk"] = AndroidConfigurations::currentConfig().ndkLocation().toString();
settings["sdk"] = AndroidConfigurations::currentConfig().sdkLocation().toString();
settings["stdcpp-path"] = AndroidConfigurations::currentConfig().toolchainPath().pathAppended("sysroot/usr/lib/").toString();
@@ -683,13 +682,22 @@ static bool mergeGradleProperties(const QString &path, GradleProperties properti
}
bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target, const QString &buildKey)
{
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target->kit());
if (!version)
return false;
const ProjectNode *node = currentProjectNode(target);
QString key = buildKey;
if (key.isEmpty()) {
// FIXME: This case is triggered from AndroidBuildApkWidget::createApplicationGroup
// and should be avoided.
if (RunConfiguration *rc = target->activeRunConfiguration())
key = rc->buildKey();
}
QTC_ASSERT(!key.isEmpty(), return false);
const ProjectNode *node = target->project()->findNodeForBuildKey(key);
if (!node)
return false;
@@ -719,8 +727,8 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
const QString gradlePropertiesPath = packageSourceDir.pathAppended("gradle.properties").toString();
GradleProperties gradleProperties = readGradleProperties(gradlePropertiesPath);
gradleProperties["qt5AndroidDir"] = version->qmakeProperty("QT_INSTALL_PREFIX")
.append(QLatin1String("/src/android/java")).toLocal8Bit();
gradleProperties["qt5AndroidDir"] = (version->prefix().toString() + "/src/android/java")
.toLocal8Bit();
gradleProperties["buildDir"] = ".build";
gradleProperties["androidCompileSdkVersion"] = buildTargetSDK(target).split(QLatin1Char('-')).last().toLocal8Bit();
if (gradleProperties["androidBuildToolsVersion"].isEmpty()) {

View File

@@ -117,7 +117,7 @@ public:
static bool checkCertificatePassword(const QString &keystorePath, const QString &keystorePasswd, const QString &alias, const QString &certificatePasswd);
static bool checkCertificateExists(const QString &keystorePath, const QString &keystorePasswd,
const QString &alias);
static bool updateGradleProperties(ProjectExplorer::Target *target);
static bool updateGradleProperties(ProjectExplorer::Target *target, const QString &buildKey);
static int findApiLevel(const Utils::FilePath &platformPath);
static QProcess *runAdbCommandDetached(const QStringList &args, QString *err = nullptr,

View File

@@ -98,34 +98,6 @@ public:
class AndroidPluginPrivate : public QObject
{
public:
AndroidPluginPrivate()
{
connect(SessionManager::instance(), &SessionManager::projectAdded, this, [=](Project *project) {
for (Target *target : project->targets())
handleNewTarget(target);
connect(project, &Project::addedTarget, this, &AndroidPluginPrivate::handleNewTarget);
});
}
void handleNewTarget(Target *target)
{
if (DeviceTypeKitAspect::deviceTypeId(target->kit()) != Android::Constants::ANDROID_DEVICE_TYPE)
return;
for (BuildConfiguration *bc : target->buildConfigurations())
handleNewBuildConfiguration(bc);
connect(target, &Target::addedBuildConfiguration,
this, &AndroidPluginPrivate::handleNewBuildConfiguration);
}
void handleNewBuildConfiguration(BuildConfiguration *bc)
{
connect(bc->target()->project(), &Project::parsingFinished, bc, [bc] {
AndroidManager::updateGradleProperties(bc->target());
});
}
AndroidConfigurations androidConfiguration;
AndroidSettingsPage settingsPage;
AndroidDeployQtStepFactory deployQtStepFactory;

View File

@@ -134,6 +134,7 @@ AndroidRunConfiguration::AndroidRunConfiguration(Target *target, Core::Id id)
connect(target->project(), &Project::parsingFinished, this, [this] {
updateTargetInformation();
AndroidManager::updateGradleProperties(this->target(), buildKey());
});
}

View File

@@ -322,28 +322,26 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
if (!version)
return;
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX")
.append(QLatin1String("/src/android/java/AndroidManifest.xml")));
const QString src = version->prefix().toString() + "/src/android/java/AndroidManifest.xml";
FileUtils::copyRecursively(FilePath::fromString(src),
FilePath::fromString(m_directory + QLatin1String("/AndroidManifest.xml")),
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
} else {
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX")
.append(QLatin1String("/src/android/templates")));
const QString src = version->prefix().toString() + "/src/android/templates";
FileUtils::copyRecursively(FilePath::fromString(src),
FilePath::fromString(m_directory),
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
if (m_copyGradle) {
FilePath gradlePath = FilePath::fromString(version->qmakeProperty("QT_INSTALL_PREFIX").append(QLatin1String("/src/3rdparty/gradle")));
FilePath gradlePath = version->prefix().pathAppended("src/3rdparty/gradle");
if (!gradlePath.exists())
gradlePath = AndroidConfigurations::currentConfig().sdkLocation().pathAppended("/tools/templates/gradle/wrapper");
FileUtils::copyRecursively(gradlePath, FilePath::fromString(m_directory),
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
}
AndroidManager::updateGradleProperties(m_target);
AndroidManager::updateGradleProperties(m_target, m_buildKey);
}

View File

@@ -292,10 +292,8 @@ const QList<BuildTargetInfo> CMakeBuildConfiguration::appTargets() const
bti.runEnvModifier = [this](Environment &env, bool) {
if (HostOsInfo::isWindowsHost()) {
const Kit *k = target()->kit();
if (const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k)) {
const QString installBinPath = qt->qmakeProperty("QT_INSTALL_BINS");
env.prependOrSetPath(installBinPath);
}
if (const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k))
env.prependOrSetPath(qt->binPath().toString());
}
};

View File

@@ -1001,7 +1001,7 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
if (version && !qtInstallDirs.contains(version->qmakeProperty("QT_INSTALL_PREFIX")) && !isQt4) {
if (version && !qtInstallDirs.contains(version->prefix().toString()) && !isQt4) {
if (version->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has no CMAKE_PREFIX_PATH set "
"that points to the kit Qt version."),

View File

@@ -1,7 +1,7 @@
add_qtc_plugin(CtfVisualizer
DEPENDS Tracing Qt5::QuickWidgets
INCLUDES ${PROJECT_SOURCE_DIR}/src
PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport
PLUGIN_DEPENDS Core Debugger ProjectExplorer
SOURCES
ctfstatisticsmodel.cpp
ctfstatisticsview.cpp

View File

@@ -5,7 +5,6 @@ QtcPlugin {
Depends { name: "Core" }
Depends { name: "Debugger" }
Depends { name: "QtSupport" }
Depends { name: "Tracing" }
Depends { name: "Utils" }

View File

@@ -5,5 +5,4 @@ QTC_LIB_DEPENDS += \
tracing
QTC_PLUGIN_DEPENDS += \
debugger \
qtsupport
debugger

View File

@@ -106,7 +106,7 @@ void GenericBuildConfiguration::addToEnvironment(Utils::Environment &env) const
prependCompilerPathToEnvironment(target()->kit(), env);
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target()->kit());
if (qt)
env.prependOrSetPath(qt->binPath().toString());
env.prependOrSetPath(qt->hostBinPath().toString());
}
} // namespace Internal

View File

@@ -300,7 +300,7 @@ QStringList PerfDataReader::collectArguments(const QString &executableDirPath,
arguments << QLatin1String("--extra") << QString::fromLatin1("%1%5%2%5%3%5%4")
.arg(QDir::toNativeSeparators(qt->libraryPath().toString()))
.arg(QDir::toNativeSeparators(qt->pluginPath().toString()))
.arg(QDir::toNativeSeparators(qt->binPath().toString()))
.arg(QDir::toNativeSeparators(qt->hostBinPath().toString()))
.arg(QDir::toNativeSeparators(qt->qmlPath().toString()))
.arg(QDir::listSeparator());
}

View File

@@ -186,7 +186,7 @@ bool QbsProjectImporter::matchKit(void *directoryData, const Kit *k) const
if (!bgData->qtBinPath.isEmpty()) {
if (!qtVersion)
return false;
if (bgData->qtBinPath != qtVersion->binPath())
if (bgData->qtBinPath != qtVersion->hostBinPath())
return false;
}
if (bgData->sysroot != SysRootKitAspect::sysRoot(k))

View File

@@ -507,8 +507,8 @@ QString QmakeBuildConfiguration::extractSpecFromArguments(QString *args,
if (parsedSpec.isEmpty())
return {};
FilePath baseMkspecDir = FilePath::fromUserInput(
version->qmakeProperty("QT_HOST_DATA") + QLatin1String("/mkspecs"));
FilePath baseMkspecDir = FilePath::fromUserInput(version->hostDataPath().toString()
+ "/mkspecs");
baseMkspecDir = FilePath::fromString(baseMkspecDir.toFileInfo().canonicalFilePath());
// if the path is relative it can be
@@ -608,7 +608,7 @@ BuildInfo QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
QString projectDirectory = projectPath.toFileInfo().absolutePath();
QDir qtSourceDir = QDir(version->sourcePath().toString());
QString relativeProjectPath = qtSourceDir.relativeFilePath(projectDirectory);
QString qtBuildDir = version->qmakeProperty("QT_INSTALL_PREFIX");
QString qtBuildDir = version->prefix().toString();
QString absoluteBuildPath = QDir::cleanPath(qtBuildDir + QLatin1Char('/') + relativeProjectPath);
info.buildDirectory = FilePath::fromString(absoluteBuildPath);
@@ -672,8 +672,8 @@ void QmakeBuildConfiguration::setupBuildEnvironment(Kit *k, Environment &env)
{
prependCompilerPathToEnvironment(k, env);
const BaseQtVersion *qt = QtKitAspect::qtVersion(k);
if (qt && !qt->binPath().isEmpty())
env.prependOrSetPath(qt->binPath().toString());
if (qt && !qt->hostBinPath().isEmpty())
env.prependOrSetPath(qt->hostBinPath().toString());
}
QmakeBuildConfiguration::LastKitState::LastKitState() = default;

View File

@@ -260,8 +260,9 @@ void QmakeProject::updateCppCodeModel()
headerPaths += headerPath;
}
if (kitInfo.qtVersion && !kitInfo.qtVersion->frameworkInstallPath().isEmpty())
headerPaths += {kitInfo.qtVersion->frameworkInstallPath(), HeaderPathType::Framework};
if (kitInfo.qtVersion && !kitInfo.qtVersion->frameworkPath().isEmpty())
headerPaths += {kitInfo.qtVersion->frameworkPath().toString(),
HeaderPathType::Framework};
rpp.setHeaderPaths(headerPaths);
// Files and generators

View File

@@ -92,7 +92,7 @@ QByteArray PuppetCreator::qtHash() const
{
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit);
if (currentQtVersion) {
return QCryptographicHash::hash(currentQtVersion->qmakeProperty("QT_INSTALL_DATA").toUtf8(),
return QCryptographicHash::hash(currentQtVersion->dataPath().toString().toUtf8(),
QCryptographicHash::Sha1)
.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
}
@@ -104,7 +104,7 @@ QDateTime PuppetCreator::qtLastModified() const
{
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit);
if (currentQtVersion)
return QFileInfo(currentQtVersion->qmakeProperty("QT_INSTALL_LIBS")).lastModified();
return currentQtVersion->libraryPath().toFileInfo().lastModified();
return QDateTime();
}
@@ -422,7 +422,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(m_kit);
if (QTC_GUARD(qt)) { // Kits without a Qt version should not have a puppet!
// Update PATH to include QT_HOST_BINS
const Utils::FilePath qtBinPath = qt->binPath();
const Utils::FilePath qtBinPath = qt->hostBinPath();
environment.prependOrSetPath(qtBinPath.toString());
}
environment.set("QML_BAD_GUI_RENDER_LOOP", "true");

View File

@@ -98,7 +98,7 @@ void GenerateResource::generateMenuEntry()
return;
temp.close();
auto rccBinary = QtSupport::QtKitAspect::qtVersion(currentProject->activeTarget()->kit())->binPath();
auto rccBinary = QtSupport::QtKitAspect::qtVersion(currentProject->activeTarget()->kit())->hostBinPath();
#ifdef Q_OS_WIN
rccBinary = rccBinary.pathAppended("rcc.exe");
#else

View File

@@ -76,15 +76,15 @@ static QStringList searchPaths(Kit *kit)
if (!qtVersion)
return {};
const QDir pluginDir(qtVersion->qmakeProperty("QT_INSTALL_PLUGINS"));
const QDir pluginDir(qtVersion->pluginPath().toString());
const QStringList pluginSubDirs = pluginDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
QStringList searchPaths;
for (const QString &dir : pluginSubDirs)
searchPaths << qtVersion->qmakeProperty("QT_INSTALL_PLUGINS") + '/' + dir;
searchPaths << qtVersion->pluginPath().toString() + '/' + dir;
searchPaths << qtVersion->qmakeProperty("QT_INSTALL_LIBS");
searchPaths << qtVersion->libraryPath().toString();
searchPaths << qtVersion->qnxTarget().pathAppended(qtVersion->cpuDir() + "/lib").toString();
searchPaths << qtVersion->qnxTarget().pathAppended(qtVersion->cpuDir() + "/usr/lib").toString();

View File

@@ -234,16 +234,16 @@ QList<DeployableFile> QnxDeployQtLibrariesDialog::gatherFiles()
QTC_ASSERT(qtVersion, return result);
if (Utils::HostOsInfo::isWindowsHost()) {
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_LIBS"),
QString(), QStringList() << QLatin1String("*.so.?")));
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_LIBS")
+ QLatin1String("/fonts")));
result.append(gatherFiles(qtVersion->libraryPath().toString(),
QString(),
QStringList() << QLatin1String("*.so.?")));
result.append(gatherFiles(qtVersion->libraryPath().toString() + QLatin1String("/fonts")));
} else {
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_LIBS")));
result.append(gatherFiles(qtVersion->libraryPath().toString()));
}
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_PLUGINS")));
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_IMPORTS")));
result.append(gatherFiles(qtVersion->pluginPath().toString()));
result.append(gatherFiles(qtVersion->importsPath().toString()));
result.append(gatherFiles(qtVersion->qmlPath().toString()));
return result;

View File

@@ -130,7 +130,7 @@ void QnxQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Enviro
updateEnvironment();
env.modify(m_qnxEnv);
env.prependOrSetLibrarySearchPath(qmakeProperty("QT_INSTALL_LIBS", PropertyVariantDev));
env.prependOrSetLibrarySearchPath(libraryPath().toString());
}
Utils::Environment QnxQtVersion::qmakeRunEnvironment() const

View File

@@ -141,9 +141,11 @@ public:
const Environment &env,
QHash<ProKey, ProString> *versionInfo,
QString *error = nullptr);
enum PropertyVariant { PropertyVariantDev, PropertyVariantGet, PropertyVariantSrc };
QString qmakeProperty(const QByteArray &name, PropertyVariant variant = PropertyVariantGet);
static QString qmakeProperty(const QHash<ProKey, ProString> &versionInfo,
const QByteArray &name,
BaseQtVersion::PropertyVariant variant = BaseQtVersion::PropertyVariantGet);
PropertyVariant variant = PropertyVariantGet);
static FilePath mkspecDirectoryFromVersionInfo(const QHash<ProKey,ProString> &versionInfo);
static FilePath mkspecFromVersionInfo(const QHash<ProKey,ProString> &versionInfo);
static FilePath sourcePath(const QHash<ProKey,ProString> &versionInfo);
@@ -158,6 +160,7 @@ public:
bool m_isAutodetected = false;
QString m_type;
bool m_isUpdating = false;
bool m_hasQmlDump = false; // controlled by m_versionInfoUpToDate
bool m_mkspecUpToDate = false;
bool m_mkspecReadUpToDate = false;
@@ -172,9 +175,6 @@ public:
bool m_qmakeIsExecutable = true;
bool m_hasQtAbis = false;
QStringList m_configValues;
QStringList m_qtConfigValues;
QString m_unexpandedDisplayName;
QString m_autodetectionSource;
QSet<Core::Id> m_overrideFeatures;
@@ -518,41 +518,76 @@ Tasks BaseQtVersion::validateKit(const Kit *k)
return result;
}
FilePath BaseQtVersion::headerPath() const
FilePath BaseQtVersion::prefix() const // QT_INSTALL_PREFIX
{
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_HEADERS"));
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_PREFIX"));
}
FilePath BaseQtVersion::docsPath() const
FilePath BaseQtVersion::binPath() const // QT_INSTALL_BINS
{
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_DOCS"));
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_BINS"));
}
FilePath BaseQtVersion::libraryPath() const
FilePath BaseQtVersion::configurationPath() const // QT_INSTALL_CONFIGURATION
{
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_LIBS"));
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_CONFIGURATION"));
}
FilePath BaseQtVersion::pluginPath() const
FilePath BaseQtVersion::headerPath() const // QT_INSTALL_HEADERS
{
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_PLUGINS"));
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_HEADERS"));
}
FilePath BaseQtVersion::qmlPath() const
FilePath BaseQtVersion::dataPath() const // QT_INSTALL_DATA
{
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_QML"));
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_DATA"));
}
FilePath BaseQtVersion::binPath() const
FilePath BaseQtVersion::docsPath() const // QT_INSTALL_DOCS
{
return FilePath::fromUserInput(qmakeProperty("QT_HOST_BINS"));
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_DOCS"));
}
FilePath BaseQtVersion::importsPath() const // QT_INSTALL_IMPORTS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_IMPORTS"));
}
FilePath BaseQtVersion::libraryPath() const // QT_INSTALL_LIBS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_LIBS"));
}
FilePath BaseQtVersion::pluginPath() const // QT_INSTALL_PLUGINS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_PLUGINS"));
}
FilePath BaseQtVersion::qmlPath() const // QT_INSTALL_QML
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_QML"));
}
FilePath BaseQtVersion::translationsPath() const // QT_INSTALL_TRANSLATIONS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_TRANSLATIONS"));
}
FilePath BaseQtVersion::hostBinPath() const // QT_HOST_BINS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_HOST_BINS"));
}
FilePath BaseQtVersion::hostDataPath() const // QT_HOST_DATA
{
return FilePath::fromUserInput(d->qmakeProperty("QT_HOST_DATA"));
}
FilePath BaseQtVersion::mkspecsPath() const
{
const FilePath result = FilePath::fromUserInput(qmakeProperty("QT_HOST_DATA"));
const FilePath result = hostDataPath();
if (result.isEmpty())
return FilePath::fromUserInput(qmakeProperty("QMAKE_MKSPECS"));
return FilePath::fromUserInput(d->qmakeProperty(d->m_versionInfo, "QMAKE_MKSPECS"));
return result.pathAppended("mkspecs");
}
@@ -563,8 +598,7 @@ FilePath BaseQtVersion::qmlBinPath() const
FilePath BaseQtVersion::librarySearchPath() const
{
return HostOsInfo::isWindowsHost()
? FilePath::fromUserInput(qmakeProperty("QT_INSTALL_BINS")) : libraryPath();
return HostOsInfo::isWindowsHost() ? binPath() : libraryPath();
}
FilePathList BaseQtVersion::directoriesToIgnoreInProjectTree() const
@@ -573,7 +607,8 @@ FilePathList BaseQtVersion::directoriesToIgnoreInProjectTree() const
const FilePath mkspecPathGet = mkspecsPath();
result.append(mkspecPathGet);
FilePath mkspecPathSrc = FilePath::fromUserInput(qmakeProperty("QT_HOST_DATA", PropertyVariantSrc));
FilePath mkspecPathSrc = FilePath::fromUserInput(
d->qmakeProperty("QT_HOST_DATA", BaseQtVersionPrivate::PropertyVariantSrc));
if (!mkspecPathSrc.isEmpty()) {
mkspecPathSrc = mkspecPathSrc.pathAppended("mkspecs");
if (mkspecPathSrc != mkspecPathGet)
@@ -669,11 +704,8 @@ bool BaseQtVersion::isValid() const
d->updateVersionInfo();
d->updateMkspec();
return !qmakeCommand().isEmpty()
&& d->m_installed
&& !qmakeProperty("QT_HOST_BINS").isNull()
&& !d->m_mkspecFullPath.isEmpty()
&& d->m_qmakeIsExecutable;
return !qmakeCommand().isEmpty() && d->m_installed && !binPath().isEmpty()
&& !d->m_mkspecFullPath.isEmpty() && d->m_qmakeIsExecutable;
}
BaseQtVersion::Predicate BaseQtVersion::isValidPredicate(const BaseQtVersion::Predicate &predicate)
@@ -693,7 +725,7 @@ QString BaseQtVersion::invalidReason() const
return QCoreApplication::translate("QtVersion", "qmake does not exist or is not executable");
if (!d->m_installed)
return QCoreApplication::translate("QtVersion", "Qt version is not properly installed, please run make install");
if (qmakeProperty("QT_HOST_BINS").isNull())
if (binPath().isEmpty())
return QCoreApplication::translate("QtVersion",
"Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?");
if (d->m_mkspecUpToDate && d->m_mkspecFullPath.isEmpty())
@@ -928,7 +960,7 @@ QString BaseQtVersionPrivate::findHostBinary(HostBinaries binary) const
{
QString baseDir;
if (q->qtVersion() < QtVersionNumber(5, 0, 0)) {
baseDir = q->qmakeProperty("QT_HOST_BINS");
baseDir = q->binPath().toString();
} else {
q->ensureMkSpecParsed();
switch (binary) {
@@ -938,7 +970,7 @@ QString BaseQtVersionPrivate::findHostBinary(HostBinaries binary) const
break;
case Uic:
case QScxmlc:
baseDir = q->qmakeProperty("QT_HOST_BINS");
baseDir = q->hostBinPath().toString();
break;
default:
// Can't happen
@@ -1049,11 +1081,10 @@ void BaseQtVersion::ensureMkSpecParsed() const
void BaseQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
{
d->m_configValues = evaluator->values("CONFIG");
d->m_qtConfigValues = evaluator->values("QT_CONFIG");
const QStringList configValues = evaluator->values("CONFIG");
d->m_defaultConfigIsDebugAndRelease = false;
d->m_frameworkBuild = false;
for (const QString &value : qAsConst(d->m_configValues)) {
for (const QString &value : configValues) {
if (value == "debug")
d->m_defaultConfigIsDebug = true;
else if (value == "release")
@@ -1115,8 +1146,7 @@ bool BaseQtVersion::hasMkspec(const QString &spec) const
if (spec.isEmpty())
return true; // default spec of a Qt version
QDir mkspecDir = QDir(QDir::fromNativeSeparators(qmakeProperty("QT_HOST_DATA"))
+ "/mkspecs/");
QDir mkspecDir = QDir(hostDataPath().toString() + "/mkspecs/");
const QString absSpec = mkspecDir.absoluteFilePath(spec);
if (QFileInfo(absSpec).isDir() && QFileInfo(absSpec + "/qmake.conf").isFile())
return true;
@@ -1152,11 +1182,11 @@ QtVersionNumber BaseQtVersion::qtVersion() const
void BaseQtVersionPrivate::updateVersionInfo()
{
if (m_versionInfoUpToDate)
return;
if (!m_qmakeIsExecutable)
if (m_versionInfoUpToDate || !m_qmakeIsExecutable || m_isUpdating)
return;
m_isUpdating = true;
// extract data from qmake executable
m_versionInfo.clear();
m_installed = true;
@@ -1172,9 +1202,8 @@ void BaseQtVersionPrivate::updateVersionInfo()
}
m_qmakeIsExecutable = true;
const QString qtInstallBins = qmakeProperty(m_versionInfo, "QT_INSTALL_BINS");
const QString qtHeaderData = qmakeProperty(m_versionInfo, "QT_INSTALL_HEADERS");
const QString qtInstallBins = q->binPath().toString();
const QString qtHeaderData = q->headerPath().toString();
if (!qtInstallBins.isNull()) {
if (!qtInstallBins.isEmpty()) {
@@ -1185,7 +1214,7 @@ void BaseQtVersionPrivate::updateVersionInfo()
}
// Now check for a qt that is configured with a prefix but not installed
QString installDir = qmakeProperty(m_versionInfo, "QT_HOST_BINS");
QString installDir = q->hostBinPath().toString();
if (!installDir.isNull()) {
if (!QFileInfo::exists(installDir))
m_installed = false;
@@ -1198,23 +1227,24 @@ void BaseQtVersionPrivate::updateVersionInfo()
m_installed = false;
}
}
const QString qtInstallDocs = qmakeProperty(m_versionInfo, "QT_INSTALL_DOCS");
const QString qtInstallDocs = q->docsPath().toString();
if (!qtInstallDocs.isNull()) {
if (QFileInfo::exists(qtInstallDocs))
m_hasDocumentation = true;
}
const QString qtInstallExamples = qmakeProperty(m_versionInfo, "QT_INSTALL_EXAMPLES");
const QString qtInstallExamples = q->examplesPath().toString();
if (!qtInstallExamples.isNull()) {
if (QFileInfo::exists(qtInstallExamples))
m_hasExamples = true;
}
const QString qtInstallDemos = qmakeProperty(m_versionInfo, "QT_INSTALL_DEMOS");
const QString qtInstallDemos = q->demosPath().toString();
if (!qtInstallDemos.isNull()) {
if (QFileInfo::exists(qtInstallDemos))
m_hasDemos = true;
}
m_qtVersionString = qmakeProperty(m_versionInfo, "QT_VERSION");
m_qtVersionString = qmakeProperty("QT_VERSION");
m_isUpdating = false;
m_versionInfoUpToDate = true;
}
@@ -1224,55 +1254,49 @@ QHash<ProKey,ProString> BaseQtVersionPrivate::versionInfo()
return m_versionInfo;
}
QString BaseQtVersionPrivate::qmakeProperty(const QHash<ProKey,ProString> &versionInfo, const QByteArray &name,
BaseQtVersion::PropertyVariant variant)
QString BaseQtVersionPrivate::qmakeProperty(const QHash<ProKey, ProString> &versionInfo,
const QByteArray &name,
PropertyVariant variant)
{
QString val = versionInfo.value(ProKey(QString::fromLatin1(
name + (variant == BaseQtVersion::PropertyVariantDev ? "/dev" :
variant == BaseQtVersion::PropertyVariantGet ? "/get" : "/src")))).toQString();
QString val = versionInfo
.value(ProKey(QString::fromLatin1(
name
+ (variant == PropertyVariantDev
? "/dev"
: variant == PropertyVariantGet ? "/get" : "/src"))))
.toQString();
if (!val.isNull())
return val;
return versionInfo.value(ProKey(name)).toQString();
}
QString BaseQtVersion::qmakeProperty(const QByteArray &name, PropertyVariant variant) const
{
d->updateVersionInfo();
return d->qmakeProperty(d->m_versionInfo, name, variant);
}
void BaseQtVersion::applyProperties(QMakeGlobals *qmakeGlobals) const
{
qmakeGlobals->setProperties(d->versionInfo());
}
bool BaseQtVersion::hasDocumentation() const
bool BaseQtVersion::hasDocs() const
{
d->updateVersionInfo();
return d->m_hasDocumentation;
}
QString BaseQtVersion::documentationPath() const
{
return qmakeProperty("QT_INSTALL_DOCS");
}
bool BaseQtVersion::hasDemos() const
{
d->updateVersionInfo();
return d->m_hasDemos;
}
QString BaseQtVersion::demosPath() const
FilePath BaseQtVersion::demosPath() const
{
return QFileInfo(qmakeProperty("QT_INSTALL_DEMOS")).canonicalFilePath();
return FilePath::fromString(QFileInfo(d->qmakeProperty("QT_INSTALL_DEMOS")).canonicalFilePath());
}
QString BaseQtVersion::frameworkInstallPath() const
FilePath BaseQtVersion::frameworkPath() const
{
if (HostOsInfo::isMacHost())
return qmakeProperty("QT_INSTALL_LIBS");
return QString();
return libraryPath();
return {};
}
bool BaseQtVersion::hasExamples() const
@@ -1281,9 +1305,10 @@ bool BaseQtVersion::hasExamples() const
return d->m_hasExamples;
}
QString BaseQtVersion::examplesPath() const
FilePath BaseQtVersion::examplesPath() const // QT_INSTALL_EXAMPLES
{
return QFileInfo(qmakeProperty("QT_INSTALL_EXAMPLES")).canonicalFilePath();
return FilePath::fromString(
QFileInfo(d->qmakeProperty("QT_INSTALL_EXAMPLES")).canonicalFilePath());
}
QStringList BaseQtVersion::qtSoPaths() const
@@ -1297,7 +1322,7 @@ QStringList BaseQtVersion::qtSoPaths() const
QSet<QString> paths;
for (uint i = 0; i < sizeof qMakeVariables / sizeof qMakeVariables[0]; ++i) {
QString path = qmakeProperty(qMakeVariables[i]);
QString path = d->qmakeProperty(qMakeVariables[i]);
if (path.isNull())
continue;
QDirIterator it(path, QStringList("*.so"), QDir::Files, QDirIterator::Subdirectories);
@@ -1309,18 +1334,6 @@ QStringList BaseQtVersion::qtSoPaths() const
return Utils::toList(paths);
}
QStringList BaseQtVersion::configValues() const
{
ensureMkSpecParsed();
return d->m_configValues;
}
QStringList BaseQtVersion::qtConfigValues() const
{
ensureMkSpecParsed();
return d->m_qtConfigValues;
}
MacroExpander *BaseQtVersion::macroExpander() const
{
return d->m_expander.macroExpander(this);
@@ -1339,12 +1352,11 @@ BaseQtVersion::createMacroExpander(const std::function<const BaseQtVersion *()>
std::unique_ptr<MacroExpander> expander(new MacroExpander);
expander->setDisplayName(QtKitAspect::tr("Qt version"));
expander->registerVariable(
"Qt:Version",
QtKitAspect::tr("The version string of the current Qt version."),
versionProperty([](const BaseQtVersion *version) {
return version->qtVersionString();
}));
expander->registerVariable("Qt:Version",
QtKitAspect::tr("The version string of the current Qt version."),
versionProperty([](const BaseQtVersion *version) {
return version->qtVersionString();
}));
expander->registerVariable(
"Qt:Type",
@@ -1360,96 +1372,94 @@ BaseQtVersion::createMacroExpander(const std::function<const BaseQtVersion *()>
return QDir::toNativeSeparators(version->mkspec());
}));
expander->registerVariable(
"Qt:QT_INSTALL_PREFIX",
QtKitAspect::tr("The installation prefix of the current Qt version."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_PREFIX");
}));
expander->registerVariable("Qt:QT_INSTALL_PREFIX",
QtKitAspect::tr(
"The installation prefix of the current Qt version."),
versionProperty([](const BaseQtVersion *version) {
return version->prefix().toString();
}));
expander->registerVariable(
"Qt:QT_INSTALL_DATA",
QtKitAspect::tr("The installation location of the current Qt version's data."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_DATA");
}));
expander->registerVariable("Qt:QT_INSTALL_DATA",
QtKitAspect::tr(
"The installation location of the current Qt version's data."),
versionProperty([](const BaseQtVersion *version) {
return version->dataPath().toString();
}));
expander->registerVariable(
"Qt:QT_INSTALL_HEADERS",
QtKitAspect::tr("The installation location of the current Qt version's header files."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_HEADERS");
}));
versionProperty(
[](const BaseQtVersion *version) { return version->headerPath().toString(); }));
expander->registerVariable(
"Qt:QT_INSTALL_LIBS",
QtKitAspect::tr("The installation location of the current Qt version's library files."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_LIBS");
}));
versionProperty(
[](const BaseQtVersion *version) { return version->libraryPath().toString(); }));
expander->registerVariable(
"Qt:QT_INSTALL_DOCS",
QtKitAspect::tr("The installation location of the current Qt version's documentation files."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_DOCS");
}));
QtKitAspect::tr(
"The installation location of the current Qt version's documentation files."),
versionProperty(
[](const BaseQtVersion *version) { return version->docsPath().toString(); }));
expander->registerVariable(
"Qt:QT_INSTALL_BINS",
QtKitAspect::tr("The installation location of the current Qt version's executable files."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_BINS");
}));
versionProperty([](const BaseQtVersion *version) { return version->binPath().toString(); }));
expander->registerVariable(
"Qt:QT_INSTALL_PLUGINS",
QtKitAspect::tr("The installation location of the current Qt version's plugins."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_PLUGINS");
}));
expander
->registerVariable("Qt:QT_INSTALL_PLUGINS",
QtKitAspect::tr(
"The installation location of the current Qt version's plugins."),
versionProperty([](const BaseQtVersion *version) {
return version->pluginPath().toString();
}));
expander->registerVariable(
"Qt:QT_INSTALL_QML",
QtKitAspect::tr("The installation location of the current Qt version's QML files."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_QML");
}));
expander
->registerVariable("Qt:QT_INSTALL_QML",
QtKitAspect::tr(
"The installation location of the current Qt version's QML files."),
versionProperty([](const BaseQtVersion *version) {
return version->qmlPath().toString();
}));
expander->registerVariable(
"Qt:QT_INSTALL_IMPORTS",
QtKitAspect::tr("The installation location of the current Qt version's imports."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_IMPORTS");
}));
expander
->registerVariable("Qt:QT_INSTALL_IMPORTS",
QtKitAspect::tr(
"The installation location of the current Qt version's imports."),
versionProperty([](const BaseQtVersion *version) {
return version->importsPath().toString();
}));
expander->registerVariable(
"Qt:QT_INSTALL_TRANSLATIONS",
QtKitAspect::tr("The installation location of the current Qt version's translation files."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_TRANSLATIONS");
}));
versionProperty(
[](const BaseQtVersion *version) { return version->translationsPath().toString(); }));
expander->registerVariable(
"Qt:QT_INSTALL_CONFIGURATION",
QtKitAspect::tr("The installation location of the current Qt version's translation files."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_CONFIGURATION");
}));
versionProperty(
[](const BaseQtVersion *version) { return version->configurationPath().toString(); }));
expander->registerVariable(
"Qt:QT_INSTALL_EXAMPLES",
QtKitAspect::tr("The installation location of the current Qt version's examples."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_EXAMPLES");
}));
expander
->registerVariable("Qt:QT_INSTALL_EXAMPLES",
QtKitAspect::tr(
"The installation location of the current Qt version's examples."),
versionProperty([](const BaseQtVersion *version) {
return version->examplesPath().toString();
}));
expander->registerVariable(
"Qt:QT_INSTALL_DEMOS",
QtKitAspect::tr("The installation location of the current Qt version's demos."),
versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_DEMOS");
}));
expander->registerVariable("Qt:QT_INSTALL_DEMOS",
QtKitAspect::tr(
"The installation location of the current Qt version's demos."),
versionProperty([](const BaseQtVersion *version) {
return version->demosPath().toString();
}));
expander->registerVariable(
"Qt:QMAKE_MKSPECS",
@@ -1564,7 +1574,7 @@ QSet<Id> BaseQtVersion::features() const
void BaseQtVersion::addToEnvironment(const Kit *k, Environment &env) const
{
Q_UNUSED(k)
env.set("QTDIR", QDir::toNativeSeparators(qmakeProperty("QT_HOST_DATA")));
env.set("QTDIR", hostDataPath().toUserOutput());
}
// Some Qt versions may require environment settings for qmake to work
@@ -1596,7 +1606,7 @@ bool BaseQtVersion::needsQmlDump() const
QString BaseQtVersion::qmlDumpTool(bool debugVersion) const
{
const QString qtInstallBins = qmakeProperty("QT_INSTALL_BINS");
const QString qtInstallBins = binPath().toString();
return QmlDumpTool::toolForQtPaths(qtInstallBins, debugVersion);
}
@@ -1712,9 +1722,16 @@ bool BaseQtVersionPrivate::queryQMakeVariables(const FilePath &binary, const Env
return true;
}
QString BaseQtVersionPrivate::qmakeProperty(const QByteArray &name,
BaseQtVersionPrivate::PropertyVariant variant)
{
updateVersionInfo();
return qmakeProperty(m_versionInfo, name, variant);
}
FilePath BaseQtVersionPrivate::mkspecDirectoryFromVersionInfo(const QHash<ProKey, ProString> &versionInfo)
{
QString dataDir = qmakeProperty(versionInfo, "QT_HOST_DATA", BaseQtVersion::PropertyVariantSrc);
QString dataDir = qmakeProperty(versionInfo, "QT_HOST_DATA", PropertyVariantSrc);
if (dataDir.isEmpty())
return FilePath();
return FilePath::fromUserInput(dataDir + "/mkspecs");
@@ -1848,11 +1865,11 @@ bool BaseQtVersion::isSubProject(const FilePath &filePath) const
return true;
}
const QString &examples = examplesPath();
const QString examples = examplesPath().toString();
if (!examples.isEmpty() && filePath.isChildOf(QDir(examples)))
return true;
const QString &demos = demosPath();
const QString demos = demosPath().toString();
if (!demos.isEmpty() && filePath.isChildOf(QDir(demos)))
return true;
@@ -1927,10 +1944,10 @@ bool BaseQtVersion::isQtQuickCompilerSupported(QString *reason) const
FilePathList BaseQtVersionPrivate::qtCorePaths()
{
updateVersionInfo();
const QString &versionString = m_qtVersionString;
const QString versionString = m_qtVersionString;
const QString &installLibsDir = qmakeProperty(m_versionInfo, "QT_INSTALL_LIBS");
const QString &installBinDir = qmakeProperty(m_versionInfo, "QT_INSTALL_BINS");
const QString installLibsDir = q->libraryPath().toString();
const QString installBinDir = q->binPath().toString();
const QDir::Filters filters = QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot;

View File

@@ -119,9 +119,6 @@ public:
ProjectExplorer::Abis qtAbis() const;
virtual ProjectExplorer::Abis detectQtAbis() const;
enum PropertyVariant { PropertyVariantDev, PropertyVariantGet, PropertyVariantSrc };
QString qmakeProperty(const QByteArray &name,
PropertyVariant variant = PropertyVariantGet) const;
void applyProperties(QMakeGlobals *qmakeGlobals) const;
virtual void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const;
virtual Utils::Environment qmakeRunEnvironment() const;
@@ -143,18 +140,11 @@ public:
QString qtVersionString() const;
QtVersionNumber qtVersion() const;
bool hasExamples() const;
QString examplesPath() const;
QStringList qtSoPaths() const;
bool hasDocumentation() const;
QString documentationPath() const;
bool hasExamples() const;
bool hasDocs() const;
bool hasDemos() const;
QString demosPath() const;
QString frameworkInstallPath() const;
// former local functions
Utils::FilePath qmakeCommand() const;
@@ -198,18 +188,31 @@ public:
virtual QtConfigWidget *createConfigurationWidget() const;
static QString defaultUnexpandedDisplayName(const Utils::FilePath &qmakePath,
bool fromPath = false);
bool fromPath = false);
virtual QSet<Core::Id> targetDeviceTypes() const = 0;
virtual ProjectExplorer::Tasks validateKit(const ProjectExplorer::Kit *k);
Utils::FilePath headerPath() const;
Utils::FilePath prefix() const;
Utils::FilePath binPath() const;
Utils::FilePath configurationPath() const;
Utils::FilePath dataPath() const;
Utils::FilePath demosPath() const;
Utils::FilePath docsPath() const;
Utils::FilePath examplesPath() const;
Utils::FilePath frameworkPath() const;
Utils::FilePath headerPath() const;
Utils::FilePath importsPath() const;
Utils::FilePath libraryPath() const;
Utils::FilePath pluginPath() const;
Utils::FilePath qmlPath() const;
Utils::FilePath binPath() const;
Utils::FilePath translationsPath() const;
Utils::FilePath hostBinPath() const;
Utils::FilePath hostDataPath() const;
Utils::FilePath mkspecsPath() const;
Utils::FilePath qmlBinPath() const;
Utils::FilePath librarySearchPath() const;
@@ -223,9 +226,6 @@ public:
bool hasDebugBuild() const;
bool hasReleaseBuild() const;
QStringList configValues() const;
QStringList qtConfigValues() const;
Utils::MacroExpander *macroExpander() const; // owned by the Qt version
static std::unique_ptr<Utils::MacroExpander>
createMacroExpander(const std::function<const BaseQtVersion *()> &qtVersion);
@@ -235,7 +235,6 @@ public:
QSet<Core::Id> features() const;
protected:
BaseQtVersion();
BaseQtVersion(const BaseQtVersion &other) = delete;

View File

@@ -141,7 +141,7 @@ void ExampleSetModel::recreateModel(const QList<BaseQtVersion *> &qtVersions)
foreach (BaseQtVersion *version, qtVersions) {
// sanitize away qt versions that have already been added through extra sets
if (extraManifestDirs.contains(version->documentationPath())) {
if (extraManifestDirs.contains(version->docsPath().toString())) {
if (debugExamples()) {
qWarning() << "Not showing Qt version because manifest path is already added through InstalledExamples settings:"
<< version->displayName();
@@ -172,7 +172,7 @@ int ExampleSetModel::indexForQtVersion(BaseQtVersion *qtVersion) const
}
// check for extra set
const QString &documentationPath = qtVersion->documentationPath();
const QString &documentationPath = qtVersion->docsPath().toString();
for (int i = 0; i < rowCount(); ++i) {
if (getType(i) == ExtraExampleSetType
&& m_extraExampleSets.at(getExtraExampleSetIndex(i)).manifestPath == documentationPath)
@@ -577,9 +577,9 @@ QStringList ExampleSetModel::exampleSources(QString *examplesInstallPath, QStrin
int qtId = getQtId(m_selectedExampleSetIndex);
foreach (BaseQtVersion *version, QtVersionManager::versions()) {
if (version->uniqueId() == qtId) {
manifestScanPath = version->documentationPath();
examplesPath = version->examplesPath();
demosPath = version->demosPath();
manifestScanPath = version->docsPath().toString();
examplesPath = version->examplesPath().toString();
demosPath = version->demosPath().toString();
break;
}
}

View File

@@ -58,7 +58,7 @@ static inline QStringList validPrebuiltFilenames(bool debugBuild)
QString QmlDumpTool::toolForVersion(const BaseQtVersion *version, bool debugDump)
{
if (version) {
const QString qtInstallBins = version->qmakeProperty("QT_INSTALL_BINS");
const QString qtInstallBins = version->binPath().toString();
return toolForQtPaths(qtInstallBins, debugDump);
}

View File

@@ -615,12 +615,12 @@ void QtOptionsPageWidget::editPath()
BaseQtVersion *current = currentVersion();
QString dir = currentVersion()->qmakeCommand().toFileInfo().absolutePath();
FilePath qtVersion = FilePath::fromString(
QFileDialog::getOpenFileName(this,
tr("Select a qmake Executable"),
dir,
BuildableHelperLibrary::filterForQmakeFileDialog(),
0,
QFileDialog::DontResolveSymlinks));
QFileDialog::getOpenFileName(this,
tr("Select a qmake Executable"),
dir,
BuildableHelperLibrary::filterForQmakeFileDialog(),
nullptr,
QFileDialog::DontResolveSymlinks));
if (qtVersion.isEmpty())
return;
BaseQtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(qtVersion);

View File

@@ -104,30 +104,36 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
return true;
}
static QString qmakeProperty(const char *propertyName)
static BaseQtVersion *qtVersion()
{
ProjectExplorer::Project *project = ProjectExplorer::ProjectTree::currentProject();
if (!project || !project->activeTarget())
return QString();
return nullptr;
const BaseQtVersion *qtVersion = QtKitAspect::qtVersion(project->activeTarget()->kit());
if (!qtVersion)
return QString();
return qtVersion->qmakeProperty(propertyName);
return QtKitAspect::qtVersion(project->activeTarget()->kit());
}
void QtSupportPlugin::extensionsInitialized()
{
Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerVariable(kHostBins,
expander->registerVariable(
kHostBins,
tr("Full path to the host bin directory of the current project's Qt version."),
[]() { return qmakeProperty("QT_HOST_BINS"); });
[]() {
BaseQtVersion *qt = qtVersion();
return qt ? qt->hostBinPath().toUserOutput() : QString();
});
expander->registerVariable(kInstallBins,
expander->registerVariable(
kInstallBins,
tr("Full path to the target bin directory of the current project's Qt version.<br>"
"You probably want %1 instead.").arg(QString::fromLatin1(kHostBins)),
[]() { return qmakeProperty("QT_INSTALL_BINS"); });
"You probably want %1 instead.")
.arg(QString::fromLatin1(kInstallBins)),
[]() {
BaseQtVersion *qt = qtVersion();
return qt ? qt->binPath().toUserOutput() : QString();
});
}
} // Internal

View File

@@ -469,8 +469,8 @@ static void updateDocumentation()
{
QStringList files;
foreach (BaseQtVersion *v, m_versions) {
const QStringList docPaths = QStringList({v->documentationPath() + QChar('/'),
v->documentationPath() + "/qch/"});
const QStringList docPaths = QStringList(
{v->docsPath().toString() + QChar('/'), v->docsPath().toString() + "/qch/"});
foreach (const QString &docPath, docPaths) {
const QDir versionHelpDir(docPath);
foreach (const QString &helpFile,

View File

@@ -127,15 +127,7 @@ EmbeddedLinuxQtVersionFactory::EmbeddedLinuxQtVersionFactory()
setSupportedType(EMBEDDED_LINUX_QT);
setPriority(10);
setRestrictionChecker([](const SetupData &) {
const EmbeddedLinuxQtVersion tempVersion;
const ProjectExplorer::Abis abis = tempVersion.qtAbis();
// Note: This fails for e.g. intel/meego cross builds on x86 linux machines.
return abis.count() == 1
&& abis.at(0).os() == ProjectExplorer::Abi::LinuxOS
&& !ProjectExplorer::Abi::hostAbi().isCompatibleWith(abis.at(0));
});
setRestrictionChecker([](const SetupData &) { return false; });
}
} // Internal

View File

@@ -225,7 +225,7 @@ QString WinRtDeviceFactory::findRunnerFilePath() const
BaseQtVersion *qt = nullptr;
for (BaseQtVersion *v : winrtVersions) {
if (!qt || qt->qtVersion() < v->qtVersion()) {
QFileInfo fi(v->binPath().toString() + winRtRunnerExe);
QFileInfo fi(v->hostBinPath().toString() + winRtRunnerExe);
if (fi.isFile() && fi.isExecutable()) {
qt = v;
filePath = fi.absoluteFilePath();

View File

@@ -91,7 +91,8 @@ bool WinRtPackageDeploymentStep::init()
if (!qt)
return false;
const QString windeployqtPath = FileUtils::resolvePath(qt->binPath().toString(), "windeployqt.exe");
const QString windeployqtPath = FileUtils::resolvePath(qt->hostBinPath().toString(),
"windeployqt.exe");
CommandLine windeployqt{windeployqtPath};
windeployqt.addArg(QDir::toNativeSeparators(m_targetFilePath));
@@ -104,8 +105,8 @@ bool WinRtPackageDeploymentStep::init()
ProcessParameters *params = processParameters();
if (!QFile::exists(windeployqtPath)) {
raiseError(tr("Cannot find windeployqt.exe in \"%1\".").arg(
QDir::toNativeSeparators(qt->binPath().toString())));
raiseError(tr("Cannot find windeployqt.exe in \"%1\".")
.arg(QDir::toNativeSeparators(qt->hostBinPath().toString())));
return false;
}
params->setCommandLine(windeployqt);

View File

@@ -62,10 +62,10 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
return;
}
m_runnerFilePath = qt->binPath().toString() + QStringLiteral("/winrtrunner.exe");
m_runnerFilePath = qt->hostBinPath().toString() + QStringLiteral("/winrtrunner.exe");
if (!QFile::exists(m_runnerFilePath)) {
*errorMessage = tr("Cannot find winrtrunner.exe in \"%1\".").arg(
QDir::toNativeSeparators(qt->binPath().toString()));
QDir::toNativeSeparators(qt->hostBinPath().toString()));
return;
}

View File

@@ -84,6 +84,7 @@ Tricky parts:
* `ProjectExplorer.ToolChain.Custom` for custom toolchain
* `Qt4ProjectManager.ToolChain.Android` for the Android tool chain
* `Qnx.QccToolChain` for the Qnx QCC tool chain
* `WebAssembly.ToolChain.Emscripten` for the Emscripten tool chain
Check the classes derived from `ProjectExplorer::ToolChain` for their
Ids.
@@ -141,7 +142,7 @@ Tricky parts:
- `type` must be the string returned by `BaseQtVersion::type()`.
Currently these are (Qt Creator 4.6):
Currently these are (Qt Creator 4.11):
* `Qt4ProjectManager.QtVersion.Android` for Android
* `Qt4ProjectManager.QtVersion.Desktop` for a desktop Qt
* `Qt4ProjectManager.QtVersion.Ios` for iOS
@@ -149,6 +150,7 @@ Tricky parts:
* `RemoteLinux.EmbeddedLinuxQt` for Embedded Linux
* `WinRt.QtVersion.WindowsRuntime` for Windows RT
* `WinRt.QtVersion.WindowsPhone` for Windows RT phone
* `Qt4ProjectManager.QtVersion.WebAssembly` for WebAssembly
Add a kit:
==========
@@ -171,7 +173,7 @@ Using the newly set up tool chain and Qt version:
Tricky parts:
- `devicetype` is the string returned IDevice::type()
Currently these are (Qt Creator 4.6):
Currently these are (Qt Creator 4.11):
* `Android.Device.Type` for Android devices
* `Desktop` for code running on the local desktop
* `Ios.Device.Type` for an iOS device
@@ -180,6 +182,7 @@ Tricky parts:
* `WinRt.Device.Local` for Windows RT (local)
* `WinRt.Device.Emulator` for a Windows RT emulator
* `WinRt.Device.Phone` for a Windows RT phone
* `WebAssemblyDeviceType` for a web browser that supports WebAssembly
- `debuggerid` is one of the ids used when setting up toolchains with
`sdktool addDebugger`.