@@ -6,7 +6,7 @@ buildscript {
6
6
mavenLocal()
7
7
}
8
8
dependencies {
9
- classpath ' com.android.tools.build:gradle:1.5 .0'
9
+ classpath ' com.android.tools.build:gradle:2.0 .0'
10
10
classpath ' com.google.gms:google-services:3.0.0'
11
11
12
12
classpath ' com.neenbedankt.gradle.plugins:android-apt:1.8'
@@ -29,16 +29,18 @@ allprojects { project ->
29
29
30
30
// Get constants, this is where we store things
31
31
// like the list of submodules or the version
32
- apply from : " $rootDir /common/constants.gradle"
32
+ project . apply from : " $rootDir /common/constants.gradle"
33
33
34
34
def isLibrary = ' library' . equals(project. name)
35
35
def isSubmodule = project. ext. submodules. contains(project. name)
36
- def pomTask = " generatePomFileFor${ project.name.capitalize()} LibraryPublication"
37
36
38
- if (isSubmodule) {
37
+ // Only applies to submodules, not the library module
38
+ def pomTask = " generatePomFileFor${ project.name.capitalize()} LibraryPublication" ;
39
+
40
+ if (isSubmodule || isLibrary) {
39
41
40
42
// So that we can resolve 'android' variable
41
- apply plugin : ' com.android.library'
43
+ project . apply plugin : ' com.android.library'
42
44
android {
43
45
compileSdkVersion 23
44
46
buildToolsVersion " ${ project.ext.buildtools} "
@@ -65,10 +67,7 @@ allprojects { project ->
65
67
66
68
// Define base name for archives
67
69
// Ex: firebase-ui-auth
68
- archivesBaseName = " firebase-ui-${ project.name} "
69
-
70
- // Convenience tasks that depends on the above
71
- task prepareArtifacts(dependsOn : [javadocJar, sourcesJar, assembleRelease, pomTask]) {}
70
+ archivesBaseName = isSubmodule ? " firebase-ui-${ project.name} " : " firebase-ui"
72
71
73
72
// Use tasks above to define artifacts
74
73
artifacts {
@@ -77,7 +76,31 @@ allprojects { project ->
77
76
}
78
77
79
78
// So that we can define publication
80
- apply plugin : ' maven-publish'
79
+ project. apply plugin : ' maven-publish'
80
+
81
+ publishing {
82
+ // By passing -Pcustom_local=/some/path and running the
83
+ // publishLibraryPublicationToCustomLocalRepository task you can publish this library to a
84
+ // custom maven repository location on your machine.
85
+ repositories {
86
+ maven {
87
+ name ' CustomLocal'
88
+ url uri(project. hasProperty(' custom_local' ) ? project. getProperty(' custom_local' ) : ' /tmp/' )
89
+ }
90
+ }
91
+
92
+ repositories {
93
+ maven {
94
+ name ' BuildLocal'
95
+ url " $buildDir /repo"
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ if (isSubmodule) {
102
+ // Convenience task to prepare everything we need for releases
103
+ task prepareArtifacts(dependsOn : [javadocJar, sourcesJar, assembleRelease, pomTask]) {}
81
104
82
105
publishing {
83
106
@@ -110,32 +133,48 @@ allprojects { project ->
110
133
}
111
134
}
112
135
}
113
-
114
136
}
137
+ }
138
+ }
115
139
116
- // By passing -Pcustom_local=/some/path and running the
117
- // publishLibraryPublicationToCustomLocalRepository task you can publish this library to a
118
- // custom maven repository location on your machine.
119
- repositories {
120
- maven {
121
- name ' CustomLocal'
122
- url uri(project. hasProperty(' custom_local' ) ? project. getProperty(' custom_local' ) : ' /tmp/' )
123
- }
124
- }
140
+ if (isLibrary) {
125
141
126
- repositories {
127
- maven {
128
- name ' BuildLocal'
129
- url " $buildDir /repo"
142
+ // Define the monolith publication
143
+ publishing {
144
+
145
+ publications {
146
+ monolithLibrary(MavenPublication ) {
147
+ groupId project. ext. group
148
+ artifactId archivesBaseName
149
+ version project. ext. version
150
+
151
+ artifact " $buildDir /outputs/aar/$archivesBaseName -release.aar"
152
+ artifact javadocJar
153
+ artifact sourcesJar
154
+
155
+ // Monolith is just a POM that depends on the others
156
+ pom. withXml {
157
+ def dependenciesNode = asNode(). getAt(" dependencies" )[0 ]
158
+ if (dependenciesNode == null ) {
159
+ dependenciesNode = asNode(). appendNode(" dependencies" );
160
+ }
161
+
162
+ // Add a maven dependency on each submodule
163
+ project. ext. submodules. each { module ->
164
+ def dependencyNode = dependenciesNode. appendNode(' dependency' )
165
+ dependencyNode. appendNode(' groupId' , project. ext. group)
166
+ dependencyNode. appendNode(' artifactId' , " firebase-ui-${ module} " )
167
+ dependencyNode. appendNode(' version' , project. ext. version)
168
+ }
169
+ }
130
170
}
131
171
}
132
-
133
172
}
134
173
}
135
174
136
175
// Bintray Configuration (applies to submodule and the monolith)
137
176
if (isSubmodule || isLibrary) {
138
- apply plugin : ' com.jfrog.bintray'
177
+ project . apply plugin : ' com.jfrog.bintray'
139
178
140
179
def archivesBaseName = isLibrary ? ' firebase-ui' : " firebase-ui-${ project.name} "
141
180
def pomLoc = isLibrary ? " $buildDir /publications/monolithLibrary/pom-default.xml" : " $buildDir /publications/${ project.name} Library/pom-default.xml"
0 commit comments