Android: Say hello to gradle!

Switching from Ant to Gradle brings lots of advantages:
 - it is way faster when rebuilding (25-50% faster than ant).
 - it enables first class Android Studio integration.
 - adding Android Extras libs (e.g. Google Play services, OBB, etc.) to
   your project is now painless.

[ChangeLog][Android] Added Gradle support to build the APK.

Change-Id: Iee492954f8ffb2c22e6ab14a8a25faf644de9a51
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
BogDan Vatra
2014-09-22 16:20:51 +03:00
parent 222fbdb58b
commit 3bcae52584
29 changed files with 507 additions and 170 deletions

View File

@@ -139,18 +139,20 @@ bool FileUtils::removeRecursively(const FileName &filePath, QString *error)
Returns whether the operation succeeded.
*/
bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgtFilePath,
QString *error)
QString *error, const std::function<bool (QFileInfo, QFileInfo, QString *)> &copyHelper)
{
QFileInfo srcFileInfo = srcFilePath.toFileInfo();
if (srcFileInfo.isDir()) {
QDir targetDir(tgtFilePath.toString());
targetDir.cdUp();
if (!targetDir.mkdir(tgtFilePath.toFileInfo().fileName())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", "Failed to create directory \"%1\".")
.arg(tgtFilePath.toUserOutput());
if (!tgtFilePath.toFileInfo().exists()) {
QDir targetDir(tgtFilePath.toString());
targetDir.cdUp();
if (!targetDir.mkdir(tgtFilePath.toFileInfo().fileName())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", "Failed to create directory \"%1\".")
.arg(tgtFilePath.toUserOutput());
}
return false;
}
return false;
}
QDir sourceDir(srcFilePath.toString());
QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot
@@ -160,16 +162,21 @@ bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgt
newSrcFilePath.appendPath(fileName);
FileName newTgtFilePath = tgtFilePath;
newTgtFilePath.appendPath(fileName);
if (!copyRecursively(newSrcFilePath, newTgtFilePath, error))
if (!copyRecursively(newSrcFilePath, newTgtFilePath, error, copyHelper))
return false;
}
} else {
if (!QFile::copy(srcFilePath.toString(), tgtFilePath.toString())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", "Could not copy file \"%1\" to \"%2\".")
.arg(srcFilePath.toUserOutput(), tgtFilePath.toUserOutput());
if (copyHelper) {
if (!copyHelper(srcFileInfo, tgtFilePath.toFileInfo(), error))
return false;
} else {
if (!QFile::copy(srcFilePath.toString(), tgtFilePath.toString())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", "Could not copy file \"%1\" to \"%2\".")
.arg(srcFilePath.toUserOutput(), tgtFilePath.toUserOutput());
}
return false;
}
return false;
}
}
return true;