@@ -121,47 +121,72 @@ uploadArchives {
121
121
beforeDeployment {
122
122
MavenDeployment deployment -> signing. signPom(deployment)
123
123
}
124
+ editPom(pom)
124
125
125
- // POM metadata.
126
- pom. groupId = PUBLISH_GROUP_ID
127
- pom. artifactId = PUBLISH_ARTIFACT_ID
128
- pom. version = PUBLISH_VERSION
129
- pom. project {
130
- name PUBLISH_NAME
131
- packaging ' aar'
132
- description PUBLISH_DESCRIPTION
133
- url ' https://github.com/algolia/algoliasearch-client-android'
126
+ // Maven Central repository.
127
+ repository(url : " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ) {
128
+ authentication(
129
+ userName : project. hasProperty(' nexusUsername' ) ? project[' nexusUsername' ] : ' FIXME' ,
130
+ password : project. hasProperty(' nexusPassword' ) ? project[' nexusPassword' ] : ' FIXME'
131
+ )
132
+ }
133
+ // Maven Central snapshot repository.
134
+ snapshotRepository(url : " https://oss.sonatype.org/content/repositories/snapshots/" ) {
135
+ authentication(
136
+ userName : project. hasProperty(' nexusUsername' ) ? project[' nexusUsername' ] : ' FIXME' ,
137
+ password : project. hasProperty(' nexusPassword' ) ? project[' nexusPassword' ] : ' FIXME'
138
+ )
139
+ }
140
+ }
141
+ }
134
142
135
- scm {
136
- url ' https://github.com/algolia/algoliasearch-client-android'
137
- connection ' scm:git:https://github.com/algolia/algoliasearch-client-android.git'
138
- }
143
+ // Test uploading of the archives to a local directory.
144
+ task testUploadArchives (type : Upload ) {
145
+ configuration = configurations. archives
146
+ uploadDescriptor = true
147
+ repositories. mavenDeployer {
148
+ beforeDeployment {
149
+ MavenDeployment deployment -> signing. signPom(deployment)
150
+ }
151
+ editPom(pom)
152
+ repository(url : " file://$buildDir /mvnrep" )
153
+ }
154
+ }
139
155
140
- licenses {
141
- license {
142
- name ' MIT'
143
- url ' http://opensource.org/licenses/MIT'
144
- }
145
- }
156
+ // Edit the Maven POM.
157
+ //
158
+ // NOTE: This function is meant to factorize POM generation between the built-in `uploadArchives` and the custom
159
+ // `testUploadArchives` tasks.
160
+ //
161
+ def editPom (pom ) {
162
+ // POM metadata.
163
+ pom. groupId = PUBLISH_GROUP_ID
164
+ pom. artifactId = PUBLISH_ARTIFACT_ID
165
+ pom. version = PUBLISH_VERSION
166
+ pom. project {
167
+ name PUBLISH_NAME
168
+ packaging ' aar'
169
+ description PUBLISH_DESCRIPTION
170
+ url ' https://github.com/algolia/algoliasearch-client-android'
171
+
172
+ scm {
173
+ url ' https://github.com/algolia/algoliasearch-client-android'
174
+ connection ' scm:git:https://github.com/algolia/algoliasearch-client-android.git'
175
+ }
146
176
147
- developers {
148
- developer {
149
- id ' algolia'
150
- name ' The Algolia Team'
151
-
152
- }
177
+ licenses {
178
+ license {
179
+ name ' MIT'
180
+ url ' http://opensource.org/licenses/MIT'
153
181
}
154
182
}
155
183
156
- // Local repository, to test publication contents.
157
- repository(url : " file://$buildDir /mvnrep" )
158
-
159
- // Maven Central repository.
160
- repository(url : PUBLISH_VERSION . endsWith(" -SNAPSHOT" ) ? " https://oss.sonatype.org/content/repositories/snapshots/" : " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ) {
161
- authentication(
162
- userName : project. hasProperty(' nexusUsername' ) ? project[' nexusUsername' ] : ' FIXME' ,
163
- password : project. hasProperty(' nexusPassword' ) ? project[' nexusPassword' ] : ' FIXME'
164
- )
184
+ developers {
185
+ developer {
186
+ id ' algolia'
187
+ name ' The Algolia Team'
188
+
189
+ }
165
190
}
166
191
}
167
192
}
0 commit comments