Fix to include transitive jar dependencies of libraries.
Adam Murdoch [Fri, 21 Sep 2012 01:43:57 +0000 (11:43 +1000)]
Change-Id: I3317e78b0042a2b93399fbd402c49ba6a108df46

gradle/src/main/groovy/com/android/build/gradle/AndroidPlugin.groovy
testapps/multiproject/app/build.gradle

index 3a821b3..28302be 100644 (file)
@@ -28,6 +28,7 @@ import com.android.builder.VariantConfiguration
 import org.gradle.api.Plugin
 import org.gradle.api.Project
 import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
 import org.gradle.api.artifacts.ProjectDependency
 import org.gradle.api.plugins.BasePlugin
 
@@ -92,7 +93,7 @@ class AndroidPlugin extends AndroidBasePlugin implements Plugin<Project> {
         if (productFlavor.name.startsWith("test")) {
             throw new RuntimeException("ProductFlavor names cannot start with 'test'")
         }
-        if (productFlavors.containsKey(productFlavor.name)) {
+        if (buildTypes.containsKey(productFlavor.name)) {
             throw new RuntimeException("ProductFlavor names cannot collide with BuildType names")
         }
 
@@ -273,10 +274,8 @@ class AndroidPlugin extends AndroidBasePlugin implements Plugin<Project> {
         // TODO - include variant specific dependencies too
         def compileClasspath = project.configurations.compile
 
-        // TODO - need to sort out ordering here
-        compileClasspath.allDependencies.withType(ProjectDependency).each { dep ->
-            project.evaluationDependsOn(dep.dependencyProject.path)
-        }
+        // TODO - fix this in Gradle
+        ensureConfigured(compileClasspath)
 
         def prepareDependenciesTask = project.tasks.add("prepare${variant.name}Dependencies", PrepareDependenciesTask)
 
@@ -304,4 +303,11 @@ class AndroidPlugin extends AndroidBasePlugin implements Plugin<Project> {
 
         return prepareDependenciesTask
     }
+
+    def ensureConfigured(Configuration config) {
+        config.allDependencies.withType(ProjectDependency).each { dep ->
+            project.evaluationDependsOn(dep.dependencyProject.path)
+            ensureConfigured(dep.projectConfiguration)
+        }
+    }
 }
index 683178e..a8af53e 100644 (file)
@@ -10,6 +10,4 @@ android {
 
 dependencies {
     compile project(':library')
-    // TODO - this should not be here
-    compile project(':util')
 }