diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> | 2013-05-07 14:25:13 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> | 2013-05-16 14:54:28 +0200 |
commit | 342d65f7a2cf1166e0588cbe507e51310863c133 (patch) | |
tree | cbe65d1c15d380f6f70a73540186b8bd9640f606 | |
parent | ee9ec5a4d0cb8c5306d94c981386a9ed228cff74 (diff) |
Make it possible for a module to specify bundling single files
To make sure libQt5QuickParticles.so is loaded for Qt Quick
applications, we need to be able to specify bundling
specific files, not just subdirectories.
Task-number: QTCREATORBUG-9299
Change-Id: I743ee5ea714355ba6398378f4f54b6ede64d4c85
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
-rw-r--r-- | src/plugins/android/androidpackagecreationstep.cpp | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/plugins/android/androidpackagecreationstep.cpp b/src/plugins/android/androidpackagecreationstep.cpp index 0464011980..c80111d629 100644 --- a/src/plugins/android/androidpackagecreationstep.cpp +++ b/src/plugins/android/androidpackagecreationstep.cpp @@ -520,12 +520,20 @@ void AndroidPackageCreationStep::collectFiles(QList<DeployItem> *deployList, QSet<QString> alreadyListed; foreach (QString bundledFile, m_otherBundledFiles) { - if (!bundledFile.endsWith(QLatin1Char('/'))) - bundledFile.append(QLatin1Char('/')); + QStringList allFiles; + if (QFileInfo(qtVersionSourcePath + QLatin1Char('/') + bundledFile).isDir()) { + if (!bundledFile.endsWith(QLatin1Char('/'))) + bundledFile.append(QLatin1Char('/')); + + allFiles = collectRelativeFilePaths(qtVersionSourcePath + QLatin1Char('/') + bundledFile); + } else { + // If we need to bundle a specific file, we just add an empty string and the file + // names and data will be prepared correctly in the loop below. + allFiles = QStringList(QString()); + } - QStringList allFiles = collectRelativeFilePaths(qtVersionSourcePath + QLatin1Char('/') + bundledFile); foreach (QString file, allFiles) { - QString fullPath = qtVersionSourcePath + QLatin1Char('/') + bundledFile + QLatin1Char('/') + file; + QString fullPath = qtVersionSourcePath + QLatin1Char('/') + bundledFile + file; if (alreadyListed.contains(fullPath)) continue; @@ -534,22 +542,31 @@ void AndroidPackageCreationStep::collectFiles(QList<DeployItem> *deployList, QString garbledFileName; QString destinationPath; bool shouldStrip = false; - if (file.endsWith(QLatin1String(".so"))) { - garbledFileName = QLatin1String("lib") - + AndroidManager::libraryPrefix() - + QString(bundledFile).replace(QLatin1Char('/'), QLatin1Char('_')) - + QString(file).replace(QLatin1Char('/'), QLatin1Char('_')); + + QString fullFileName = bundledFile + file; + if (fullFileName.endsWith(QLatin1String(".so"))) { + if (fullFileName.startsWith(QLatin1String("lib/"))) { + // Special case when the destination folder is lib/ + // Since this is also the source folder, there is no need to garble the file + // name and copy it. We also won't have write access to this folder, so we + // couldn't if we wanted to. + garbledFileName = fullFileName.mid(sizeof("lib/") - 1); + } else { + garbledFileName = QLatin1String("lib") + + AndroidManager::libraryPrefix() + + QString(fullFileName).replace(QLatin1Char('/'), QLatin1Char('_')); + } destinationPath = androidLibPath + QLatin1Char('/') + garbledFileName; shouldStrip = true; } else { - garbledFileName = AndroidManager::libraryPrefix() + bundledFile + file; + garbledFileName = AndroidManager::libraryPrefix() + fullFileName; destinationPath = androidAssetsPath + garbledFileName; } deployList->append(DeployItem(fullPath, 0, destinationPath, shouldStrip)); pluginsAndImportsList->append(DeployItem(garbledFileName, 0, - bundledFile + file, + fullFileName, shouldStrip)); } } |