14
14
15
15
package com.google.firebase.gradle.plugins.publish
16
16
17
+ import com.google.firebase.gradle.plugins.FirebaseLibraryExtension
17
18
import org.gradle.api.GradleException
18
19
import org.gradle.api.Project
19
20
import org.gradle.api.artifacts.Configuration
@@ -28,7 +29,7 @@ class Publisher {
28
29
RELEASE ,
29
30
SNAPSHOT
30
31
}
31
- private final Mode mode;
32
+ private final Mode mode
32
33
private final Set<Project > projectsToPublish
33
34
34
35
Publisher (Mode mode , Set<Project > projectsToPublish ) {
@@ -93,27 +94,33 @@ class Publisher {
93
94
dummyDependencyConfiguration. dependencies. addAll(nonProjectDependencies)
94
95
try {
95
96
return project. configurations. releaseRuntimeClasspath. getAllDependencies(). collectEntries {
96
- [( " $i t . group : $i t . name " as String ): getType(dummyDependencyConfiguration, it)]
97
+ getType(dummyDependencyConfiguration, it)
97
98
}
98
99
} finally {
99
100
project. configurations. remove(dummyDependencyConfiguration)
100
101
}
101
102
102
103
}
103
104
104
- private static String getType (Configuration config , Dependency d ) {
105
+ private static def getType (Configuration config , Dependency d ) {
105
106
if (d instanceof ProjectDependency ) {
106
107
// we currently only support aar libraries to be produced in this repository
107
- return ' aar'
108
+ def library = getFirebaseLibrary(d. dependencyProject)
109
+ return [(" ${ library.groupId.get()} :${ library.artifactId.get()} " as String ): ' aar' ]
108
110
}
109
111
String path = config. find {
110
112
it. absolutePath. matches(" .*\\ Q$d. group /$d. name /$d. version /\\ E[a-zA-Z0-9]+/\\ Q$d. name -$d. version . \\ E[aj]ar" )
111
113
}?. absolutePath
114
+
112
115
if (path && path. endsWith (" .aar" )) {
113
- return " aar "
116
+ return [( " $d . group : $d . name " as String ): ' aar ' ]
114
117
} else {
115
- return " jar "
118
+ return [( " $d . group : $d . name " as String ): ' jar ' ]
116
119
}
117
120
}
118
121
122
+ private static FirebaseLibraryExtension getFirebaseLibrary (Project project ) {
123
+ return project. extensions. getByType(FirebaseLibraryExtension . class);
124
+ }
125
+
119
126
}
0 commit comments