forked from qt-creator/qt-creator
AppMan: Cleanup variables in TargetInformation and Manifest
Remove all variables we don't need and convert them to FilePaths where it makes sense. Change-Id: I4842bcf23f81db8c86f7e305113c24034b361d80 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <projectexplorer/buildstep.h>
|
#include <projectexplorer/buildstep.h>
|
||||||
#include <projectexplorer/deployconfiguration.h>
|
#include <projectexplorer/deployconfiguration.h>
|
||||||
|
#include <projectexplorer/kitaspects.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
@@ -52,10 +53,10 @@ public:
|
|||||||
|
|
||||||
const TargetInformation targetInformation(target());
|
const TargetInformation targetInformation(target());
|
||||||
|
|
||||||
packageFilePath.setValue(targetInformation.packageFile.absoluteFilePath());
|
packageFilePath.setValue(targetInformation.packageFilePath);
|
||||||
packageFilePath.setDefaultValue(packageFilePath.value());
|
packageFilePath.setDefaultValue(packageFilePath.value());
|
||||||
|
|
||||||
targetDirectory.setValue(targetInformation.runDirectory.absolutePath());
|
targetDirectory.setValue(targetInformation.runDirectory);
|
||||||
targetDirectory.setDefaultValue(targetDirectory.value());
|
targetDirectory.setDefaultValue(targetDirectory.value());
|
||||||
|
|
||||||
setEnabled(!targetInformation.isBuiltin);
|
setEnabled(!targetInformation.isBuiltin);
|
||||||
@@ -80,14 +81,13 @@ private:
|
|||||||
GroupItem runRecipe() final
|
GroupItem runRecipe() final
|
||||||
{
|
{
|
||||||
const auto onSetup = [this](FileStreamer &streamer) {
|
const auto onSetup = [this](FileStreamer &streamer) {
|
||||||
const TargetInformation targetInformation(target());
|
|
||||||
const FilePath source = packageFilePath().isEmpty() ?
|
const FilePath source = packageFilePath().isEmpty() ?
|
||||||
FilePath::fromString(packageFilePath.defaultValue()) :
|
FilePath::fromString(packageFilePath.defaultValue()) :
|
||||||
packageFilePath();
|
packageFilePath();
|
||||||
const FilePath targetDir = targetDirectory().isEmpty() ?
|
const FilePath targetDir = targetDirectory().isEmpty() ?
|
||||||
FilePath::fromString(targetDirectory.defaultValue()) :
|
FilePath::fromString(targetDirectory.defaultValue()) :
|
||||||
targetDirectory();
|
targetDirectory();
|
||||||
const FilePath target = targetInformation.device->filePath(targetDir.path())
|
const FilePath target = DeviceKitAspect::device(kit())->filePath(targetDir.path())
|
||||||
.pathAppended(source.fileName());
|
.pathAppended(source.fileName());
|
||||||
streamer.setSource(source);
|
streamer.setSource(source);
|
||||||
streamer.setDestination(target);
|
streamer.setDestination(target);
|
||||||
|
@@ -67,7 +67,7 @@ AppManagerInstallPackageStep::AppManagerInstallPackageStep(BuildStepList *bsl, I
|
|||||||
|
|
||||||
const TargetInformation targetInformation(target());
|
const TargetInformation targetInformation(target());
|
||||||
|
|
||||||
packageFile.setDefaultValue(targetInformation.packageFile.absoluteFilePath());
|
packageFile.setDefaultValue(targetInformation.packageFilePath.toUserOutput());
|
||||||
|
|
||||||
setEnabled(!targetInformation.isBuiltin);
|
setEnabled(!targetInformation.isBuiltin);
|
||||||
};
|
};
|
||||||
|
@@ -74,10 +74,10 @@ AppManagerRemoteInstallPackageStep::AppManagerRemoteInstallPackageStep(BuildStep
|
|||||||
|
|
||||||
const TargetInformation targetInformation(target());
|
const TargetInformation targetInformation(target());
|
||||||
|
|
||||||
const QString packageFilePath =
|
const Utils::FilePath packageFilePath =
|
||||||
targetInformation.runDirectory.absoluteFilePath(targetInformation.packageFile.fileName());
|
targetInformation.runDirectory.pathAppended(targetInformation.packageFilePath.fileName());
|
||||||
|
|
||||||
packageFile.setDefaultValue(packageFilePath);
|
packageFile.setDefaultValue(packageFilePath.toUserOutput());
|
||||||
|
|
||||||
setEnabled(!targetInformation.isBuiltin);
|
setEnabled(!targetInformation.isBuiltin);
|
||||||
};
|
};
|
||||||
|
@@ -11,9 +11,10 @@
|
|||||||
#include "appmanagertr.h"
|
#include "appmanagertr.h"
|
||||||
#include "appmanagerutilities.h"
|
#include "appmanagerutilities.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/environmentaspect.h>
|
||||||
|
#include <projectexplorer/kitaspects.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/environmentaspect.h>
|
|
||||||
|
|
||||||
#include <remotelinux/remotelinux_constants.h>
|
#include <remotelinux/remotelinux_constants.h>
|
||||||
|
|
||||||
@@ -39,8 +40,8 @@ public:
|
|||||||
return;
|
return;
|
||||||
const TargetInformation targetInformation = tis.at(0);
|
const TargetInformation targetInformation = tis.at(0);
|
||||||
|
|
||||||
controller.setValue(FilePath::fromString(getToolFilePath(Constants::APPMAN_CONTROLLER, target->kit(),
|
controller.setValue(FilePath::fromString(getToolFilePath(Constants::APPMAN_CONTROLLER, kit(),
|
||||||
targetInformation.device)));
|
DeviceKitAspect::device(kit()))));
|
||||||
|
|
||||||
appId.setValue(targetInformation.manifest.id);
|
appId.setValue(targetInformation.manifest.id);
|
||||||
appId.setReadOnly(true);
|
appId.setReadOnly(true);
|
||||||
@@ -117,10 +118,10 @@ public:
|
|||||||
rci.displayName = decoratedTargetName(ti.displayName, target);
|
rci.displayName = decoratedTargetName(ti.displayName, target);
|
||||||
rci.displayNameUniquifier = ti.displayNameUniquifier;
|
rci.displayNameUniquifier = ti.displayNameUniquifier;
|
||||||
rci.creationMode = RunConfigurationCreationInfo::AlwaysCreate;
|
rci.creationMode = RunConfigurationCreationInfo::AlwaysCreate;
|
||||||
rci.projectFilePath = Utils::FilePath::fromString(ti.manifest.fileName);
|
rci.projectFilePath = ti.manifest.filePath;
|
||||||
rci.useTerminal = false;
|
rci.useTerminal = false;
|
||||||
if (!m_fileSystemWatcher.files().contains(ti.manifest.fileName)) {
|
if (!m_fileSystemWatcher.files().contains(ti.manifest.filePath.toFSPathString())) {
|
||||||
m_fileSystemWatcher.addFile(ti.manifest.fileName, FileSystemWatcher::WatchAllChanges);
|
m_fileSystemWatcher.addFile(ti.manifest.filePath, FileSystemWatcher::WatchAllChanges);
|
||||||
}
|
}
|
||||||
return rci;
|
return rci;
|
||||||
});
|
});
|
||||||
|
@@ -62,13 +62,13 @@ QList<TargetInformation> TargetInformation::readFromProject(const Target *target
|
|||||||
ati.displayNameUniquifier = id + " [App]";
|
ati.displayNameUniquifier = id + " [App]";
|
||||||
ati.displayName = id + " [App]";
|
ati.displayName = id + " [App]";
|
||||||
ati.buildKey = id;
|
ati.buildKey = id;
|
||||||
ati.manifest.fileName = manifestFilePath.path();
|
ati.manifest.filePath = manifestFilePath;
|
||||||
ati.manifest.id = id;
|
ati.manifest.id = id;
|
||||||
ati.manifest.runtime = runtime;
|
ati.manifest.runtime = runtime;
|
||||||
ati.manifest.code = code;
|
ati.manifest.code = code;
|
||||||
ati.isBuiltin = isBuiltinPackage;
|
ati.isBuiltin = isBuiltinPackage;
|
||||||
ati.cmakeBuildTarget = cmakeTarget;
|
ati.cmakeBuildTarget = cmakeTarget;
|
||||||
ati.packageFile = QFileInfo(packageFilePath.path());
|
ati.packageFilePath = packageFilePath;
|
||||||
|
|
||||||
// qCritical() << "CREATE CONFIG: BUILTIN:" << isBuiltinPackage << id << "TARGET:" << cmakeTarget;
|
// qCritical() << "CREATE CONFIG: BUILTIN:" << isBuiltinPackage << id << "TARGET:" << cmakeTarget;
|
||||||
|
|
||||||
@@ -126,20 +126,12 @@ TargetInformation::TargetInformation(const Target *target)
|
|||||||
|
|
||||||
*this = targetInfoList.first();
|
*this = targetInfoList.first();
|
||||||
|
|
||||||
device = DeviceKitAspect::device(target->kit());
|
runDirectory = Constants::REMOTE_DEFAULT_TMP_PATH;
|
||||||
remote = device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
|
||||||
runDirectory = remote ? QDir(Constants::REMOTE_DEFAULT_TMP_PATH) : buildDirectory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TargetInformation::isValid() const
|
bool TargetInformation::isValid() const
|
||||||
{
|
{
|
||||||
static const QFileInfo INVALID_FILE_INFO = QFileInfo();
|
return !manifest.filePath.isEmpty() && packageFilePath.isFile();
|
||||||
return !manifest.fileName.isEmpty() && packageFile != INVALID_FILE_INFO;
|
|
||||||
}
|
|
||||||
|
|
||||||
FilePath TargetInformation::workingDirectory() const
|
|
||||||
{
|
|
||||||
return FilePath::fromString(runDirectory.absolutePath());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -16,14 +16,9 @@ namespace Internal {
|
|||||||
class Manifest
|
class Manifest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString installPathSuffix;
|
Utils::FilePath filePath;
|
||||||
QString fileName;
|
|
||||||
|
|
||||||
int formatVersion = 0;
|
|
||||||
QString formatType;
|
|
||||||
|
|
||||||
QString id;
|
QString id;
|
||||||
QString icon;
|
|
||||||
QString code;
|
QString code;
|
||||||
QString runtime;
|
QString runtime;
|
||||||
|
|
||||||
@@ -39,21 +34,15 @@ class TargetInformation final
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Manifest manifest;
|
Manifest manifest;
|
||||||
QDir buildDirectory;
|
Utils::FilePath runDirectory;
|
||||||
QDir packageSourcesDirectory;
|
Utils::FilePath packageFilePath;
|
||||||
QDir runDirectory;
|
|
||||||
QFileInfo packageFile;
|
|
||||||
QFileInfo projectFile;
|
|
||||||
QSharedPointer<const ProjectExplorer::IDevice> device;
|
|
||||||
QString buildKey;
|
QString buildKey;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
QString displayNameUniquifier;
|
QString displayNameUniquifier;
|
||||||
QString cmakeBuildTarget;
|
QString cmakeBuildTarget;
|
||||||
bool isBuiltin = false;
|
bool isBuiltin = false;
|
||||||
bool remote = false;
|
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
Utils::FilePath workingDirectory() const;
|
|
||||||
|
|
||||||
TargetInformation() = default;
|
TargetInformation() = default;
|
||||||
TargetInformation(const TargetInformation &other) = default;
|
TargetInformation(const TargetInformation &other) = default;
|
||||||
|
Reference in New Issue
Block a user