forked from qt-creator/qt-creator
Maemo: Prepare unpackaged deployment.
Reviewed-by: kh1
This commit is contained in:
@@ -61,8 +61,9 @@ static const QLatin1String MAEMO_RC_ID_PREFIX(PREFIX ".");
|
|||||||
static const QLatin1String ArgumentsKey(PREFIX ".Arguments");
|
static const QLatin1String ArgumentsKey(PREFIX ".Arguments");
|
||||||
static const QLatin1String SimulatorPathKey(PREFIX ".Simulator");
|
static const QLatin1String SimulatorPathKey(PREFIX ".Simulator");
|
||||||
static const QLatin1String DeviceIdKey(PREFIX ".DeviceId");
|
static const QLatin1String DeviceIdKey(PREFIX ".DeviceId");
|
||||||
static const QLatin1String LastDeployedKey(PREFIX ".LastDeployed");
|
static const QLatin1String LastDeployedHostsKey(PREFIX ".LastDeployedHosts");
|
||||||
static const QLatin1String DebuggingHelpersLastDeployedKey(PREFIX ".DebuggingHelpersLastDeployed");
|
static const QLatin1String LastDeployedFilesKey(PREFIX ".LastDeployedFiles");
|
||||||
|
static const QLatin1String LastDeployedTimesKey(PREFIX ".LastDeployedTimes");
|
||||||
static const QLatin1String ProFileKey(".ProFile");
|
static const QLatin1String ProFileKey(".ProFile");
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
|
|||||||
, m_devConfig(source->m_devConfig)
|
, m_devConfig(source->m_devConfig)
|
||||||
, m_arguments(source->m_arguments)
|
, m_arguments(source->m_arguments)
|
||||||
, m_lastDeployed(source->m_lastDeployed)
|
, m_lastDeployed(source->m_lastDeployed)
|
||||||
, m_debuggingHelpersLastDeployed(source->m_debuggingHelpersLastDeployed)
|
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -124,25 +123,27 @@ QVariantMap MaemoRunConfiguration::toMap() const
|
|||||||
QVariantMap map(RunConfiguration::toMap());
|
QVariantMap map(RunConfiguration::toMap());
|
||||||
map.insert(DeviceIdKey, m_devConfig.internalId);
|
map.insert(DeviceIdKey, m_devConfig.internalId);
|
||||||
map.insert(ArgumentsKey, m_arguments);
|
map.insert(ArgumentsKey, m_arguments);
|
||||||
|
addDeployTimesToMap(map);
|
||||||
addDeployTimesToMap(LastDeployedKey, m_lastDeployed, map);
|
|
||||||
addDeployTimesToMap(DebuggingHelpersLastDeployedKey,
|
|
||||||
m_debuggingHelpersLastDeployed, map);
|
|
||||||
|
|
||||||
const QDir dir = QDir(target()->project()->projectDirectory());
|
const QDir dir = QDir(target()->project()->projectDirectory());
|
||||||
map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath));
|
map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath));
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunConfiguration::addDeployTimesToMap(const QString &key,
|
void MaemoRunConfiguration::addDeployTimesToMap(QVariantMap &map) const
|
||||||
const QMap<QString, QDateTime> &deployTimes, QVariantMap &map) const
|
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> variantMap;
|
QVariantList hostList;
|
||||||
QMap<QString, QDateTime>::ConstIterator it = deployTimes.begin();
|
QVariantList fileList;
|
||||||
for (; it != deployTimes.end(); ++it)
|
QVariantList timeList;
|
||||||
variantMap.insert(it.key(), it.value());
|
typedef QMap<DeployablePerHost, QDateTime>::ConstIterator DepIt;
|
||||||
map.insert(key, variantMap);
|
for (DepIt it = m_lastDeployed.begin(); it != m_lastDeployed.end(); ++it) {
|
||||||
|
hostList << it.key().first;
|
||||||
|
fileList << it.key().second;
|
||||||
|
timeList << it.value();
|
||||||
|
}
|
||||||
|
map.insert(LastDeployedHostsKey, hostList);
|
||||||
|
map.insert(LastDeployedFilesKey, fileList);
|
||||||
|
map.insert(LastDeployedTimesKey, timeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
|
bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
|
||||||
@@ -153,62 +154,40 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
setDeviceConfig(MaemoDeviceConfigurations::instance().
|
setDeviceConfig(MaemoDeviceConfigurations::instance().
|
||||||
find(map.value(DeviceIdKey, 0).toInt()));
|
find(map.value(DeviceIdKey, 0).toInt()));
|
||||||
m_arguments = map.value(ArgumentsKey).toStringList();
|
m_arguments = map.value(ArgumentsKey).toStringList();
|
||||||
|
getDeployTimesFromMap(map);
|
||||||
getDeployTimesFromMap(LastDeployedKey, m_lastDeployed, map);
|
|
||||||
getDeployTimesFromMap(DebuggingHelpersLastDeployedKey,
|
|
||||||
m_debuggingHelpersLastDeployed, map);
|
|
||||||
|
|
||||||
const QDir dir = QDir(target()->project()->projectDirectory());
|
const QDir dir = QDir(target()->project()->projectDirectory());
|
||||||
m_proFilePath = dir.filePath(map.value(ProFileKey).toString());
|
m_proFilePath = dir.filePath(map.value(ProFileKey).toString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunConfiguration::getDeployTimesFromMap(const QString &key,
|
void MaemoRunConfiguration::getDeployTimesFromMap(const QVariantMap &map)
|
||||||
QMap<QString, QDateTime> &deployTimes, const QVariantMap &map)
|
|
||||||
{
|
{
|
||||||
const QVariantMap &variantMap = map.value(key).toMap();
|
const QVariantList &hostList = map.value(LastDeployedHostsKey).toList();
|
||||||
for (QVariantMap::ConstIterator it = variantMap.begin();
|
const QVariantList &fileList = map.value(LastDeployedFilesKey).toList();
|
||||||
it != variantMap.end(); ++it)
|
const QVariantList &timeList = map.value(LastDeployedTimesKey).toList();
|
||||||
deployTimes.insert(it.key(), it.value().toDateTime());
|
const int elemCount
|
||||||
}
|
= qMin(qMin(hostList.size(), fileList.size()), timeList.size());
|
||||||
|
for (int i = 0; i < elemCount; ++i) {
|
||||||
bool MaemoRunConfiguration::currentlyNeedsDeployment(const QString &host) const
|
m_lastDeployed.insert(DeployablePerHost(hostList.at(i).toString(),
|
||||||
{
|
fileList.at(i).toString()), timeList.at(i).toDateTime());
|
||||||
return fileNeedsDeployment(packageStep()->packageFilePath(),
|
|
||||||
m_lastDeployed.value(host));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoRunConfiguration::wasDeployed(const QString &host)
|
|
||||||
{
|
|
||||||
m_lastDeployed.insert(host, QDateTime::currentDateTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MaemoRunConfiguration::hasDebuggingHelpers() const
|
|
||||||
{
|
|
||||||
Qt4BuildConfiguration *qt4bc = activeQt4BuildConfiguration();
|
|
||||||
return qt4bc->qtVersion()->hasDebuggingHelper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MaemoRunConfiguration::debuggingHelpersNeedDeployment(const QString &host) const
|
|
||||||
{
|
|
||||||
if (hasDebuggingHelpers()) {
|
|
||||||
return fileNeedsDeployment(dumperLib(),
|
|
||||||
m_debuggingHelpersLastDeployed.value(host));
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunConfiguration::debuggingHelpersDeployed(const QString &host)
|
bool MaemoRunConfiguration::currentlyNeedsDeployment(const QString &host,
|
||||||
{
|
const QString &file) const
|
||||||
m_debuggingHelpersLastDeployed.insert(host, QDateTime::currentDateTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MaemoRunConfiguration::fileNeedsDeployment(const QString &path,
|
|
||||||
const QDateTime &lastDeployed) const
|
|
||||||
{
|
{
|
||||||
|
const QDateTime &lastDeployed
|
||||||
|
= m_lastDeployed.value(DeployablePerHost(host, file));
|
||||||
return !lastDeployed.isValid()
|
return !lastDeployed.isValid()
|
||||||
|| QFileInfo(path).lastModified() > lastDeployed;
|
|| QFileInfo(file).lastModified() > lastDeployed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoRunConfiguration::setDeployed(const QString &host,
|
||||||
|
const QString &file)
|
||||||
|
{
|
||||||
|
m_lastDeployed.insert(DeployablePerHost(host, file),
|
||||||
|
QDateTime::currentDateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunConfiguration::setDeviceConfig(const MaemoDeviceConfig &devConf)
|
void MaemoRunConfiguration::setDeviceConfig(const MaemoDeviceConfig &devConf)
|
||||||
|
|||||||
@@ -69,12 +69,9 @@ public:
|
|||||||
Qt4Target *qt4Target() const;
|
Qt4Target *qt4Target() const;
|
||||||
Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
|
Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
|
||||||
|
|
||||||
bool currentlyNeedsDeployment(const QString &host) const;
|
bool currentlyNeedsDeployment(const QString &host,
|
||||||
void wasDeployed(const QString &host);
|
const QString &file) const;
|
||||||
|
void setDeployed(const QString &host, const QString &file);
|
||||||
bool hasDebuggingHelpers() const;
|
|
||||||
bool debuggingHelpersNeedDeployment(const QString &host) const;
|
|
||||||
void debuggingHelpersDeployed(const QString &host);
|
|
||||||
|
|
||||||
const MaemoPackageCreationStep *packageStep() const;
|
const MaemoPackageCreationStep *packageStep() const;
|
||||||
|
|
||||||
@@ -112,13 +109,8 @@ private:
|
|||||||
void init();
|
void init();
|
||||||
const QString cmd(const QString &cmdName) const;
|
const QString cmd(const QString &cmdName) const;
|
||||||
const MaemoToolChain *toolchain() const;
|
const MaemoToolChain *toolchain() const;
|
||||||
bool fileNeedsDeployment(const QString &path, const QDateTime &lastDeployed) const;
|
void addDeployTimesToMap(QVariantMap &map) const;
|
||||||
void addDeployTimesToMap(const QString &key,
|
void getDeployTimesFromMap(const QVariantMap &map);
|
||||||
const QMap<QString, QDateTime> &deployTimes,
|
|
||||||
QVariantMap &map) const;
|
|
||||||
void getDeployTimesFromMap(const QString &key,
|
|
||||||
QMap<QString, QDateTime> &deployTimes,
|
|
||||||
const QVariantMap &map);
|
|
||||||
|
|
||||||
QString m_proFilePath;
|
QString m_proFilePath;
|
||||||
mutable QString m_gdbPath;
|
mutable QString m_gdbPath;
|
||||||
@@ -126,9 +118,8 @@ private:
|
|||||||
MaemoDeviceConfig m_devConfig;
|
MaemoDeviceConfig m_devConfig;
|
||||||
QStringList m_arguments;
|
QStringList m_arguments;
|
||||||
|
|
||||||
// These map host names to deploy times.
|
typedef QPair<QString, QString> DeployablePerHost;
|
||||||
QMap<QString, QDateTime> m_lastDeployed;
|
QMap<DeployablePerHost, QDateTime> m_lastDeployed;
|
||||||
QMap<QString, QDateTime> m_debuggingHelpersLastDeployed;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -124,21 +124,22 @@ void AbstractMaemoRunControl::startDeployment(bool forDebugging)
|
|||||||
emit finished();
|
emit finished();
|
||||||
} else {
|
} else {
|
||||||
m_deployables.clear();
|
m_deployables.clear();
|
||||||
if (m_runConfig->currentlyNeedsDeployment(m_devConfig.server.host)) {
|
if (m_runConfig->currentlyNeedsDeployment(m_devConfig.server.host,
|
||||||
|
packageFilePath())) {
|
||||||
m_deployables.append(Deployable(packageFileName(),
|
m_deployables.append(Deployable(packageFileName(),
|
||||||
QFileInfo(executableOnHost()).canonicalPath(),
|
QFileInfo(executableOnHost()).canonicalPath()));
|
||||||
&MaemoRunConfiguration::wasDeployed));
|
|
||||||
m_needsInstall = true;
|
m_needsInstall = true;
|
||||||
} else {
|
} else {
|
||||||
m_needsInstall = false;
|
m_needsInstall = false;
|
||||||
}
|
}
|
||||||
if (forDebugging
|
if (forDebugging) {
|
||||||
&& m_runConfig->debuggingHelpersNeedDeployment(m_devConfig.server.host)) {
|
const QFileInfo info(m_runConfig->dumperLib());
|
||||||
const QFileInfo &info(m_runConfig->dumperLib());
|
if (info.exists()
|
||||||
m_deployables.append(Deployable(info.fileName(), info.canonicalPath(),
|
&& m_runConfig->currentlyNeedsDeployment(m_devConfig.server.host,
|
||||||
&MaemoRunConfiguration::debuggingHelpersDeployed));
|
info.filePath())) {
|
||||||
|
m_deployables.append(Deployable(info.fileName(), info.canonicalPath()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy();
|
deploy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,7 +180,8 @@ void AbstractMaemoRunControl::deploy()
|
|||||||
void AbstractMaemoRunControl::handleFileCopied()
|
void AbstractMaemoRunControl::handleFileCopied()
|
||||||
{
|
{
|
||||||
Deployable deployable = m_deployables.takeFirst();
|
Deployable deployable = m_deployables.takeFirst();
|
||||||
(m_runConfig->*deployable.updateTimestamp)(m_devConfig.server.host);
|
m_runConfig->setDeployed(m_devConfig.server.host,
|
||||||
|
deployable.dir + QLatin1Char('/') + deployable.fileName);
|
||||||
m_progress.setProgressValue(m_progress.progressValue() + 1);
|
m_progress.setProgressValue(m_progress.progressValue() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,12 +117,10 @@ private:
|
|||||||
|
|
||||||
struct Deployable
|
struct Deployable
|
||||||
{
|
{
|
||||||
typedef void (MaemoRunConfiguration::*updateFunc)(const QString&);
|
Deployable(const QString &f, const QString &d)
|
||||||
Deployable(const QString &f, const QString &d, updateFunc u)
|
: fileName(f), dir(d) {}
|
||||||
: fileName(f), dir(d), updateTimestamp(u) {}
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
QString dir;
|
QString dir;
|
||||||
updateFunc updateTimestamp;
|
|
||||||
};
|
};
|
||||||
QList<Deployable> m_deployables;
|
QList<Deployable> m_deployables;
|
||||||
bool m_needsInstall;
|
bool m_needsInstall;
|
||||||
|
|||||||
Reference in New Issue
Block a user