Avoid linking libretroshare in qml app and notify

Use QDir::homePath() instead of RsAccounts::ConfigDirectory() to
  determine libresapi socket path, this way statically linking to
  libretroshare is not needed and the android package size is reduced
  dramatically 20+MB -> 13MB

At same time this solves the socket path mismatch between retroshare
  android  service and the other android applications due to merge
This commit is contained in:
Gioacchino Mazzurco 2017-04-18 23:14:44 +02:00
parent 4455bfa92d
commit e83fec8d84
4 changed files with 13 additions and 11 deletions

View File

@ -34,21 +34,21 @@ retroshare_nogui {
retroshare_android_service {
SUBDIRS += retroshare_android_service
retroshare_android_service.file = retroshare-android-service/src/retroshare-android-service.pro
retroshare_android_service.depends = libretroshare libresapi
retroshare_android_service.depends = libresapi
retroshare_android_service.target = retroshare_android_service
}
retroshare_android_notify_service {
SUBDIRS += retroshare_android_notify_service
retroshare_android_notify_service.file = retroshare-android-notify-service/src/retroshare-android-notify-service.pro
retroshare_android_notify_service.depends = libretroshare retroshare_android_service
retroshare_android_notify_service.depends = retroshare_android_service
retroshare_android_notify_service.target = retroshare_android_notify_service
}
retroshare_qml_app {
SUBDIRS += retroshare_qml_app
retroshare_qml_app.file = retroshare-qml-app/src/retroshare-qml-app.pro
retroshare_qml_app.depends = libretroshare retroshare_android_service
retroshare_qml_app.depends = retroshare_android_service
retroshare_qml_app.target = retroshare_qml_app
android-g++ {

View File

@ -21,6 +21,7 @@
#include <QQmlContext>
#include <QFileInfo>
#include <QDebug>
#include <QDir>
#ifdef __ANDROID__
# include "util/androiddebug.h"
@ -29,9 +30,6 @@
#include "libresapilocalclient.h"
#include "notificationsbridge.h"
#include "retroshare/rsinit.h"
int main(int argc, char *argv[])
{
#ifdef __ANDROID__
@ -40,7 +38,7 @@ int main(int argc, char *argv[])
QCoreApplication app(argc, argv);
QString sockPath = QString::fromStdString(RsAccounts::ConfigDirectory());
QString sockPath = QDir::homePath() + "/.retroshare";
sockPath.append("/libresapi.sock");
QQmlApplicationEngine engine;

View File

@ -19,6 +19,7 @@
#include <QCoreApplication>
#include <QDebug>
#include <QMetaObject>
#include <QDir>
#ifdef __ANDROID__
# include "util/androiddebug.h"
@ -44,10 +45,12 @@ int main(int argc, char *argv[])
dynamic_cast<resource_api::ResourceRouter*>(&ctrl_mod),
&resource_api::RsControlModule::handleRequest);
#ifdef QT_DEBUG
#if defined(Q_OS_WIN) && defined(QT_DEBUG)
QString sockPath = "RS/";
#else
#elif defined(Q_OS_WIN)
QString sockPath = QCoreApplication::applicationDirPath();
#else
QString sockPath = QDir::homePath() + "/.retroshare";
#endif
sockPath.append("/libresapi.sock");

View File

@ -22,6 +22,8 @@
#include <QQmlContext>
#include <QQmlComponent>
#include <QDebug>
#include <QDir>
#include <unistd.h> // for usleep
#ifdef Q_OS_ANDROID
# include <QtAndroid>
@ -30,7 +32,6 @@
#endif // Q_OS_ANDROID
#include "libresapilocalclient.h"
#include "retroshare/rsinit.h"
#include "rsqmlappengine.h"
int main(int argc, char *argv[])
@ -44,7 +45,7 @@ int main(int argc, char *argv[])
"org.retroshare.qml_components.LibresapiLocalClient", 1, 0,
"LibresapiLocalClient");
QString sockPath = QString::fromStdString(RsAccounts::ConfigDirectory());
QString sockPath = QDir::homePath() + "/.retroshare";
sockPath.append("/libresapi.sock");
LibresapiLocalClient rsApi;