From 35b96f2fc11bcc6d0b4bfb2b405c115fb0d6033e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20Str=C3=B8mme?= <christian.stromme@digia.com>
Date: Thu, 16 May 2013 03:58:26 +0200
Subject: [PATCH] Android: Detect conditional dependencies.

To solve the problem with libQt5MultimediaQuick_p we need a way to detect
if an application is using both QtMultimedia and QtQuick.
This change adds logic to parse the -dependencies.xml file and look for
lib elements that have the extra attribute "extends". Libs with the
extends attribute will only be added to the list of dependencies, if the
library it extends is available.

Task-number: QTCREATORBUG-9300
Change-Id: I6f3e0a6d9158a91824e1e113f6aab7ec1112dd56
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
---
 src/plugins/android/androidmanager.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp
index 29ff4ed09bd..03aa1b56b67 100644
--- a/src/plugins/android/androidmanager.cpp
+++ b/src/plugins/android/androidmanager.cpp
@@ -895,8 +895,14 @@ QString AndroidManager::loadLocal(ProjectExplorer::Target *target, int apiLevel,
                     if (libElement.attribute(QLatin1String("bundling")).toInt() == (item == BundledJar ? 1 : 0)) {
                         if (libElement.hasAttribute(attribute)) {
                             QString dependencyLib = libElement.attribute(attribute).arg(apiLevel);
-                            if (!dependencyLibs.contains(dependencyLib))
+                            if (libElement.hasAttribute(QLatin1String("extends"))) {
+                                const QString extends = libElement.attribute(QLatin1String("extends"));
+                                if (libs.contains(extends)) {
+                                    dependencyLibs << dependencyLib;
+                                }
+                            } else if (!dependencyLibs.contains(dependencyLib)) {
                                 dependencyLibs << dependencyLib;
+                            }
                         }
 
                         if (libElement.hasAttribute(QLatin1String("replaces"))) {
-- 
GitLab