Maemo: More precise list of deployable files for library projects.

We now also take libmylib.so.x.y.z etc. into account.
This commit is contained in:
Christian Kandeler
2011-05-13 13:54:44 +02:00
parent 4678208c3a
commit ed2946bad9
2 changed files with 30 additions and 14 deletions

View File

@@ -63,6 +63,7 @@ MaemoDeployableListModel::MaemoDeployableListModel(const Qt4ProFileNode *proFile
m_projectName(proFileNode->displayName()), m_projectName(proFileNode->displayName()),
m_targetInfo(proFileNode->targetInformation()), m_targetInfo(proFileNode->targetInformation()),
m_installsList(proFileNode->installsList()), m_installsList(proFileNode->installsList()),
m_projectVersion(proFileNode->projectVersion()),
m_config(proFileNode->variableValue(ConfigVar)), m_config(proFileNode->variableValue(ConfigVar)),
m_modified(false), m_modified(false),
m_proFileUpdateSetting(updateSetting), m_proFileUpdateSetting(updateSetting),
@@ -87,9 +88,14 @@ bool MaemoDeployableListModel::buildModel()
const QStringList deployInfo = QStringList() << remoteDir const QStringList deployInfo = QStringList() << remoteDir
<< QLatin1String("INSTALLS += target"); << QLatin1String("INSTALLS += target");
return addLinesToProFile(deployInfo); return addLinesToProFile(deployInfo);
} else if (m_projectType != AuxTemplate) { } else if (m_projectType == ApplicationTemplate) {
m_deployables.prepend(MaemoDeployable(localExecutableFilePath(), m_deployables.prepend(MaemoDeployable(localExecutableFilePath(),
m_installsList.targetPath)); m_installsList.targetPath));
} else if (m_projectType == LibraryTemplate) {
foreach (const QString &filePath, localLibraryFilePaths()) {
m_deployables.prepend(MaemoDeployable(filePath,
m_installsList.targetPath));
}
} }
foreach (const InstallsItem &elem, m_installsList.items) { foreach (const InstallsItem &elem, m_installsList.items) {
foreach (const QString &file, elem.files) foreach (const QString &file, elem.files)
@@ -172,26 +178,34 @@ QVariant MaemoDeployableListModel::headerData(int section,
QString MaemoDeployableListModel::localExecutableFilePath() const QString MaemoDeployableListModel::localExecutableFilePath() const
{ {
if (!m_targetInfo.valid) if (!m_targetInfo.valid || m_projectType != ApplicationTemplate)
return QString(); return QString();
return QDir::cleanPath(m_targetInfo.workingDir + '/' + m_targetInfo.target);
}
const bool isLib = m_projectType == LibraryTemplate; QStringList MaemoDeployableListModel::localLibraryFilePaths() const
bool isStatic = false; // Nonsense init for stupid compilers. {
QString fileName; if (!m_targetInfo.valid || m_projectType != LibraryTemplate)
if (isLib) { return QStringList();
fileName += QLatin1String("lib"); QString basePath = m_targetInfo.workingDir + QLatin1String("/lib");
isStatic = m_config.contains(QLatin1String("static")) const bool isStatic = m_config.contains(QLatin1String("static"))
|| m_config.contains(QLatin1String("staticlib")); || m_config.contains(QLatin1String("staticlib"));
} basePath += m_targetInfo.target + QLatin1String(isStatic ? ".a" : ".so");
fileName += m_targetInfo.target; basePath = QDir::cleanPath(basePath);
if (isLib) const QChar dot(QLatin1Char('.'));
fileName += QLatin1String(isStatic ? ".a" : ".so"); const QString filePathMajor = basePath + dot
return QDir::cleanPath(m_targetInfo.workingDir + '/' + fileName); + QString::number(m_projectVersion.major);
const QString filePathMinor = filePathMajor + dot
+ QString::number(m_projectVersion.minor);
const QString filePathPatch = filePathMinor + dot
+ QString::number(m_projectVersion.patch);
return QStringList() << filePathPatch << filePathMinor << filePathMajor
<< basePath;
} }
QString MaemoDeployableListModel::remoteExecutableFilePath() const QString MaemoDeployableListModel::remoteExecutableFilePath() const
{ {
return m_hasTargetPath return m_hasTargetPath && m_projectType == ApplicationTemplate
? deployableAt(0).remoteDir + '/' ? deployableAt(0).remoteDir + '/'
+ QFileInfo(localExecutableFilePath()).fileName() + QFileInfo(localExecutableFilePath()).fileName()
: QString(); : QString();

View File

@@ -102,12 +102,14 @@ private:
QString proFileScope() const; QString proFileScope() const;
QString installPrefix() const; QString installPrefix() const;
QString remoteIconDir() const; QString remoteIconDir() const;
QStringList localLibraryFilePaths() const;
const Qt4ProjectType m_projectType; const Qt4ProjectType m_projectType;
const QString m_proFilePath; const QString m_proFilePath;
const QString m_projectName; const QString m_projectName;
const TargetInformation m_targetInfo; const TargetInformation m_targetInfo;
const InstallsList m_installsList; const InstallsList m_installsList;
const ProjectVersion m_projectVersion;
const QStringList m_config; const QStringList m_config;
QList<MaemoDeployable> m_deployables; QList<MaemoDeployable> m_deployables;
mutable bool m_modified; mutable bool m_modified;