Commit 2d4afd04 authored by Daniel Teske's avatar Daniel Teske

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: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
parent 1c5c51c9
......@@ -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
{
......@@ -571,6 +571,12 @@ void AndroidPackageCreationStep::removeManagedFilesFromPackage()
&& dirIt.fileName().startsWith(QLatin1String("libQt5"))
&& 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)
QFile::remove(dirIt.filePath());
}
......@@ -656,7 +662,7 @@ bool AndroidPackageCreationStep::createPackage()
collectFiles(&deployFiles, &importsAndPlugins);
// Remove files from package if they are not needed
removeManagedFilesFromPackage();
removeManagedFilesFromPackage(version->libraryPath());
// Deploy files to package
if (bundleQt) {
......
......@@ -107,7 +107,7 @@ private:
QStringList collectRelativeFilePaths(const QString &parentPath);
void collectFiles(QList<DeployItem> *deployList, QList<DeployItem> *pluginsAndImports);
void removeManagedFilesFromPackage();
void removeManagedFilesFromPackage(const Utils::FileName &qtLibraryDir);
void copyFilesIntoPackage(const QList<DeployItem> &deployList);
void stripFiles(const QList<DeployItem> &deployList);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment