Android: Clean up before packaging, be a little bit more careful.

The android/libs folder contains both the library from the project and
libraries from qt. This adds a small check before removing libQt5*.so,
that checks if that file is in qt's lib folder. That fixes the bug
below, but e.g. naming your project Qt5Test won't work.
Long term we'll need to overhaul the packaging and make that more
robust.

Task-number: QTCREATORBUG-9895
Change-Id: I48f735114ee95668a862549cfe1537aeab968dfb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Daniel Teske
2013-08-08 17:19:39 +02:00
parent 1c5c51c91d
commit 2d4afd0494
2 changed files with 9 additions and 3 deletions

View File

@@ -557,7 +557,7 @@ void AndroidPackageCreationStep::collectFiles(QList<DeployItem> *deployList,
} }
} }
void AndroidPackageCreationStep::removeManagedFilesFromPackage() void AndroidPackageCreationStep::removeManagedFilesFromPackage(const Utils::FileName &qtLibraryDir)
{ {
// Clean up all files managed by Qt Creator // Clean up all files managed by Qt Creator
{ {
@@ -571,6 +571,12 @@ void AndroidPackageCreationStep::removeManagedFilesFromPackage()
&& dirIt.fileName().startsWith(QLatin1String("libQt5")) && dirIt.fileName().startsWith(QLatin1String("libQt5"))
&& dirIt.fileName().endsWith(QLatin1String(".so")); && dirIt.fileName().endsWith(QLatin1String(".so"));
if (isQtLibrary) {
Utils::FileName qtLibraryFile = qtLibraryDir;
qtLibraryFile.appendPath(dirIt.fileName());
isQtLibrary = qtLibraryFile.toFileInfo().exists();
}
if (dirIt.filePath().contains(AndroidManager::libraryPrefix()) || isQtLibrary) if (dirIt.filePath().contains(AndroidManager::libraryPrefix()) || isQtLibrary)
QFile::remove(dirIt.filePath()); QFile::remove(dirIt.filePath());
} }
@@ -656,7 +662,7 @@ bool AndroidPackageCreationStep::createPackage()
collectFiles(&deployFiles, &importsAndPlugins); collectFiles(&deployFiles, &importsAndPlugins);
// Remove files from package if they are not needed // Remove files from package if they are not needed
removeManagedFilesFromPackage(); removeManagedFilesFromPackage(version->libraryPath());
// Deploy files to package // Deploy files to package
if (bundleQt) { if (bundleQt) {

View File

@@ -107,7 +107,7 @@ private:
QStringList collectRelativeFilePaths(const QString &parentPath); QStringList collectRelativeFilePaths(const QString &parentPath);
void collectFiles(QList<DeployItem> *deployList, QList<DeployItem> *pluginsAndImports); void collectFiles(QList<DeployItem> *deployList, QList<DeployItem> *pluginsAndImports);
void removeManagedFilesFromPackage(); void removeManagedFilesFromPackage(const Utils::FileName &qtLibraryDir);
void copyFilesIntoPackage(const QList<DeployItem> &deployList); void copyFilesIntoPackage(const QList<DeployItem> &deployList);
void stripFiles(const QList<DeployItem> &deployList); void stripFiles(const QList<DeployItem> &deployList);