From 417b80c5449effcf92154fd55a86b427736e61a1 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Date: Wed, 21 Aug 2013 13:28:03 +0200
Subject: [PATCH] make the android => qbs dependency optional

as qbs itself is optional

Change-Id: I1ff2d2f785ca206b379b305e783b9914081712b4
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
---
 src/plugins/android/android.pro              | 14 +++++++++----
 src/plugins/android/android.qbs              | 21 +++++++++++++++++---
 src/plugins/android/android_dependencies.pri |  7 +++++--
 src/plugins/android/androidplugin.cpp        |  6 +++++-
 4 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro
index 49bec3a6b2c..4f8ee5406ce 100644
--- a/src/plugins/android/android.pro
+++ b/src/plugins/android/android.pro
@@ -40,8 +40,7 @@ HEADERS += \
     androidmanifesteditorfactory.h \
     androidmanifesteditor.h \
     androidmanifesteditorwidget.h \
-    androidmanifestdocument.h \
-    androidqbspropertyprovider.h
+    androidmanifestdocument.h
 
 SOURCES += \
     androidconfigurations.cpp \
@@ -76,8 +75,7 @@ SOURCES += \
     androidmanifesteditorfactory.cpp \
     androidmanifesteditor.cpp \
     androidmanifesteditorwidget.cpp \
-    androidmanifestdocument.cpp \
-    androidqbspropertyprovider.cpp
+    androidmanifestdocument.cpp
 
 FORMS += \
     androidsettingswidget.ui \
@@ -86,5 +84,13 @@ FORMS += \
     addnewavddialog.ui \
     androidcreatekeystorecertificate.ui
 
+exists(../../shared/qbs/qbs.pro) {
+    HEADERS += \
+        androidqbspropertyprovider.h
+    SOURCES += \
+        androidqbspropertyprovider.cpp
+    DEFINES += HAVE_QBS
+}
+
 RESOURCES = android.qrc
 DEFINES += ANDROID_LIBRARY
diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs
index 231f3eef328..b6707534857 100644
--- a/src/plugins/android/android.qbs
+++ b/src/plugins/android/android.qbs
@@ -8,7 +8,10 @@ QtcPlugin {
     Depends { name: "Core" }
     Depends { name: "ProjectExplorer" }
     Depends { name: "Qt4ProjectManager" }
-    Depends { name: "QbsProjectManager" }
+    Depends {
+        name: "QbsProjectManager"
+        condition: project.buildQbsProjectManager
+    }
     Depends { name: "Debugger" }
     Depends { name: "QmlDebug" }
     Depends { name: "QtSupport" }
@@ -21,6 +24,11 @@ QtcPlugin {
 
     cpp.includePaths: base.concat("../../shared")
 
+    Properties {
+        condition: project.buildQbsProjectManager
+        cpp.defines: base.concat(['HAVE_QBS'])
+    }
+
     files: [
         "addnewavddialog.ui",
         "android.qrc",
@@ -73,8 +81,6 @@ QtcPlugin {
         "androidpackageinstallationstep.h",
         "androidplugin.cpp",
         "androidplugin.h",
-        "androidqbspropertyprovider.cpp",
-        "androidqbspropertyprovider.h",
         "androidqtversion.cpp",
         "androidqtversion.h",
         "androidqtversionfactory.cpp",
@@ -99,4 +105,13 @@ QtcPlugin {
         "javaparser.cpp",
         "javaparser.h",
     ]
+
+    Group {
+        name: "Qbs Support"
+        condition: project.buildQbsProjectManager
+        files: [
+            "androidqbspropertyprovider.cpp",
+            "androidqbspropertyprovider.h",
+        ]
+    }
 }
diff --git a/src/plugins/android/android_dependencies.pri b/src/plugins/android/android_dependencies.pri
index f9459fe9913..4ee3ff5acff 100644
--- a/src/plugins/android/android_dependencies.pri
+++ b/src/plugins/android/android_dependencies.pri
@@ -6,5 +6,8 @@ QTC_PLUGIN_DEPENDS += \
     qt4projectmanager \
     qtsupport \
     texteditor \
-    analyzerbase \
-    qbsprojectmanager
+    analyzerbase
+
+exists(../../shared/qbs/qbs.pro): \
+    QTC_PLUGIN_DEPENDS += \
+        qbsprojectmanager
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp
index 86ed2894474..da22d925d14 100644
--- a/src/plugins/android/androidplugin.cpp
+++ b/src/plugins/android/androidplugin.cpp
@@ -44,7 +44,9 @@
 #include "androiddeployconfiguration.h"
 #include "androidgdbserverkitinformation.h"
 #include "androidmanifesteditorfactory.h"
-#include "androidqbspropertyprovider.h"
+#ifdef HAVE_QBS
+#  include "androidqbspropertyprovider.h"
+#endif
 
 #include <coreplugin/mimedatabase.h>
 #include <coreplugin/icore.h>
@@ -98,7 +100,9 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
 
     connect(ProjectExplorer::DeviceManager::instance(), SIGNAL(devicesLoaded()),
             this, SLOT(updateDevice()));
+#ifdef HAVE_QBS
     addAutoReleasedObject(new Internal::AndroidQBSPropertyProvider);
+#endif
     return true;
 }
 
-- 
GitLab