@@ -32,30 +32,44 @@ allprojects {
32
32
mavenLocal()
33
33
}
34
34
35
- // Skip Javadoc generation for Java 1.8 as it breaks build
36
- if (JavaVersion .current().isJava8Compatible) {
37
- tasks.withType<Javadoc > {
38
- options {
39
- this as StandardJavadocDocletOptions
40
- addStringOption(" Xdoclint:none" , " -quiet" )
41
- }
42
- }
43
- }
44
-
45
35
if ((group as String ).isNotEmpty() && name != " lint" && name != " internal" ) {
46
36
configureAndroid()
47
37
configureQuality()
48
38
49
- val isLibrary = name == " library"
50
39
if (Config .submodules.contains(name) || isLibrary) {
51
- setupPublishing(isLibrary)
40
+ setupPublishing()
41
+ }
42
+ }
43
+ }
44
+
45
+ // Skip Javadoc generation for Java 1.8 as it breaks build
46
+ if (JavaVersion .current().isJava8Compatible) {
47
+ tasks.withType<Javadoc > {
48
+ options {
49
+ this as StandardJavadocDocletOptions
50
+ addStringOption(" Xdoclint:none" , " -quiet" )
52
51
}
53
52
}
54
53
}
55
54
56
55
val Project .configDir get() = " $rootDir /library/quality"
57
56
val Project .reportsDir get() = " $buildDir /reports"
58
57
58
+ /* *
59
+ * Extension property to determine if a Project is the 'library' module
60
+ */
61
+ val Project .isLibrary get() = name == " library"
62
+
63
+ /* *
64
+ * Extension property to get the maven artifact name for a Project.
65
+ */
66
+ val Project .artifactName get() = if (isLibrary) " firebase-ui" else " firebase-ui-${this .name} "
67
+
68
+ /* *
69
+ * Extension property to get the name for a Project's maven publication.
70
+ */
71
+ val Project .publicationName get() = if (isLibrary) " monolithLibrary" else " ${name} Library"
72
+
59
73
fun Project.configureAndroid () {
60
74
if (name == " app" || name == " proguard-tests" ) {
61
75
apply (plugin = " com.android.application" )
@@ -113,9 +127,8 @@ fun Project.configureQuality() {
113
127
}
114
128
}
115
129
116
- fun Project.setupPublishing (isLibrary : Boolean ) {
117
- val publicationName = if (isLibrary) " monolithLibrary" else " ${name} Library"
118
- val artifactName = if (isLibrary) " firebase-ui" else " firebase-ui-${project.name} "
130
+ fun Project.setupPublishing () {
131
+ println (" Configuring publishing for ${this } " )
119
132
120
133
val sourcesJar = task<Jar >(" sourcesJar" ) {
121
134
classifier = " sources"
@@ -138,7 +151,7 @@ fun Project.setupPublishing(isLibrary: Boolean) {
138
151
artifacts.add(" archives" , sourcesJar)
139
152
140
153
tasks.whenTaskAdded {
141
- if (name.contains(" publish" ) && name.contains(" publication" , true )) {
154
+ if (name.toLowerCase(). contains(" publish" ) && name.contains(" publication" , true )) {
142
155
dependsOn(" assembleRelease" )
143
156
}
144
157
}
@@ -189,7 +202,6 @@ fun Project.setupPublishing(isLibrary: Boolean) {
189
202
190
203
apply (plugin = " maven-publish" )
191
204
apply (plugin = " com.jfrog.artifactory" )
192
- apply (plugin = " com.jfrog.bintray" )
193
205
194
206
configure<PublishingExtension > {
195
207
repositories {
@@ -210,6 +222,7 @@ fun Project.setupPublishing(isLibrary: Boolean) {
210
222
// We need to override the variables 'group' and 'version' on the 'Project' object in order
211
223
// to prevent the bintray plugin from creating 'unspecified' artifacts.
212
224
val groupName = " com.firebaseui"
225
+ val projectName = name
213
226
group = groupName
214
227
version = Config .version
215
228
@@ -219,10 +232,18 @@ fun Project.setupPublishing(isLibrary: Boolean) {
219
232
artifactId = artifactName
220
233
version = Config .version
221
234
222
- artifact(" $buildDir /outputs/aar/${project.name} -release.aar" )
235
+ val releaseAar = " $buildDir /outputs/aar/${projectName} -release.aar"
236
+
237
+ artifact(releaseAar)
223
238
artifact(javadocJar)
224
239
artifact(sourcesJar)
225
240
241
+ println (" Creating maven publication $publicationName " )
242
+ println (" \t group: $groupName " )
243
+ println (" \t artifact: $artifactName " )
244
+ println (" \t version: $version " )
245
+ println (" \t aar: $releaseAar " )
246
+
226
247
pom {
227
248
name.set(" FirebaseUI ${project.name.capitalize()} " )
228
249
description.set(" Firebase UI for Android" )
@@ -310,20 +331,50 @@ fun Project.setupPublishing(isLibrary: Boolean) {
310
331
311
332
tasks.withType<ArtifactoryTask > { publications(publicationName) }
312
333
334
+ apply (plugin = " com.jfrog.bintray" )
335
+
313
336
configure<BintrayExtension > {
337
+
314
338
user = bintrayUsername
315
339
key = bintrayKey
316
340
setPublications(publicationName)
317
341
setConfigurations(" archives" )
318
342
343
+ println (" Bintray configuration for ${publicationName} " )
344
+ println (" \t artifact: ${artifactName} " )
345
+ publications.forEach { pubName ->
346
+ println (" \t pub: $pubName " )
347
+
348
+ val publ = project.extensions
349
+ .getByType(PublishingExtension ::class .java)
350
+ .publications.findByName(pubName) as MavenPublication
351
+
352
+ publ.artifacts.forEach { art ->
353
+ println (" \t\t pub_artifact: $art " )
354
+ }
355
+ }
356
+ configurations.forEach { config ->
357
+ println (" \t config: $config " )
358
+
359
+ project.configurations.findByName(config)?.allArtifacts?.forEach { art ->
360
+ println (" \t\t config_artifact: $art " )
361
+ }
362
+ }
363
+
364
+ // When uploading, move and rename the generated POM
365
+ val pomSrc = " $buildDir /publications/$publicationName /pom-default.xml"
366
+ val pomDst = " com/firebaseui/$artifactName /${Config .version} /"
367
+ val pomName = " $artifactName -${Config .version} .pom"
368
+
369
+ println (" POM Transformation" )
370
+ println (" \t src: ${pomSrc} " )
371
+ println (" \t dst: ${pomDst} " )
372
+ println (" \t name: ${pomName} " )
373
+
319
374
filesSpec(closureOf<RecordingCopyTask > {
320
- from(if (isLibrary) {
321
- " $buildDir /publications/monolithLibrary/pom-default.xml"
322
- } else {
323
- " $buildDir /publications/${project.name} Library/pom-default.xml"
324
- })
325
- into(" com/firebaseui/$artifactName /${Config .version} /" )
326
- rename(KotlinClosure1 <String , String >({ " $artifactName -${Config .version} .pom" }))
375
+ from(pomSrc)
376
+ into(pomDst)
377
+ rename(KotlinClosure1 <String , String >({ pomName }))
327
378
})
328
379
329
380
pkg(closureOf<BintrayExtension .PackageConfig > {
0 commit comments